RegistryRegion

Struct RegistryRegion 

Source
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

Source

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.

Source

pub fn version(&self) -> u64

Return the current version counter.

Source

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.

Source

pub fn deregister(&mut self, name: &str, instance_id: u128) -> Result<bool>

Remove a specific instance from the registry.

Source

pub fn set_health( &mut self, name: &str, instance_id: u128, health: HealthStatus, ) -> Result<bool>

Update the health status of a specific instance.

Source

pub fn set_draining(&mut self, name: &str, instance_id: u128) -> Result<bool>

Set a specific instance to HealthStatus::Draining.

Source

pub fn lookup(&self, name: &str) -> Result<Vec<ServiceRegistration>>

Look up all registrations for a service name.

Source

pub fn lookup_one(&self, name: &str) -> Result<Option<ServiceRegistration>>

Look up a single registration for a service name (returns the first match).

Source

pub fn lookup_filtered( &self, name: &str, filter: &RegistryFilter, ) -> Result<Vec<ServiceRegistration>>

Look up registrations matching a filter.

Source

pub fn list_services(&self) -> Result<Vec<String>>

List all distinct service names in the registry.

Source

pub fn tick(&mut self) -> Result<usize>

Prune expired registrations. Returns the number of instances removed.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.