reactive_graph_plugin_api/instances/flows/flow_instance_manager.rs
1use uuid::Uuid;
2
3use reactive_graph_graph::FlowInstance;
4use reactive_graph_graph::FlowTypeId;
5use reactive_graph_graph::PropertyInstances;
6use reactive_graph_reactive_model_impl::ReactiveFlow;
7use reactive_graph_reactive_service_api::ReactiveFlowCreationError;
8
9pub trait FlowInstanceManager: Send + Sync {
10 /// Returns true, if an flow instance exists with the given UUID.
11 fn has(&self, id: Uuid) -> bool;
12
13 /// Returns the flow instance with the given UUID or None.
14 fn get(&self, id: Uuid) -> Option<ReactiveFlow>;
15
16 /// Returns the flow instance with the given label or None.
17 fn get_by_label(&self, label: &str) -> Option<ReactiveFlow>;
18
19 /// Creates a new reactive flow instance from the given flow instance descriptor.
20 ///
21 /// The wrapper entity instance will be created as well as entity and
22 /// relation instances.
23 ///
24 /// All reactive instances will be registered in the ReactiveEntityManager
25 /// and the ReactiveRelationManager.
26 fn create(&self, flow_instance: FlowInstance) -> Result<ReactiveFlow, ReactiveFlowCreationError>;
27
28 /// Create a new reactive flow instance from the flow type by the given name.
29 ///
30 /// It's possible to individualize the flow instance with templating using the given variables.
31 ///
32 /// The wrapper entity instance will be created as well as entity and
33 /// relation instances.
34 ///
35 /// All reactive instances will be registered in the ReactiveEntityManager
36 /// and the ReactiveRelationManager.
37 fn create_from_type(
38 &self,
39 ty: &FlowTypeId,
40 id: Option<Uuid>,
41 variables: PropertyInstances,
42 properties: PropertyInstances,
43 ) -> Result<ReactiveFlow, ReactiveFlowCreationError>;
44
45 /// Deletes the flow instance with the given id.
46 fn delete(&self, id: Uuid) -> bool;
47}