Skip to main content

SystemService

Trait SystemService 

Source
pub trait SystemService: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn service_type(&self) -> ServiceType;
    fn start<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn health_detail(&self) -> Option<String> { ... }
    fn liveness_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ProbeResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn readiness_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ProbeResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A system service managed by the kernel.

Services are started during boot and stopped during shutdown. Each service provides a health check for monitoring.

Required Methods§

Source

fn name(&self) -> &str

Human-readable service name.

Source

fn service_type(&self) -> ServiceType

Service type category.

Source

fn start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start the service.

Source

fn stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stop the service.

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Perform a health check.

Provided Methods§

Source

fn health_detail(&self) -> Option<String>

Optional operator-facing detail (metrics, endpoints, …).

Surfaced next to health in kernel.services / weft status without changing the Healthy/Degraded/Unhealthy classification. Default: None (no extra detail). WEFT-333.

Source

fn liveness_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ProbeResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Liveness probe (K2b-G2, os-patterns).

Returns whether the service process is alive. Default implementation returns Live for backward compatibility.

Source

fn readiness_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ProbeResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Readiness probe (K2b-G2, os-patterns).

Returns whether the service is ready to accept traffic. Default implementation returns Ready for backward compatibility.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§