pub struct TransactionDB<D, S: AsyncSpawner, H = RandomState> { /* private fields */ }
Expand description

A multi-writer multi-reader MVCC, ACID, Serializable Snapshot Isolation transaction manager.

Implementations§

source§

impl<D, S, H> TransactionDB<D, S, H>
where D: AsyncDatabase, D::Key: Eq + Hash + Send + Sync + 'static, D::Value: Send + Sync + 'static, S: AsyncSpawner, H: BuildHasher + Default + Clone + Send + Sync + 'static,

source

pub async fn write( &self ) -> WriteTransaction<D, AsyncIndexMapManager<D::Key, D::Value, H>, S, H>

Create a new writable transaction with the default pending writes manager to store the pending writes.

source§

impl<D: AsyncDatabase, S: AsyncSpawner, H: Clone + 'static> TransactionDB<D, S, H>

source

pub async fn write_by<W: AsyncPendingManager>( &self, backend: W ) -> WriteTransaction<D, W, S, H>

Create a new writable transaction with the given pending writes manager to store the pending writes.

source§

impl<D: AsyncDatabase, S: AsyncSpawner, H: Default> TransactionDB<D, S, H>

source

pub async fn new( transaction_opts: Options, database_opts: D::Options ) -> Result<Self, D::Error>

Open the database with the given options.

source§

impl<D: AsyncDatabase, S: AsyncSpawner, H> TransactionDB<D, S, H>

source

pub async fn with_hasher( transaction_opts: Options, database_opts: D::Options, hasher: H ) -> Result<Self, D::Error>

Open the database with the given options.

source

pub fn discard_hint(&self) -> u64

Returns a timestamp which hints that any versions under this timestamp can be discard. This is useful when users want to implement compaction/merge functionality.

source

pub fn database_options(&self) -> &D::Options

Returns the options of the database.

source

pub fn transaction_options(&self) -> &Options

Returns the options of the transaction.

source

pub fn database(&self) -> &D

Returns underlying database.

Note: You should not use this method get the underlying database and read/write directly. This method is only for you to implement advanced functionalities, such as compaction, merge, etc.

source

pub async fn read(&self) -> ReadTransaction<D, S, H>

Create a new writable transaction.

Trait Implementations§

source§

impl<D, S: AsyncSpawner, H> Clone for TransactionDB<D, S, H>

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

Auto Trait Implementations§

§

impl<D, S, H> Freeze for TransactionDB<D, S, H>

§

impl<D, S, H = RandomState> !RefUnwindSafe for TransactionDB<D, S, H>

§

impl<D, S, H> Send for TransactionDB<D, S, H>
where D: Sync + Send, H: Sync + Send,

§

impl<D, S, H> Sync for TransactionDB<D, S, H>
where D: Sync + Send, H: Sync + Send,

§

impl<D, S, H> Unpin for TransactionDB<D, S, H>

§

impl<D, S, H = RandomState> !UnwindSafe for TransactionDB<D, S, H>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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> ToOwned for T
where 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 T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.