pub trait Adapter: Send + Sync + Debug + Unpin + 'static {
// Required methods
fn info(&self) -> Info;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn blocking_get(&self, path: &str) -> Result<Option<Value>>;
fn set<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
value: Value
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn blocking_set(&self, path: &str, value: Value) -> Result<()>;
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;
fn blocking_delete(&self, path: &str) -> Result<()>;
// Provided methods
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>> { ... }
}
Expand description
Adapter is the typed adapter to underlying kv services.
By implement this trait, any kv service can work as an OpenDAL Service.
Notes
typed_kv::Adapter
is the typed version of kv::Adapter
. It’s more
efficient if the uderlying kv service can store data with its type. For
example, we can store Bytes
along with it’s metadata so that we don’t
need to serialize/deserialize it when we get it from the service.
Ideally, we should use typed_kv::Adapter
instead of kv::Adapter
for
in-memory rust libs like moka and dashmap.
Required Methods§
sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + 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<Value>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Get a value from adapter.
sourcefn set<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
value: Value
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, value: Value ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Set a value into adapter.
sourcefn 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,
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,
Delete a value from adapter.
sourcefn blocking_delete(&self, path: &str) -> Result<()>
fn blocking_delete(&self, path: &str) -> Result<()>
Delete a value from adapter.