Struct overclock::core::Service

source ·
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

source

pub fn new<A: 'static + Actor<S>, S: SupHandle<A>>( directory: Option<String> ) -> Self

Create a new Service

source

pub fn scopes_iter<'a, Child: 'static>(&'a self) -> ServiceScopesIterator<'a>

Create scopes iterator for a the provided Child type

source

pub fn actor_type_id(&self) -> TypeId

Return the actor type id

source

pub fn actor_type_name(&self) -> &'static str

Return actor type name, note: only for debuging

source

pub fn with_status(self, service_status: ServiceStatus) -> Self

Set the service status

source

pub fn update_status(&mut self, service_status: ServiceStatus)

Update the service status

source

pub fn directory(&self) -> &Option<String>

Return the directory name of the actor (if available)

source

pub fn with_downtime_ms(self, downtime_ms: u64) -> Self

Set the service downtime in milliseconds

source

pub fn is_type<T: 'static>(&self) -> bool

Check the owner actor’s type of the service

source

pub fn is_stopping(&self) -> bool

Check if the service is stopping

source

pub fn is_stopped(&self) -> bool

Check if the service is stopped

source

pub fn is_running(&self) -> bool

Check if the service is running

source

pub fn is_idle(&self) -> bool

Check if the service is idle

source

pub fn is_outage(&self) -> bool

Check if the service status is outage

source

pub fn is_starting(&self) -> bool

Check if the service is starting

source

pub fn is_initializing(&self) -> bool

Check if the service is initializing

source

pub fn is_maintenance(&self) -> bool

Check if the service is in maintenance

source

pub fn is_degraded(&self) -> bool

Check if the service is degraded

source

pub fn status(&self) -> &ServiceStatus

Get the service status

source

pub fn microservices(&self) -> &HashMap<ScopeId, Service>

Return immutable reference to the microservices HashMap

Trait Implementations§

source§

impl Clone for Service

source§

fn clone(&self) -> Service

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Service

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Service

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Serialize for Service

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TreeItem for Service

§

type Child = Service

The type of this item’s child items Read more
source§

fn write_self<W: Write>(&self, f: &mut W, _style: &Style) -> Result<()>

Write the item’s own contents (without children) to f Read more
source§

fn children(&self) -> Cow<'_, [Self::Child]>

Retrieve a list of this item’s children Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<E, T, const C: usize> ChannelBuilder<AbortableBoundedChannel<E, C>> for Twhere E: Send + 'static, T: Send,

source§

fn build_channel<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<AbortableBoundedChannel<E, C>, ActorError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, T: 'async_trait,

Implement how to build the channel for the corresponding actor
source§

impl<E, T> ChannelBuilder<AbortableUnboundedChannel<E>> for Twhere E: Send + 'static, T: Send,

source§

fn build_channel<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<AbortableUnboundedChannel<E>, ActorError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, T: 'async_trait,

Implement how to build the channel for the corresponding actor
source§

impl<E, T, const C: usize> ChannelBuilder<BoundedChannel<E, C>> for Twhere E: ShutdownEvent + 'static, T: Send,

source§

fn build_channel<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<BoundedChannel<E, C>, ActorError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, T: 'async_trait,

Implement how to build the channel for the corresponding actor
source§

impl<T, const I: u64> ChannelBuilder<IntervalChannel<I>> for Twhere T: Send,

source§

fn build_channel<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<IntervalChannel<I>, ActorError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, T: 'async_trait,

Implement how to build the channel for the corresponding actor
source§

impl<T, C, B> ChannelBuilder<Marker<C, B>> for Twhere B: Send + 'static + Sync, T: Send + ChannelBuilder<C>, C: Channel,

source§

fn build_channel<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<Marker<C, B>, ActorError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, T: 'async_trait,

Implement how to build the channel for the corresponding actor
source§

impl<T> ChannelBuilder<NullChannel> for Twhere T: Send,

source§

fn build_channel<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<NullChannel, ActorError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, T: 'async_trait,

Implement how to build the channel for the corresponding actor
source§

impl<E, T> ChannelBuilder<UnboundedChannel<E>> for Twhere E: ShutdownEvent + 'static, T: Send,

source§

fn build_channel<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<UnboundedChannel<E>, ActorError>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, T: 'async_trait,

Implement how to build the channel for the corresponding actor
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> CloneAny for Twhere T: Any + Clone,

source§

impl<T> Resource for Twhere T: Clone + Send + Sync + 'static,