reactive_graph_behaviour_service_api/
entity_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_lifecycle::Lifecycle;
8use reactive_graph_reactive_model_impl::ReactiveEntity;
9
10#[injectable]
11#[async_trait]
12pub trait EntityBehaviourManager: Send + Sync + Lifecycle {
13 fn add_behaviours(&self, entity_instance: ReactiveEntity);
15
16 fn add_behaviour(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId);
18
19 fn remove_behaviour(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId);
21
22 fn remove_behaviours(&self, entity_instance: ReactiveEntity);
24
25 fn remove_behaviours_by_id(&self, id: &Uuid);
27
28 fn remove_behaviours_by_behaviour(&self, behaviour_ty: &BehaviourTypeId);
30
31 fn has(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId) -> bool;
33
34 fn get_all(&self, entity_instance: ReactiveEntity) -> Vec<BehaviourTypeId>;
36
37 fn get_instances_by_behaviour(&self, ty: &BehaviourTypeId) -> Vec<ReactiveEntity>;
39
40 fn connect(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId) -> Result<(), BehaviourTransitionError>;
42
43 fn disconnect(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId) -> Result<(), BehaviourTransitionError>;
45
46 fn reconnect(&self, entity_instance: ReactiveEntity, behaviour_ty: &BehaviourTypeId) -> Result<(), BehaviourTransitionError>;
48}