pub trait KeyValueDbTraitOwnedRead: KeyValueDbTypes {
    // Required method
    fn get_mut(&mut self, key: &[u8]) -> Result<Option<Self::ValueType>>;

    // Provided method
    fn get_mut_with_number_key(
        &mut self,
        key: i64
    ) -> Result<Option<Self::ValueType>> { ... }
}
Expand description

These special get methods are provided for db like sqlite, where concurrency can only be achieved by opening a separate connection, otherwise lock is required for concurrent read.

Required Methods§

source

fn get_mut(&mut self, key: &[u8]) -> Result<Option<Self::ValueType>>

Provided Methods§

source

fn get_mut_with_number_key( &mut self, key: i64 ) -> Result<Option<Self::ValueType>>

Implementors§

source§

impl<T: OwnedReadImplFamily + OwnedReadImplByFamily<<T as OwnedReadImplFamily>::FamilyRepresentative>> KeyValueDbTraitOwnedRead for T

We implement the family dispatching for types which implements KeyValueDbTraitOwnedRead by different reasons:

a) Any type which implements KvdbSqliteAsReadOnlyAndIterableTrait can issue sql queries to load db; The feature is required by SnapshotDbSqlite where the sqlite connection is shared for MPT table and for KV table.

b) similar requirement may hold for any different database engine;

c) For a db engine which is by default KeyValueDbTraitMultiReader, KeyValueDbTraitOwnedRead is naturally read without explicit locking.