Trait akd::storage::Database

source ·
pub trait Database: Clone + Send + Sync {
    fn set<'life0, 'async_trait>(
        &'life0 self,
        record: DbRecord
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn batch_set<'life0, 'async_trait>(
        &'life0 self,
        records: Vec<DbRecord>,
        state: DbSetState
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: '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,
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: '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,
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: '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
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: '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
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: '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
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; }
Expand description

A database implementation backing storage for the AKD

Required Methods§

Set a record in the database

Set multiple records in the database with a minimal set of operations

Retrieve a stored record from the database

Retrieve a batch of records by id from the database

Retrieve the user data for a given user

Retrieve a specific state for a given user

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

Implementors§