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