reactive_graph_command_api/
command_manager.rs1use async_trait::async_trait;
2use springtime_di::injectable;
3
4use reactive_graph_command_model::Command;
5use reactive_graph_command_model::error::NoSuchCommand;
6use reactive_graph_graph::EntityType;
7use reactive_graph_lifecycle::Lifecycle;
8
9use crate::CommandRegistrationError;
10
11#[injectable]
12#[async_trait]
13pub trait CommandManager: Send + Sync + Lifecycle {
14 fn get_command(&self, name: &str) -> Result<Command, NoSuchCommand>;
16
17 fn get_commands(&self) -> Vec<Command>;
19
20 fn register_command(&self, command: Command) -> Result<(), CommandRegistrationError>;
22
23 fn register_singleton_command(&self, command: Command, entity_type: EntityType) -> Result<(), CommandRegistrationError>;
25}