workflow_egui/runtime/
service.rs

1use crate::imports::*;
2
3pub type ServiceResult = Result<()>;
4
5/// Service is a core component of the Kaspa NG application responsible for
6/// running application services and communication between these services.
7#[async_trait]
8pub trait Service: Sync + Send {
9    fn name(&self) -> &'static str;
10
11    /// Start the service
12    async fn spawn(self: Arc<Self>, runtime: Runtime) -> ServiceResult;
13
14    /// Signal the service termination (post a shutdown request)
15    fn terminate(self: Arc<Self>);
16
17    /// Block until the service is terminated
18    async fn join(self: Arc<Self>) -> ServiceResult;
19}