reactive_graph_behaviour_service_api/
entity_component_behaviour_manager.rs1use async_trait::async_trait;
2use springtime_di::injectable;
3use uuid::Uuid;
4
5use reactive_graph_behaviour_model_api::BehaviourTransitionError;
6use reactive_graph_behaviour_model_api::BehaviourTypeId;
7use reactive_graph_behaviour_model_api::ComponentBehaviourTypeId;
8use reactive_graph_graph::Component;
9use reactive_graph_lifecycle::Lifecycle;
10use reactive_graph_reactive_model_impl::ReactiveEntity;
11
12#[injectable]
13#[async_trait]
14pub trait EntityComponentBehaviourManager: Send + Sync + Lifecycle {
15 fn add_behaviours_to_entity(&self, entity_instance: ReactiveEntity);
17
18 fn add_behaviours_to_entity_component(&self, entity_instance: ReactiveEntity, component: Component);
20
21 fn add_behaviour_to_entity_component(&self, entity_instance: ReactiveEntity, component_behaviour_ty: &ComponentBehaviourTypeId);
23
24 fn remove_behaviour_from_entity(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId);
26
27 fn remove_behaviours_from_entity(&self, entity_instance: ReactiveEntity);
29
30 fn remove_behaviours_from_entity_component(&self, entity_instance: ReactiveEntity, component: Component);
32
33 fn remove_behaviours_by_id(&self, id: &Uuid);
35
36 fn remove_behaviours_by_behaviour(&self, behaviour_ty: &BehaviourTypeId);
38
39 fn has(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId) -> bool;
41
42 fn get_all(&self, entity_instance: ReactiveEntity) -> Vec<BehaviourTypeId>;
44
45 fn get_instances_by_behaviour(&self, ty: &BehaviourTypeId) -> Vec<ReactiveEntity>;
47
48 fn connect(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId) -> Result<(), BehaviourTransitionError>;
50
51 fn disconnect(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId) -> Result<(), BehaviourTransitionError>;
53
54 fn reconnect(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId) -> Result<(), BehaviourTransitionError>;
56}