pub trait Storage: Clone {
Show 15 methods
fn log_metrics<'life0, 'async_trait>(
&'life0 self,
level: Level
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn begin_transaction<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn commit_transaction<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn rollback_transaction<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn is_transaction_active<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn set<'life0, 'async_trait>(
&'life0 self,
record: DbRecord
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn batch_set<'life0, 'async_trait>(
&'life0 self,
records: Vec<DbRecord>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn get<'life0, 'life1, 'async_trait, St>(
&'life0 self,
id: &'life1 St::StorageKey
) -> Pin<Box<dyn Future<Output = Result<DbRecord, StorageError>> + Send + 'async_trait>>
where
St: 'async_trait + Storable,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_direct<'life0, 'life1, 'async_trait, St>(
&'life0 self,
id: &'life1 St::StorageKey
) -> Pin<Box<dyn Future<Output = Result<DbRecord, StorageError>> + Send + 'async_trait>>
where
St: 'async_trait + Storable,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn flush_cache<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn tombstone_value_states<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [ValueStateKey]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn batch_get<'life0, 'life1, 'async_trait, St>(
&'life0 self,
ids: &'life1 [St::StorageKey]
) -> Pin<Box<dyn Future<Output = Result<Vec<DbRecord>, StorageError>> + Send + 'async_trait>>
where
St: 'async_trait + Storable,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_user_data<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 AkdLabel
) -> Pin<Box<dyn Future<Output = Result<KeyData, StorageError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_user_state<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 AkdLabel,
flag: ValueStateRetrievalFlag
) -> Pin<Box<dyn Future<Output = Result<ValueState, StorageError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_user_state_versions<'life0, 'life1, 'async_trait>(
&'life0 self,
usernames: &'life1 [AkdLabel],
flag: ValueStateRetrievalFlag
) -> Pin<Box<dyn Future<Output = Result<HashMap<AkdLabel, (u64, AkdValue)>, StorageError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}
Expand description
Storage layer with support for asynchronous work and batched operations
Required Methods
Log some information about the cache (hit rate, etc)
Start a transaction in the storage layer
sourcefn commit_transaction<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn commit_transaction<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Commit a transaction in the storage layer
sourcefn rollback_transaction<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn rollback_transaction<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Rollback a transaction
Retrieve a flag determining if there is a transaction active
Set a record in the data layer
Set multiple records in transactional operation
Retrieve a stored record from the data layer
sourcefn get_direct<'life0, 'life1, 'async_trait, St>(
&'life0 self,
id: &'life1 St::StorageKey
) -> Pin<Box<dyn Future<Output = Result<DbRecord, StorageError>> + Send + 'async_trait>> where
St: 'async_trait + Storable,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_direct<'life0, 'life1, 'async_trait, St>(
&'life0 self,
id: &'life1 St::StorageKey
) -> Pin<Box<dyn Future<Output = Result<DbRecord, StorageError>> + Send + 'async_trait>> where
St: 'async_trait + Storable,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve a record from the data layer, ignoring any caching or transaction pending
Flush the caching of objects (if present)
sourcefn tombstone_value_states<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [ValueStateKey]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn tombstone_value_states<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [ValueStateKey]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Convert the given value state’s into tombstones, replacing the plaintext value with the tombstone key array
Retrieve a batch of records by id
sourcefn get_user_data<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 AkdLabel
) -> Pin<Box<dyn Future<Output = Result<KeyData, StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_user_data<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 AkdLabel
) -> Pin<Box<dyn Future<Output = Result<KeyData, StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve the user data for a given user
sourcefn get_user_state<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 AkdLabel,
flag: ValueStateRetrievalFlag
) -> Pin<Box<dyn Future<Output = Result<ValueState, StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_user_state<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 AkdLabel,
flag: ValueStateRetrievalFlag
) -> Pin<Box<dyn Future<Output = Result<ValueState, StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve a specific state for a given user
sourcefn get_user_state_versions<'life0, 'life1, 'async_trait>(
&'life0 self,
usernames: &'life1 [AkdLabel],
flag: ValueStateRetrievalFlag
) -> Pin<Box<dyn Future<Output = Result<HashMap<AkdLabel, (u64, AkdValue)>, StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_user_state_versions<'life0, 'life1, 'async_trait>(
&'life0 self,
usernames: &'life1 [AkdLabel],
flag: ValueStateRetrievalFlag
) -> Pin<Box<dyn Future<Output = Result<HashMap<AkdLabel, (u64, AkdValue)>, StorageError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve the user -> state version mapping in bulk. This is the same as get_user_states but with less data retrieved from the storage layer