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