Type Alias TokioSerializableDb

Source
pub type TokioSerializableDb<K, V> = SerializableDb<K, V, TokioSpawner>;
Available on crate feature tokio only.
Expand description

Database for tokio runtime.

Aliased Type§

pub struct TokioSerializableDb<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 duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more