Trait KeyValueDbTrait

Source
pub trait KeyValueDbTrait:
    KeyValueDbTraitMultiReader
    + Send
    + Sync
    + MallocSizeOf {
    // Required methods
    fn delete(&self, key: &[u8]) -> Result<Option<Option<Self::ValueType>>>;
    fn put(
        &self,
        key: &[u8],
        value: &<Self::ValueType as DbValueType>::Type,
    ) -> Result<Option<Option<Self::ValueType>>>;

    // Provided methods
    fn delete_with_number_key(
        &self,
        key: i64,
    ) -> Result<Option<Option<Self::ValueType>>> { ... }
    fn put_with_number_key(
        &self,
        key: i64,
        value: &<Self::ValueType as DbValueType>::Type,
    ) -> Result<Option<Option<Self::ValueType>>> { ... }
}

Required Methods§

Source

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

Return Some(maybe_old_value) or None if the db don’t support reading the old value at deletion.

Source

fn put( &self, key: &[u8], value: &<Self::ValueType as DbValueType>::Type, ) -> Result<Option<Option<Self::ValueType>>>

Provided Methods§

Source

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

Source

fn put_with_number_key( &self, key: i64, value: &<Self::ValueType as DbValueType>::Type, ) -> Result<Option<Option<Self::ValueType>>>

Implementors§