pub struct AsyncInMemoryDatabase { /* private fields */ }
Expand description

This struct represents a basic in-memory database.

Implementations§

source§

impl AsyncInMemoryDatabase

source

pub fn new() -> Self

Creates a new in memory db

Trait Implementations§

source§

impl Clone for AsyncInMemoryDatabase

source§

fn clone(&self) -> AsyncInMemoryDatabase

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Database for AsyncInMemoryDatabase

source§

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,

Retrieve a stored record from the data layer

source§

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,

Retrieve a batch of records by id

source§

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,

Retrieve the user data for a given user

source§

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,

Retrieve a specific state for a given user

source§

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,

Set a record in the database
source§

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,

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

fn get_user_state_versions<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'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,

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
source§

impl Debug for AsyncInMemoryDatabase

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for AsyncInMemoryDatabase

source§

fn default() -> AsyncInMemoryDatabase

Returns the “default value” for a type. Read more
source§

impl StorageUtil for AsyncInMemoryDatabase

source§

fn batch_get_type_direct<'life0, 'async_trait, St>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Vec<DbRecord>, StorageError>> + Send + 'async_trait>>where St: 'async_trait + Storable, Self: 'async_trait, 'life0: 'async_trait,

Retrieves all stored records of a given type from the data layer, ignoring any caching or transaction pending
source§

fn batch_get_all_direct<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Vec<DbRecord>, StorageError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Retrieves all stored records from the data layer, ignoring any caching or transaction pending
source§

impl Send for AsyncInMemoryDatabase

source§

impl Sync for AsyncInMemoryDatabase

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V