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
sourceimpl 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>ⓘNotable traits for ServiceScopesIterator<'a>impl<'a> Iterator for ServiceScopesIterator<'a> type Item = ScopeId;
pub fn scopes_iter<'a, Child: 'static>(&'a self) -> ServiceScopesIterator<'a>ⓘNotable traits for ServiceScopesIterator<'a>impl<'a> Iterator for ServiceScopesIterator<'a> type Item = ScopeId;
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
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl UnwindSafe for Service
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more