Trait Service

Source
pub trait Service: Sync + Send {
    // Required methods
    fn name(&self) -> &'static str;
    fn spawn<'async_trait>(
        self: Arc<Self>,
        runtime: Runtime,
    ) -> Pin<Box<dyn Future<Output = ServiceResult> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn terminate(self: Arc<Self>);
    fn join<'async_trait>(
        self: Arc<Self>,
    ) -> Pin<Box<dyn Future<Output = ServiceResult> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Service is a core component of the Kaspa NG application responsible for running application services and communication between these services.

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn spawn<'async_trait>( self: Arc<Self>, runtime: Runtime, ) -> Pin<Box<dyn Future<Output = ServiceResult> + Send + 'async_trait>>
where Self: 'async_trait,

Start the service

Source

fn terminate(self: Arc<Self>)

Signal the service termination (post a shutdown request)

Source

fn join<'async_trait>( self: Arc<Self>, ) -> Pin<Box<dyn Future<Output = ServiceResult> + Send + 'async_trait>>
where Self: 'async_trait,

Block until the service is terminated

Implementors§