pub trait Storage: Send + Sync {
// Required methods
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = KVResult<Option<Entry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: Key,
entry: Entry,
) -> Pin<Box<dyn Future<Output = KVResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = KVResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = KVResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn keys<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
) -> Pin<Box<dyn Future<Output = KVResult<Vec<Key>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn keys_pattern<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
pattern: &'life1 str,
) -> Pin<Box<dyn Future<Output = KVResult<Vec<Key>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn clear_database<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
) -> Pin<Box<dyn Future<Output = KVResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_stats<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
) -> Pin<Box<dyn Future<Output = KVResult<StorageStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = KVResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = KVResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for storage backends
Required Methods§
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = KVResult<Option<Entry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = KVResult<Option<Entry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get an entry by key
Sourcefn set<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: Key,
entry: Entry,
) -> Pin<Box<dyn Future<Output = KVResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: Key,
entry: Entry,
) -> Pin<Box<dyn Future<Output = KVResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set an entry
Sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = KVResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = KVResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete an entry
Sourcefn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = KVResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = KVResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a key exists
Sourcefn keys<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
) -> Pin<Box<dyn Future<Output = KVResult<Vec<Key>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn keys<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
) -> Pin<Box<dyn Future<Output = KVResult<Vec<Key>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all keys in a database
Sourcefn keys_pattern<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
pattern: &'life1 str,
) -> Pin<Box<dyn Future<Output = KVResult<Vec<Key>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn keys_pattern<'life0, 'life1, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
pattern: &'life1 str,
) -> Pin<Box<dyn Future<Output = KVResult<Vec<Key>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get keys matching a pattern
Sourcefn clear_database<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
) -> Pin<Box<dyn Future<Output = KVResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_database<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
) -> Pin<Box<dyn Future<Output = KVResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear all data in a database
Sourcefn get_stats<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
) -> Pin<Box<dyn Future<Output = KVResult<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_stats<'life0, 'async_trait>(
&'life0 self,
database_id: DatabaseId,
) -> Pin<Box<dyn Future<Output = KVResult<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get database statistics