pub struct RegistryRegion { /* private fields */ }Expand description
Fabric-backed registry storage.
Internally stores a FabricHashMap<String, Vec<RegistrationSlot>> where
the key is the service name and the value is a list of instance
registrations. A monotonic version counter is bumped on every mutation
to support RegistryWatcher change detection.
Implementations§
Source§impl RegistryRegion
impl RegistryRegion
Sourcepub fn new(
capacity: usize,
default_ttl_secs: u32,
name_stride: usize,
slot_stride: usize,
) -> Result<Self>
pub fn new( capacity: usize, default_ttl_secs: u32, name_stride: usize, slot_stride: usize, ) -> Result<Self>
Create a new registry region with the given capacity and strides.
Sourcepub fn register(&mut self, reg: ServiceRegistration) -> Result<()>
pub fn register(&mut self, reg: ServiceRegistration) -> Result<()>
Register a service instance. If a registration with the same
instance_id already exists under the same name, it is replaced.
Sourcepub fn deregister(&mut self, name: &str, instance_id: u128) -> Result<bool>
pub fn deregister(&mut self, name: &str, instance_id: u128) -> Result<bool>
Remove a specific instance from the registry.
Sourcepub fn set_health(
&mut self,
name: &str,
instance_id: u128,
health: HealthStatus,
) -> Result<bool>
pub fn set_health( &mut self, name: &str, instance_id: u128, health: HealthStatus, ) -> Result<bool>
Update the health status of a specific instance.
Sourcepub fn set_draining(&mut self, name: &str, instance_id: u128) -> Result<bool>
pub fn set_draining(&mut self, name: &str, instance_id: u128) -> Result<bool>
Set a specific instance to HealthStatus::Draining.
Sourcepub fn lookup(&self, name: &str) -> Result<Vec<ServiceRegistration>>
pub fn lookup(&self, name: &str) -> Result<Vec<ServiceRegistration>>
Look up all registrations for a service name.
Sourcepub fn lookup_one(&self, name: &str) -> Result<Option<ServiceRegistration>>
pub fn lookup_one(&self, name: &str) -> Result<Option<ServiceRegistration>>
Look up a single registration for a service name (returns the first match).
Sourcepub fn lookup_filtered(
&self,
name: &str,
filter: &RegistryFilter,
) -> Result<Vec<ServiceRegistration>>
pub fn lookup_filtered( &self, name: &str, filter: &RegistryFilter, ) -> Result<Vec<ServiceRegistration>>
Look up registrations matching a filter.
Sourcepub fn list_services(&self) -> Result<Vec<String>>
pub fn list_services(&self) -> Result<Vec<String>>
List all distinct service names in the registry.