reactive_graph_flow_impl/
flow_system_impl.rs

1use std::sync::Arc;
2
3use async_trait::async_trait;
4use springtime_di::Component;
5use springtime_di::component_alias;
6
7use reactive_graph_flow_api::FlowSystem;
8use reactive_graph_flow_api::FlowTypeSystemRegistrator;
9use reactive_graph_lifecycle::Lifecycle;
10
11#[derive(Component)]
12pub struct FlowSystemImpl {
13    flow_type_system_registrator: Arc<dyn FlowTypeSystemRegistrator + Send + Sync>,
14}
15
16#[async_trait]
17#[component_alias]
18impl FlowSystem for FlowSystemImpl {
19    fn get_flow_type_system_registrator(&self) -> Arc<dyn FlowTypeSystemRegistrator + Send + Sync> {
20        self.flow_type_system_registrator.clone()
21    }
22}
23
24#[async_trait]
25impl Lifecycle for FlowSystemImpl {
26    async fn init(&self) {
27        self.flow_type_system_registrator.init().await;
28    }
29
30    async fn post_init(&self) {
31        self.flow_type_system_registrator.post_init().await;
32    }
33
34    async fn pre_shutdown(&self) {
35        self.flow_type_system_registrator.pre_shutdown().await;
36    }
37
38    async fn shutdown(&self) {
39        self.flow_type_system_registrator.shutdown().await;
40    }
41}