reactive_graph_behaviour_service_api/
relation_component_behaviour_registry.rs1use std::sync::Arc;
2
3use async_trait::async_trait;
4use springtime_di::injectable;
5
6use reactive_graph_behaviour_model_api::prelude::*;
7use reactive_graph_graph::ComponentTypeId;
8use reactive_graph_graph::RelationInstanceId;
9use reactive_graph_lifecycle::Lifecycle;
10use reactive_graph_reactive_model_impl::ReactiveRelation;
11
12#[injectable]
13#[async_trait]
14pub trait RelationComponentBehaviourRegistry: Send + Sync + Lifecycle {
15 fn register(
17 &self,
18 component_behaviour_ty: ComponentBehaviourTypeId,
19 factory: Arc<dyn BehaviourFactory<RelationInstanceId, ReactiveRelation> + Send + Sync>,
20 );
21
22 fn unregister(&self, component_behaviour_ty: &ComponentBehaviourTypeId);
24
25 fn get_all(&self) -> Vec<ComponentBehaviourTypeId>;
27
28 fn get(&self, component_ty: &ComponentTypeId) -> Vec<Arc<dyn BehaviourFactory<RelationInstanceId, ReactiveRelation> + Send + Sync>>;
30
31 fn get_behaviour_types(&self, component_ty: &ComponentTypeId) -> Vec<ComponentBehaviourTypeId>;
33
34 fn get_by_behaviour_type(&self, behaviour_ty: &BehaviourTypeId) -> Option<ComponentBehaviourTypeId>;
36
37 fn count(&self) -> usize;
39}