pub struct ServiceRegistry { /* private fields */ }Expand description
In-process registry of all running service instances (held inside DaemonState).
Keyed by service_id (UUID v4 string). All mutations go through DaemonState’s
RwLock<ServiceRegistry> so that concurrent control requests are safe.
Implementations§
Source§impl ServiceRegistry
impl ServiceRegistry
Sourcepub fn register(&mut self, info: ServiceInfo)
pub fn register(&mut self, info: ServiceInfo)
Insert or replace a service entry. The entry’s id is used as the key.
Sourcepub fn get(&self, id: &str) -> Option<&ServiceInfo>
pub fn get(&self, id: &str) -> Option<&ServiceInfo>
Look up a service by its UUID. Returns None if not found.
Sourcepub fn get_mut(&mut self, id: &str) -> Option<&mut ServiceInfo>
pub fn get_mut(&mut self, id: &str) -> Option<&mut ServiceInfo>
Look up a service mutably (e.g. to update its ServiceStatus).
Sourcepub fn remove(&mut self, id: &str) -> Option<ServiceInfo>
pub fn remove(&mut self, id: &str) -> Option<ServiceInfo>
Remove and return a service by UUID. Returns None if not found.
Sourcepub fn all(&self) -> Vec<&ServiceInfo>
pub fn all(&self) -> Vec<&ServiceInfo>
Return references to all registered services (order is unspecified).
Trait Implementations§
Source§impl Default for ServiceRegistry
impl Default for ServiceRegistry
Source§fn default() -> ServiceRegistry
fn default() -> ServiceRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ServiceRegistry
impl RefUnwindSafe for ServiceRegistry
impl Send for ServiceRegistry
impl Sync for ServiceRegistry
impl Unpin for ServiceRegistry
impl UnwindSafe for ServiceRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more