melodium_engine/
engine.rs1use crate::error::{LogicErrors, LogicResult};
2use async_trait::async_trait;
3use melodium_common::{
4 descriptor::{Collection, Identifier},
5 executive::{DirectCreationCallback, Value},
6};
7use std::{collections::HashMap, sync::Arc};
8
9#[async_trait]
10pub trait Engine: Send + Sync {
11 fn collection(&self) -> Arc<Collection>;
12 fn genesis(&self, entry: &Identifier, params: HashMap<String, Value>) -> LogicResult<()>;
13 fn errors(&self) -> LogicErrors;
14 fn set_auto_end(&self, auto_end: bool);
15 fn auto_end(&self) -> bool;
16 async fn live(&self);
17 async fn instanciate(&self, callback: Option<DirectCreationCallback>) -> LogicResult<()>;
18 async fn end(&self);
19}