pub struct ServiceRegistry { /* private fields */ }Expand description
Registry of managed services with their configurations.
Implementations§
Source§impl ServiceRegistry
impl ServiceRegistry
Sourcepub fn register(&mut self, config: ServiceConfig) -> Result<(), ServiceError>
pub fn register(&mut self, config: ServiceConfig) -> Result<(), ServiceError>
Register a new service.
Returns Err if a service with the same name or port already exists.
Sourcepub fn get(&self, name: &str) -> Option<&ServiceConfig>
pub fn get(&self, name: &str) -> Option<&ServiceConfig>
Get a service by name.
Sourcepub fn all(&self) -> &[ServiceConfig]
pub fn all(&self) -> &[ServiceConfig]
Get all registered services.
Sourcepub fn enabled(&self) -> Vec<&ServiceConfig>
pub fn enabled(&self) -> Vec<&ServiceConfig>
Get all enabled services.
Sourcepub fn health_urls(&self) -> Vec<String>
pub fn health_urls(&self) -> Vec<String>
Get health check URLs for all enabled services.
Sourcepub fn all_local_only(&self) -> bool
pub fn all_local_only(&self) -> bool
Validate that all services bind to localhost only.
Since ServiceConfig always constructs addresses from LOCALHOST,
this always returns true.
Trait Implementations§
Source§impl Clone for ServiceRegistry
impl Clone for ServiceRegistry
Source§impl Debug for ServiceRegistry
impl Debug for ServiceRegistry
Source§impl Default for ServiceRegistry
impl Default for ServiceRegistry
Source§impl<'de> Deserialize<'de> for ServiceRegistry
impl<'de> Deserialize<'de> for ServiceRegistry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ServiceRegistry
impl PartialEq for ServiceRegistry
Source§impl Serialize for ServiceRegistry
impl Serialize for ServiceRegistry
impl StructuralPartialEq for ServiceRegistry
Auto Trait Implementations§
impl Freeze for ServiceRegistry
impl RefUnwindSafe for ServiceRegistry
impl Send for ServiceRegistry
impl Sync for ServiceRegistry
impl Unpin for ServiceRegistry
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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