pub struct ServiceRegistry { /* private fields */ }Expand description
Centralized service registry for managing discovered and registered services
Implementations§
Source§impl ServiceRegistry
impl ServiceRegistry
Sourcepub fn with_settings(default_ttl: Duration, max_services: usize) -> Self
pub fn with_settings(default_ttl: Duration, max_services: usize) -> Self
Create a new service registry with custom settings
Sourcepub async fn register_local_service(
&self,
service: ServiceInfo,
protocol: ProtocolType,
) -> Result<()>
pub async fn register_local_service( &self, service: ServiceInfo, protocol: ProtocolType, ) -> Result<()>
Register a local service
Sourcepub async fn unregister_local_service(&self, service_id: &str) -> Result<()>
pub async fn unregister_local_service(&self, service_id: &str) -> Result<()>
Unregister a local service
Sourcepub async fn add_discovered_service(
&self,
service: ServiceInfo,
protocol: ProtocolType,
ttl: Option<Duration>,
) -> Result<()>
pub async fn add_discovered_service( &self, service: ServiceInfo, protocol: ProtocolType, ttl: Option<Duration>, ) -> Result<()>
Add a discovered service
Sourcepub async fn find_services(&self, filter: &ServiceFilter) -> Vec<ServiceInfo>
pub async fn find_services(&self, filter: &ServiceFilter) -> Vec<ServiceInfo>
Find services matching the given filter
Sourcepub async fn get_local_services(&self) -> Vec<ServiceInfo>
pub async fn get_local_services(&self) -> Vec<ServiceInfo>
Get all locally registered services
Sourcepub async fn get_discovered_services(&self) -> Vec<ServiceInfo>
pub async fn get_discovered_services(&self) -> Vec<ServiceInfo>
Get all discovered services
Sourcepub async fn get_services_by_type(
&self,
service_type: &ServiceType,
) -> Vec<ServiceInfo>
pub async fn get_services_by_type( &self, service_type: &ServiceType, ) -> Vec<ServiceInfo>
Get services by type
Sourcepub async fn get_services_by_protocol(
&self,
protocol: ProtocolType,
) -> Vec<ServiceInfo>
pub async fn get_services_by_protocol( &self, protocol: ProtocolType, ) -> Vec<ServiceInfo>
Get services by protocol
Sourcepub async fn is_local_service(&self, service_id: &str) -> bool
pub async fn is_local_service(&self, service_id: &str) -> bool
Check if a service is registered locally
Sourcepub async fn contains_service(&self, service_id: &str) -> bool
pub async fn contains_service(&self, service_id: &str) -> bool
Check if a service exists in the registry
Sourcepub async fn cleanup_expired(&self) -> usize
pub async fn cleanup_expired(&self) -> usize
Clean up expired services
Sourcepub async fn stats(&self) -> RegistryStats
pub async fn stats(&self) -> RegistryStats
Get registry statistics
Trait Implementations§
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