Skip to main content

ManagedService

Trait ManagedService 

Source
pub trait ManagedService: Send + Sync {
    // Required methods
    fn descriptor(&self) -> &ServiceDescriptor;
    fn start(&self) -> SupervisorResult<()>;
    fn stop(&self, timeout: Duration) -> SupervisorResult<()>;
    fn health(&self) -> ServiceHealth;

    // Provided method
    fn runtime_state(&self) -> ServiceRuntimeState { ... }
}
Expand description

Lifecycle boundary implemented by every supervised Runtime service.

Required Methods§

Source

fn descriptor(&self) -> &ServiceDescriptor

Returns immutable identity, dependencies, resource, and policy.

Source

fn start(&self) -> SupervisorResult<()>

Starts the service and its bounded resources.

Source

fn stop(&self, timeout: Duration) -> SupervisorResult<()>

Requests cooperative shutdown inside timeout.

Source

fn health(&self) -> ServiceHealth

Returns current service health.

Provided Methods§

Source

fn runtime_state(&self) -> ServiceRuntimeState

Returns the concrete service execution state.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§