kitsune2_api/
local_agent_store.rs1use crate::agent::DynLocalAgent;
2use crate::{builder, config, id, BoxFut, K2Result};
3use std::sync::Arc;
4
5pub trait LocalAgentStore: 'static + Send + Sync + std::fmt::Debug {
9 fn add(&self, local_agent: DynLocalAgent) -> BoxFut<'_, K2Result<()>>;
11
12 fn remove(
14 &self,
15 local_agent: id::AgentId,
16 ) -> BoxFut<'_, Option<DynLocalAgent>>;
17
18 fn get_all(&self) -> BoxFut<'_, K2Result<Vec<DynLocalAgent>>>;
20}
21
22pub type DynLocalAgentStore = Arc<dyn LocalAgentStore>;
24
25pub trait LocalAgentStoreFactory:
27 'static + Send + Sync + std::fmt::Debug
28{
29 fn default_config(&self, config: &mut config::Config) -> K2Result<()>;
32
33 fn validate_config(&self, config: &config::Config) -> K2Result<()>;
35
36 fn create(
38 &self,
39 builder: Arc<builder::Builder>,
40 ) -> BoxFut<'static, K2Result<DynLocalAgentStore>>;
41}
42
43pub type DynLocalAgentStoreFactory = Arc<dyn LocalAgentStoreFactory>;