pub struct ServiceRegistry { /* private fields */ }Expand description
Service registry and discovery.
Implementations§
Source§impl ServiceRegistry
impl ServiceRegistry
Sourcepub fn with_domain(domain: String) -> Self
pub fn with_domain(domain: String) -> Self
Create with a custom domain.
Sourcepub fn register(&mut self, entry: ServiceEntry) -> Result<(), DiscoveryError>
pub fn register(&mut self, entry: ServiceEntry) -> Result<(), DiscoveryError>
Register a new service.
Sourcepub fn deregister(
&mut self,
name: &str,
namespace: &str,
) -> Result<ServiceEntry, DiscoveryError>
pub fn deregister( &mut self, name: &str, namespace: &str, ) -> Result<ServiceEntry, DiscoveryError>
Deregister a service.
Sourcepub fn lookup(
&self,
name: &str,
namespace: &str,
) -> Result<&ServiceEntry, DiscoveryError>
pub fn lookup( &self, name: &str, namespace: &str, ) -> Result<&ServiceEntry, DiscoveryError>
Look up a service by name and namespace.
Sourcepub fn list(&self, namespace_filter: Option<&str>) -> Vec<&ServiceEntry>
pub fn list(&self, namespace_filter: Option<&str>) -> Vec<&ServiceEntry>
List all services, optionally filtered by namespace.
Sourcepub fn resolve_service_dns(
&self,
dns_name: &str,
) -> Result<&ServiceEntry, DiscoveryError>
pub fn resolve_service_dns( &self, dns_name: &str, ) -> Result<&ServiceEntry, DiscoveryError>
Resolve a Kubernetes-style DNS name to service endpoints.
Format: name.namespace.svc.cluster.local
Sourcepub fn fqdn(&self, name: &str, namespace: &str) -> String
pub fn fqdn(&self, name: &str, namespace: &str) -> String
Get the fully qualified DNS name for a service.
Sourcepub fn healthy_endpoints(
&self,
name: &str,
namespace: &str,
) -> Result<Vec<&ServiceEndpoint>, DiscoveryError>
pub fn healthy_endpoints( &self, name: &str, namespace: &str, ) -> Result<Vec<&ServiceEndpoint>, DiscoveryError>
Get healthy endpoints for a service.
Sourcepub fn update_endpoint_health(
&mut self,
name: &str,
namespace: &str,
address: &str,
healthy: bool,
) -> Result<(), DiscoveryError>
pub fn update_endpoint_health( &mut self, name: &str, namespace: &str, address: &str, healthy: bool, ) -> Result<(), DiscoveryError>
Update endpoint health for a service.
Sourcepub fn service_count(&self) -> usize
pub fn service_count(&self) -> usize
Get the total number of registered services.