pub trait Adapter: Send + Sync + Debug + Clone + 'static {
fn metadata(&self) -> Metadata;
fn next_id<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
value: &'life2 [u8]
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn scan<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<KeyStreamer>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
{ ... }
}
Expand description
KvAdapter is the adapter to underlying kv services.
By implement this trait, any kv service can work as an OpenDAL Service.
Required Methods
sourcefn next_id<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn next_id<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Fetch the next id.
- Returning id should never be zero.
- Returning id should never be reused.
sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Get a key from service.
- return
Ok(None)
if this key is not exist.
Provided Methods
sourcefn scan<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<KeyStreamer>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn scan<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<KeyStreamer>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Scan a range of keys.
If scan
is not supported, we will disable the block split
logic. Only one block will be store for one file.