pub struct TempDatabase<DB> { /* private fields */ }Available on crate features
test-utils only.Expand description
A database will delete the db dir when dropped.
Implementations§
Source§impl<DB> TempDatabase<DB>
impl<DB> TempDatabase<DB>
Sourcepub fn new(db: DB, path: PathBuf) -> Self
pub fn new(db: DB, path: PathBuf) -> Self
Create new TempDatabase instance.
Sourcepub fn into_inner_db(self) -> DB
pub fn into_inner_db(self) -> DB
Convert temp database into inner.
Sourcepub fn set_pre_transaction_hook(&self, hook: Box<dyn Fn() + Send + Sync>)
pub fn set_pre_transaction_hook(&self, hook: Box<dyn Fn() + Send + Sync>)
Sets TempDatabase new pre transaction creation hook.
Sourcepub fn set_post_transaction_hook(&self, hook: Box<dyn Fn() + Send + Sync>)
pub fn set_post_transaction_hook(&self, hook: Box<dyn Fn() + Send + Sync>)
Sets TempDatabase new post transaction creation hook.
Trait Implementations§
Source§impl<DB: Database> Database for TempDatabase<DB>
impl<DB: Database> Database for TempDatabase<DB>
Source§fn tx_mut(&self) -> Result<Self::TXMut, DatabaseError>
fn tx_mut(&self) -> Result<Self::TXMut, DatabaseError>
Create read write transaction only possible if database is open with write access.
Source§fn oldest_reader_txnid(&self) -> Option<u64>
fn oldest_reader_txnid(&self) -> Option<u64>
Returns the transaction ID of the oldest active reader, if available. Read more
Source§fn last_txnid(&self) -> Option<u64>
fn last_txnid(&self) -> Option<u64>
Returns the ID of the most recently committed transaction, if available.
§fn view<T, F>(&self, f: F) -> Result<T, DatabaseError>
fn view<T, F>(&self, f: F) -> Result<T, DatabaseError>
Takes a function and passes a read-only transaction into it, making sure it’s closed in the
end of the execution.
Source§impl<DB: DatabaseMetrics> DatabaseMetrics for TempDatabase<DB>
impl<DB: DatabaseMetrics> DatabaseMetrics for TempDatabase<DB>
Source§impl<DB: Debug> Debug for TempDatabase<DB>
impl<DB: Debug> Debug for TempDatabase<DB>
Source§impl<DB> Drop for TempDatabase<DB>
impl<DB> Drop for TempDatabase<DB>
Auto Trait Implementations§
impl<DB> !Freeze for TempDatabase<DB>
impl<DB> !RefUnwindSafe for TempDatabase<DB>
impl<DB> !UnwindSafe for TempDatabase<DB>
impl<DB> Send for TempDatabase<DB>
impl<DB> Sync for TempDatabase<DB>
impl<DB> Unpin for TempDatabase<DB>
impl<DB> UnsafeUnpin for TempDatabase<DB>where
Option<DB>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeDebug for Twhere
T: Debug,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<DB> ReaderTxnTracker for DBwhere
DB: Database,
impl<DB> ReaderTxnTracker for DBwhere
DB: Database,
§fn wait_for_pre_commit_readers(&self)
fn wait_for_pre_commit_readers(&self)
Waits until all readers older than the latest committed txnid have drained.
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.