Type Alias async_skipdb::serializable::AsyncStdSerializableDb

source ·
pub type AsyncStdSerializableDb<K, V> = SerializableDb<K, V, AsyncStdSpawner>;
Available on crate feature async-std only.
Expand description

Database for async-std runtime.

Aliased Type§

struct AsyncStdSerializableDb<K, V> { /* private fields */ }

Implementations

source§

impl<K, V, S> SerializableDb<K, V, S>
where K: CheapClone + Ord, S: AsyncSpawner,

source

pub async fn optimistic_write(&self) -> OptimisticTransaction<K, V, S>

Create a optimistic write transaction.

Optimistic write transaction is not a totally Serializable Snapshot Isolation transaction. It can handle most of write skew anomaly, but not all. Basically, all directly dependencies can be handled, but indirect dependencies (logical dependencies) can not be handled. If you need a totally Serializable Snapshot Isolation transaction, you should use SerializableDb::serializable_write instead.

source

pub async fn serializable_write(&self) -> SerializableTransaction<K, V, S>

Create a serializable write transaction.

Serializable write transaction is a totally Serializable Snapshot Isolation transaction. It can handle all kinds of write skew anomaly, including indirect dependencies (logical dependencies). If in your code, you do not care about indirect dependencies (logical dependencies), you can use SerializableDb::optimistic_write instead.

source§

impl<K, V, S> SerializableDb<K, V, S>
where K: CheapClone + Ord + Send + 'static, V: Send + 'static, S: AsyncSpawner,

source

pub fn compact(&self)

Compact the database.

source§

impl<K, V, S: AsyncSpawner> SerializableDb<K, V, S>

source

pub async fn new() -> Self

Creates a new SerializableDb.

source§

impl<K, V, S: AsyncSpawner> SerializableDb<K, V, S>

source

pub async fn version(&self) -> u64

Returns the current read version of the database.

source

pub async fn read( &self ) -> ReadTransaction<K, V, SerializableDb<K, V, S>, BTreeCm<K>, S>

Create a read transaction.

Trait Implementations

source§

impl<K, V, S: AsyncSpawner> Clone for SerializableDb<K, V, S>

source§

fn clone(&self) -> Self

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