Struct DatabaseMock
pub struct DatabaseMock {
pub data: BTreeMap<Vec<u8>, Vec<u8>>,
}Expand description
Mock database implementation for testing and development.
Provides a lightweight implementation of the Database trait suitable
for testing scenarios where actual database operations are not required.
Fields§
§data: BTreeMap<Vec<u8>, Vec<u8>>Internal data storage using a BTreeMap.
TODO: Make the mock database table-aware by properly utilizing this data structure to simulate realistic database behavior during testing.
Trait Implementations§
§impl Clone for DatabaseMock
impl Clone for DatabaseMock
§fn clone(&self) -> DatabaseMock
fn clone(&self) -> DatabaseMock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Database for DatabaseMock
impl Database for DatabaseMock
§fn tx(&self) -> Result<<DatabaseMock as Database>::TX, DatabaseError>
fn tx(&self) -> Result<<DatabaseMock as Database>::TX, DatabaseError>
Creates a new read-only transaction.
This always succeeds and returns a default TxMock instance.
The mock transaction doesn’t actually perform any database operations.
§fn tx_mut(&self) -> Result<<DatabaseMock as Database>::TXMut, DatabaseError>
fn tx_mut(&self) -> Result<<DatabaseMock as Database>::TXMut, DatabaseError>
Creates a new read-write transaction.
This always succeeds and returns a default TxMock instance.
The mock transaction doesn’t actually perform any database operations.
§fn oldest_reader_txnid(&self) -> Option<u64>
fn oldest_reader_txnid(&self) -> Option<u64>
§fn last_txnid(&self) -> Option<u64>
fn last_txnid(&self) -> Option<u64>
§fn view<T, F>(&self, f: F) -> Result<T, DatabaseError>
fn view<T, F>(&self, f: F) -> Result<T, DatabaseError>
§impl DatabaseMetrics for DatabaseMock
impl DatabaseMetrics for DatabaseMock
§impl Debug for DatabaseMock
impl Debug for DatabaseMock
§impl Default for DatabaseMock
impl Default for DatabaseMock
§fn default() -> DatabaseMock
fn default() -> DatabaseMock
Auto Trait Implementations§
impl Freeze for DatabaseMock
impl RefUnwindSafe for DatabaseMock
impl Send for DatabaseMock
impl Sync for DatabaseMock
impl Unpin for DatabaseMock
impl UnsafeUnpin for DatabaseMock
impl UnwindSafe for DatabaseMock
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> ⓘ
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> ⓘ
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)
§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: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes