workflow_service/service.rs
1use crate::imports::*;
2
3#[async_trait]
4pub trait Service: Sync + Send {
5 fn name(&self) -> &'static str {
6 std::any::type_name::<Self>()
7 }
8
9 /// Start the service
10 async fn spawn(self: Arc<Self>, runtime: Runtime) -> Result<()>;
11
12 /// Signal the service termination (post a shutdown request)
13 fn terminate(self: Arc<Self>);
14
15 /// Block until the service is terminated
16 async fn join(self: Arc<Self>) -> Result<()>;
17}