pub struct ServiceRegistration {
pub name: String,
pub version: String,
pub instance_id: u128,
pub endpoints: Vec<ServiceEndpoint>,
pub tags: Vec<Tag>,
pub health: HealthStatus,
pub lease_expires_at: u64,
}Expand description
A single service registration in the registry.
Each registration identifies a unique instance of a named service with a version string, instance ID, endpoints, tags, health status, and a lease expiry timestamp (set by the registry on insertion).
Fields§
§name: StringService name (e.g. "api-gateway").
version: StringSemantic version string (e.g. "2.1.0").
instance_id: u128Unique instance identifier.
endpoints: Vec<ServiceEndpoint>Reachable endpoints for this instance.
Metadata tags for filtering.
health: HealthStatusCurrent health status.
lease_expires_at: u64Unix timestamp (seconds) at which this registration expires. Set by the registry on insertion; 0 means “not yet registered”.
Implementations§
Source§impl ServiceRegistration
impl ServiceRegistration
Sourcepub fn new(name: &str, version: &str, instance_id: u128) -> Self
pub fn new(name: &str, version: &str, instance_id: u128) -> Self
Create a new registration with the given name, version, and instance ID.
Defaults to HealthStatus::Healthy, no endpoints, no tags, and
lease_expires_at = 0.
Sourcepub fn with_endpoint(self, endpoint: ServiceEndpoint) -> Self
pub fn with_endpoint(self, endpoint: ServiceEndpoint) -> Self
Add an endpoint to this registration (builder pattern).
Sourcepub fn with_tag(self, key: &str, value: &str) -> Self
pub fn with_tag(self, key: &str, value: &str) -> Self
Add a tag to this registration (builder pattern).
Check whether all required tags are present (AND semantics).
Sourcepub fn version_matches_prefix(&self, prefix: &str) -> bool
pub fn version_matches_prefix(&self, prefix: &str) -> bool
Check whether the version string starts with the given prefix.
Trait Implementations§
Source§impl Clone for ServiceRegistration
impl Clone for ServiceRegistration
Source§fn clone(&self) -> ServiceRegistration
fn clone(&self) -> ServiceRegistration
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more