Skip to main content

BackgroundService

Trait BackgroundService 

Source
pub trait BackgroundService {
    // Required method
    fn start<'life0, 'async_trait>(
        &'life0 self,
        shutdown: Receiver<bool>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

The background service interface

Required Methods§

Source

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

This function is called when the pingora server tries to start all the services. The background service can return at anytime or wait for the shutdown signal.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§