Trait sc_service::config::Database[][src]

pub trait Database<H>: Send + Sync where
    H: Clone + AsRef<[u8]>, 
{ pub fn commit(
        &self,
        transaction: Transaction<H>
    ) -> Result<(), DatabaseError>;
pub fn get(&self, col: u32, key: &[u8]) -> Option<Vec<u8, Global>>; pub fn contains(&self, col: u32, key: &[u8]) -> bool { ... }
pub fn value_size(&self, col: u32, key: &[u8]) -> Option<usize> { ... }
pub fn with_get(&self, col: u32, key: &[u8], f: &mut dyn FnMut(&[u8])) { ... } }

Required methods

pub fn commit(&self, transaction: Transaction<H>) -> Result<(), DatabaseError>[src]

Commit the transaction to the database atomically. Any further calls to get or lookup will reflect the new state.

pub fn get(&self, col: u32, key: &[u8]) -> Option<Vec<u8, Global>>[src]

Retrieve the value previously stored against key or None if key is not currently in the database.

Loading content...

Provided methods

pub fn contains(&self, col: u32, key: &[u8]) -> bool[src]

Check if the value exists in the database without retrieving it.

pub fn value_size(&self, col: u32, key: &[u8]) -> Option<usize>[src]

Check value size in the database possibly without retrieving it.

pub fn with_get(&self, col: u32, key: &[u8], f: &mut dyn FnMut(&[u8]))[src]

Call f with the value previously stored against key.

This may be faster than get since it doesn’t allocate. Use with_get helper function if you need f to return a value from f

Loading content...

Trait Implementations

impl<H> Debug for dyn Database<H> + 'static[src]

Implementations on Foreign Types

impl<H> Database<H> for MemDb where
    H: Clone + AsRef<[u8]>, 
[src]

Loading content...

Implementors

Loading content...