pub struct Service {
pub actor_type_id: TypeId,
pub actor_type_name: &'static str,
pub status: ServiceStatus,
pub directory: Option<String>,
pub up_since: SystemTime,
pub downtime_ms: u64,
pub microservices: HashMap<ScopeId, Self>,
pub inactive: HashMap<String, ScopeId>,
}
Expand description
An actor’s service metrics
Fields§
§actor_type_id: TypeId
The actor’s type id, who owns/manages the service
actor_type_name: &'static str
The actor type name, only for debuging or to provide context
status: ServiceStatus
The status of the actor
directory: Option<String>
The directory name of the actor, must be unique within the same spawned level
up_since: SystemTime
The start timestamp, used to calculate uptime
downtime_ms: u64
Accumulated downtime
microservices: HashMap<ScopeId, Self>
Microservices
inactive: HashMap<String, ScopeId>
Highlight any stopped service in microservices;
Implementations§
source§impl Service
impl Service
sourcepub fn new<A: 'static + Actor<S>, S: SupHandle<A>>(
directory: Option<String>
) -> Self
pub fn new<A: 'static + Actor<S>, S: SupHandle<A>>( directory: Option<String> ) -> Self
Create a new Service
sourcepub fn scopes_iter<'a, Child: 'static>(&'a self) -> ServiceScopesIterator<'a> ⓘ
pub fn scopes_iter<'a, Child: 'static>(&'a self) -> ServiceScopesIterator<'a> ⓘ
Create scopes iterator for a the provided Child type
sourcepub fn actor_type_id(&self) -> TypeId
pub fn actor_type_id(&self) -> TypeId
Return the actor type id
sourcepub fn actor_type_name(&self) -> &'static str
pub fn actor_type_name(&self) -> &'static str
Return actor type name, note: only for debuging
sourcepub fn with_status(self, service_status: ServiceStatus) -> Self
pub fn with_status(self, service_status: ServiceStatus) -> Self
Set the service status
sourcepub fn update_status(&mut self, service_status: ServiceStatus)
pub fn update_status(&mut self, service_status: ServiceStatus)
Update the service status
sourcepub fn directory(&self) -> &Option<String>
pub fn directory(&self) -> &Option<String>
Return the directory name of the actor (if available)
sourcepub fn with_downtime_ms(self, downtime_ms: u64) -> Self
pub fn with_downtime_ms(self, downtime_ms: u64) -> Self
Set the service downtime in milliseconds
sourcepub fn is_stopping(&self) -> bool
pub fn is_stopping(&self) -> bool
Check if the service is stopping
sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Check if the service is stopped
sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the service is running
sourcepub fn is_starting(&self) -> bool
pub fn is_starting(&self) -> bool
Check if the service is starting
sourcepub fn is_initializing(&self) -> bool
pub fn is_initializing(&self) -> bool
Check if the service is initializing
sourcepub fn is_maintenance(&self) -> bool
pub fn is_maintenance(&self) -> bool
Check if the service is in maintenance
sourcepub fn is_degraded(&self) -> bool
pub fn is_degraded(&self) -> bool
Check if the service is degraded
sourcepub fn status(&self) -> &ServiceStatus
pub fn status(&self) -> &ServiceStatus
Get the service status
sourcepub fn microservices(&self) -> &HashMap<ScopeId, Service>
pub fn microservices(&self) -> &HashMap<ScopeId, Service>
Return immutable reference to the microservices HashMap