Skip to main content

Store

Trait Store 

Source
pub trait Store: Send + Sync {
    type Error: StdError + Send + Sync + 'static;

    // Required methods
    fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Self::Error>;
    fn seek(&self, from: &[u8]) -> Result<Option<KeyValue>, Self::Error>;
    fn seek_back(&self, upto: &[u8]) -> Result<Option<KeyValue>, Self::Error>;
    fn commit(&self, ops: &[Op<'_>], durable: bool) -> Result<(), Self::Error>;
}
Expand description

An ordered key/value byte store: the durable substrate under the queue.

Keys sort lexicographically. The queue needs forward and backward seeks and one atomic, optionally durable, batch write; it never asks the store to know anything about queues.

Required Associated Types§

Source

type Error: StdError + Send + Sync + 'static

The backend’s error type.

Required Methods§

Source

fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Self::Error>

Value for an exact key.

Source

fn seek(&self, from: &[u8]) -> Result<Option<KeyValue>, Self::Error>

Smallest entry whose key is >= from.

Source

fn seek_back(&self, upto: &[u8]) -> Result<Option<KeyValue>, Self::Error>

Greatest entry whose key is <= upto.

Source

fn commit(&self, ops: &[Op<'_>], durable: bool) -> Result<(), Self::Error>

Apply ops. When durable, do not return until they survive a crash.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§