use crate::error::Result;
use std::sync::Arc;
#[allow(clippy::result_large_err)]
pub trait Store<T>: Send + Sync {
fn insert(&self, model: T) -> Result<()>;
fn get(&self, id: &str) -> Result<Option<T>>;
fn delete(&self, id: &str) -> Result<()>;
}
pub trait Service: Send + Sync {
type Request;
type Response;
type Error;
fn handle(&self, req: Self::Request) -> std::result::Result<Self::Response, Self::Error>;
}
pub trait ServiceRegistry: Send + Sync {
fn register<S>(&mut self, name: &str, service: Arc<S>)
where
S: Service + 'static;
fn get<S>(&self, name: &str) -> Option<Arc<S>>
where
S: Service + 'static;
}