pub trait Adapter: Send + Sync + Debug + Unpin + 'static {
// Required methods
fn metadata(&self) -> Metadata;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
value: &'life2 [u8]
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn blocking_get(&self, path: &str) -> Result<Option<Vec<u8>>> { ... }
fn blocking_set(&self, path: &str, value: &[u8]) -> Result<()> { ... }
fn blocking_delete(&self, path: &str) -> Result<()> { ... }
fn scan<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn blocking_scan(&self, path: &str) -> Result<Vec<String>> { ... }
fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
value: &'life2 [u8]
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn blocking_append(&self, path: &str, value: &[u8]) -> Result<()> { ... }
}
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 get<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Get a key from service.
- return
Ok(None)
if this key is not exist.
Provided Methods§
sourcefn blocking_delete(&self, path: &str) -> Result<()>
fn blocking_delete(&self, path: &str) -> Result<()>
Delete a key from service in blocking way.
- return
Ok(())
even if this key is not exist.
sourcefn scan<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn scan<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Scan a key prefix to get all keys that start with this key.
sourcefn blocking_scan(&self, path: &str) -> Result<Vec<String>>
fn blocking_scan(&self, path: &str) -> Result<Vec<String>>
Scan a key prefix to get all keys that start with this key in blocking way.