Trait akd::storage::Storage[][src]

pub trait Storage: Clone {
Show 17 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 mut self
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn commit_transaction<'life0, 'async_trait>(
        &'life0 mut 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 mut 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, 'async_trait, St: Storable>(
        &'life0 self,
        id: St::Key
    ) -> Pin<Box<dyn Future<Output = Result<DbRecord, StorageError>> + Send + 'async_trait>>
    where
        St: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn get_epoch_lte_epoch<'life0, 'async_trait>(
        &'life0 self,
        node_label: NodeLabel,
        epoch_in_question: u64
    ) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn batch_get<'life0, 'async_trait, St: Storable>(
        &'life0 self,
        ids: Vec<St::Key>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DbRecord>, StorageError>> + Send + 'async_trait>>
    where
        St: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn get_user_data<'life0, 'life1, 'async_trait>(
        &'life0 self,
        username: &'life1 AkdKey
    ) -> 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 AkdKey,
        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,
        keys: &'life1 [AkdKey],
        flag: ValueStateRetrievalFlag
    ) -> Pin<Box<dyn Future<Output = Result<HashMap<AkdKey, u64>, StorageError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; fn build_azks(latest_epoch: u64, num_nodes: u64) -> Azks { ... }
fn build_history_tree_node(
        label_val: u64,
        label_len: u32,
        birth_epoch: u64,
        last_epoch: u64,
        parent_label_val: u64,
        parent_label_len: u32,
        node_type: u8
    ) -> HistoryTreeNode { ... }
fn build_history_node_state(
        value: Vec<u8>,
        child_states: [Option<HistoryChildState>; 2],
        label_len: u32,
        label_val: u64,
        epoch: u64
    ) -> HistoryNodeState { ... }
fn build_user_state(
        username: String,
        plaintext_val: String,
        version: u64,
        label_len: u32,
        label_val: u64,
        epoch: u64
    ) -> ValueState { ... }
}
Expand description

Updated storage layer with better support of asynchronous work and batched operations

Required methods

Log some information about the cache (hit rate, etc)

Start a transaction in the storage layer

Commit a transaction in the storage layer

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

Retrieve the last epoch <= epoch_in_question where the node with node_key was edited

Retrieve a batch of records by id

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

Provided methods

Build an azks instance from the properties

Build a history tree node from the properties

Build a history node state from the properties

Build a user state from the properties

Implementors