pub struct Database<Storage: KeyValueStorage> { /* private fields */ }Expand description
A database abstraction for storing and retrieving domain data
This is a thin wrapper around a [KeyValueStorage] implementation that provides a more convenient interface for working with column families and ensures thread-safe access through Arc.
The database can be backed by different storage engines:
- In-memory storage (with the
in_memoryfeature) - RocksDB persistent storage (with the
rocksdbfeature)
Implementations§
Trait Implementations§
Source§impl<Storage: KeyValueStorageWithColumnFamilies> Clone for Database<Storage>
impl<Storage: KeyValueStorageWithColumnFamilies> Clone for Database<Storage>
Source§impl<Storage: KeyValueStorageWithColumnFamilies> GenericDatabase for Database<Storage>
impl<Storage: KeyValueStorageWithColumnFamilies> GenericDatabase for Database<Storage>
impl<S> DbCommandsPort for Database<S>where
S: KeyValueStorageWithColumnFamilies<ColumnFamilyIdentifier = ColumnFamilies, Error = StorageError> + Send + Sync + 'static,
impl<S> DbQueriesPort for Database<S>where
S: KeyValueStorageWithColumnFamilies<ColumnFamilyIdentifier = ColumnFamilies, Error = StorageError> + Send + Sync + 'static,
Auto Trait Implementations§
impl<Storage> Freeze for Database<Storage>
impl<Storage> RefUnwindSafe for Database<Storage>where
Storage: RefUnwindSafe,
impl<Storage> Send for Database<Storage>
impl<Storage> Sync for Database<Storage>
impl<Storage> Unpin for Database<Storage>
impl<Storage> UnwindSafe for Database<Storage>where
Storage: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Db> DynamicStorageManagement for Dbwhere
Db: GenericDatabase,
<Db as GenericDatabase>::Storage: DynamicStorageManagement,
impl<Db> DynamicStorageManagement for Dbwhere
Db: GenericDatabase,
<Db as GenericDatabase>::Storage: DynamicStorageManagement,
§fn add_column_family(&self, column_family: &str) -> Result<(), StorageError>
fn add_column_family(&self, column_family: &str) -> Result<(), StorageError>
Add new column family to the database.
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<Families, ColumnFamily, Db> RawBatchCommandConstructor<ColumnFamily, Families> for Dbwhere
Db: GenericDatabase + 'static,
ColumnFamily: StorageColumnFamily + ColumnFamilyResolver<Families>,
Families: ColumnFamilies,
impl<Families, ColumnFamily, Db> RawBatchCommandConstructor<ColumnFamily, Families> for Dbwhere
Db: GenericDatabase + 'static,
ColumnFamily: StorageColumnFamily + ColumnFamilyResolver<Families>,
Families: ColumnFamilies,
§fn delete_raw_command(
key: EncodedValue<'_>,
) -> Result<BatchCommand<'_, Families>, StorageError>
fn delete_raw_command( key: EncodedValue<'_>, ) -> Result<BatchCommand<'_, Families>, StorageError>
Create a
delete command for a key.§fn put_raw_command<'a>(
key: EncodedValue<'a>,
value: EncodedValue<'a>,
) -> Result<BatchCommand<'a, Families>, StorageError>
fn put_raw_command<'a>( key: EncodedValue<'a>, value: EncodedValue<'a>, ) -> Result<BatchCommand<'a, Families>, StorageError>
Create a
put command for a key and value.§impl<Db> RawDynamicBatchCommandConstructor for Dbwhere
Db: GenericDatabase,
<Db as GenericDatabase>::Storage: KeyValueStorage,
impl<Db> RawDynamicBatchCommandConstructor for Dbwhere
Db: GenericDatabase,
<Db as GenericDatabase>::Storage: KeyValueStorage,
§fn delete_raw_command<'a>(
key: EncodedValue<'a>,
column_family: &'a str,
) -> Result<BatchCommand<'a, &'a str>, StorageError>
fn delete_raw_command<'a>( key: EncodedValue<'a>, column_family: &'a str, ) -> Result<BatchCommand<'a, &'a str>, StorageError>
Create a
delete command for a given key.§fn put_raw_command<'a>(
key: EncodedValue<'a>,
value: EncodedValue<'a>,
column_family: &'a str,
) -> Result<BatchCommand<'a, &'a str>, StorageError>
fn put_raw_command<'a>( key: EncodedValue<'a>, value: EncodedValue<'a>, column_family: &'a str, ) -> Result<BatchCommand<'a, &'a str>, StorageError>
Create a
put command for a key and value.§impl<Db> StorageSnapshot for Dbwhere
Db: GenericDatabase + 'static,
<Db as GenericDatabase>::Storage: StorageSnapshot,
impl<Db> StorageSnapshot for Dbwhere
Db: GenericDatabase + 'static,
<Db as GenericDatabase>::Storage: StorageSnapshot,
§type Snapshot<'a> = <<Db as GenericDatabase>::Storage as StorageSnapshot>::Snapshot<'a>
type Snapshot<'a> = <<Db as GenericDatabase>::Storage as StorageSnapshot>::Snapshot<'a>
The type of snapshots created by this [StorageSnapshot]
§type Error = StorageError
type Error = StorageError
Error that can occur during snapshotting