RegistryWriter

Struct RegistryWriter 

Source
pub struct RegistryWriter { /* private fields */ }
Expand description

Write handle for the service registry.

Provides register, update, deregister, and health-management operations. All mutations bump the registry version for watcher notification.

Implementations§

Source§

impl RegistryWriter

Source

pub fn new(region: RegistryRegion) -> Self

Create a writer wrapping the given region.

Source

pub fn register(&mut self, reg: ServiceRegistration) -> Result<()>

Register a service instance.

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 draining.

Source

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

Prune expired registrations. Returns the number pruned.

Source

pub fn version(&self) -> u64

Return the current registry version.

Source

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

Look up registrations (convenience — delegates to the underlying region).

Source

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

List all service names (convenience).

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.