1#[cfg(feature = "rpc")]
2pub mod rpc;
3
4use async_trait::async_trait;
5use rlay_ontology::ontology::Entity;
8use std::collections::HashMap;
9use std::future::Future;
10
11pub use failure::Error;
12pub use futures::future::BoxFuture;
13#[cfg(feature = "rpc")]
14pub use rpc::BackendRpcMethods;
15
16#[async_trait]
17pub trait GetEntity {
18 async fn get_entity(&self, cid: &[u8]) -> Result<Option<Entity>, Error>;
19}
20
21#[async_trait]
30pub trait ResolveEntity {
31 async fn resolve_entity(&self, cid: &[u8]) -> Result<HashMap<Vec<u8>, Vec<Entity>>, Error>;
32}
33
34pub trait BackendFromConfigAndSyncState: Sized {
35 type C;
36 type S;
37 type R: Future<Output = Result<Self, Error>> + Send;
38
39 fn from_config_and_syncstate(config: Self::C, sync_state: Self::S) -> Self::R;
40}