Skip to main content

KeyValueRead

Trait KeyValueRead 

Source
pub trait KeyValueRead {
    // Required methods
    fn control(&self) -> &StorageReadControl;
    fn revision(
        &self,
        prefixes: &[&[u8]],
    ) -> StorageBackendResult<KeyValueReadRevision>;
    fn visit_value(
        &self,
        key: &[u8],
        visit: &mut ValueReadVisitor<'_>,
    ) -> StorageBackendResult<()>;
    fn visit_prefix(
        &self,
        prefix: &[u8],
        visit: &mut KeyValueReadVisitor<'_>,
    ) -> StorageBackendResult<()>;

    // Provided methods
    fn retain(
        &self,
        prefixes: &[&[u8]],
    ) -> StorageBackendResult<Arc<dyn KeyValueRead + Send + Sync>> { ... }
    fn visit_value_budgeted(
        &self,
        _key: &[u8],
        control: &StorageReadControl,
        _visit: &mut ValueReadVisitor<'_>,
    ) -> StorageBackendResult<()> { ... }
    fn visit_prefix_after(
        &self,
        _prefix: &[u8],
        _after: Option<&[u8]>,
        _limit: usize,
        control: &StorageReadControl,
        _visit: &mut KeyValueReadVisitor<'_>,
    ) -> StorageBackendResult<()> { ... }
    fn visit_keys_after(
        &self,
        _prefix: &[u8],
        _after: Option<&[u8]>,
        _limit: usize,
        control: &StorageReadControl,
        _visit: &mut KeyReadVisitor<'_>,
    ) -> StorageBackendResult<()> { ... }
    fn contains_prefix_budgeted(
        &self,
        _prefix: &[u8],
        control: &StorageReadControl,
    ) -> StorageBackendResult<bool> { ... }
    fn get(&self, key: &[u8]) -> StorageBackendResult<Option<BudgetedVec<u8>>> { ... }
}
Expand description

A fixed read boundary supplied by the store. Borrowed visitors must not reenter persistence; compound reads make successive calls through this same reader.

Required Methods§

Source

fn control(&self) -> &StorageReadControl

Source

fn revision( &self, prefixes: &[&[u8]], ) -> StorageBackendResult<KeyValueReadRevision>

Source

fn visit_value( &self, key: &[u8], visit: &mut ValueReadVisitor<'_>, ) -> StorageBackendResult<()>

Source

fn visit_prefix( &self, prefix: &[u8], visit: &mut KeyValueReadVisitor<'_>, ) -> StorageBackendResult<()>

Provided Methods§

Source

fn retain( &self, prefixes: &[&[u8]], ) -> StorageBackendResult<Arc<dyn KeyValueRead + Send + Sync>>

Retain this committed/private boundary after the callback returns. Callers may only read the selected prefixes. The default copies selected bytes under this reader’s allowance; versioned providers retain their existing visibility owners without loading values.

Source

fn visit_value_budgeted( &self, _key: &[u8], control: &StorageReadControl, _visit: &mut ValueReadVisitor<'_>, ) -> StorageBackendResult<()>

Visit one value on this same boundary, charging temporary provider buffers to the supplied query allowance.

Source

fn visit_prefix_after( &self, _prefix: &[u8], _after: Option<&[u8]>, _limit: usize, control: &StorageReadControl, _visit: &mut KeyValueReadVisitor<'_>, ) -> StorageBackendResult<()>

Visit at most limit values in key order, strictly after after, without advancing this read boundary.

Source

fn visit_keys_after( &self, _prefix: &[u8], _after: Option<&[u8]>, _limit: usize, control: &StorageReadControl, _visit: &mut KeyReadVisitor<'_>, ) -> StorageBackendResult<()>

Visit at most limit live keys in ascending order, strictly after after, without reading their values or advancing this boundary. Capable wrappers must preserve this key-only contract.

Source

fn contains_prefix_budgeted( &self, _prefix: &[u8], control: &StorageReadControl, ) -> StorageBackendResult<bool>

Probe live keys on this boundary without materializing their values.

Source

fn get(&self, key: &[u8]) -> StorageBackendResult<Option<BudgetedVec<u8>>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§