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
use crate::block::BlockStore;
use crate::key_value::KeyValueStore;
use anyhow::Result;
use async_trait::async_trait;
#[cfg(not(target_arch = "wasm32"))]
pub trait StorageSendSync: Send + Sync {}
#[cfg(not(target_arch = "wasm32"))]
impl<T> StorageSendSync for T where T: Send + Sync {}
#[cfg(target_arch = "wasm32")]
pub trait StorageSendSync {}
#[cfg(target_arch = "wasm32")]
impl<T> StorageSendSync for T {}
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
pub trait Storage: Clone + StorageSendSync {
type BlockStore: BlockStore;
type KeyValueStore: KeyValueStore;
async fn get_block_store(&self, name: &str) -> Result<Self::BlockStore>;
async fn get_key_value_store(&self, name: &str) -> Result<Self::KeyValueStore>;
}