Skip to main content

StateSource

Trait StateSource 

Source
pub trait StateSource {
    // Required methods
    fn row(&self, key: &[u8]) -> Result<Option<Vec<u8>>, ExecError>;
    fn node(&self, key: &[u8]) -> Result<Option<Vec<u8>>, ExecError>;
    fn for_each_row(
        &self,
        prefix: &[u8],
        visit: &mut dyn FnMut(&[u8], &[u8]),
    ) -> Result<(), ExecError>;
}
Expand description

今の状態の行と木のノードを読む口

Required Methods§

Source

fn row(&self, key: &[u8]) -> Result<Option<Vec<u8>>, ExecError>

状態の行 key(super::persist::row_key)。なければ None

Source

fn node(&self, key: &[u8]) -> Result<Option<Vec<u8>>, ExecError>

木のノード key(crate::tree::node_key)。なければ None

Source

fn for_each_row( &self, prefix: &[u8], visit: &mut dyn FnMut(&[u8], &[u8]), ) -> Result<(), ExecError>

キーが prefix で始まる状態の行を、キーの順に visit に渡す。全部を一度にメモリに置かない

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<S: StateSource + ?Sized> StateSource for Arc<S>

分け合っている読み口。ほかのスレッドと同じ DB を読むとき

Source§

fn row(&self, key: &[u8]) -> Result<Option<Vec<u8>>, ExecError>

Source§

fn node(&self, key: &[u8]) -> Result<Option<Vec<u8>>, ExecError>

Source§

fn for_each_row( &self, prefix: &[u8], visit: &mut dyn FnMut(&[u8], &[u8]), ) -> Result<(), ExecError>

Implementors§