Skip to main content

Query

Trait Query 

Source
pub trait Query: Sequence {
    type RangeScan: RangeScan + 'static;

    // Required methods
    fn get(
        &self,
        key: Bytes,
    ) -> impl Future<Output = Result<(Option<Bytes>, HashMap<String, Value>), String>> + Send;
    fn range_scan(
        &self,
        start: Bytes,
        end: Bytes,
        limit: usize,
        forward: bool,
    ) -> impl Future<Output = Result<Self::RangeScan, String>> + Send;
    fn get_many(
        &self,
        keys: Vec<Bytes>,
    ) -> impl Future<Output = Result<(Vec<(Bytes, Option<Bytes>)>, HashMap<String, Value>), String>> + Send;
}
Expand description

Query read capability.

Required Associated Types§

Source

type RangeScan: RangeScan + 'static

Required Methods§

Source

fn get( &self, key: Bytes, ) -> impl Future<Output = Result<(Option<Bytes>, HashMap<String, Value>), String>> + Send

Fetch the value for a single key plus backend-specific query metadata. Returns None when the key does not exist.

Source

fn range_scan( &self, start: Bytes, end: Bytes, limit: usize, forward: bool, ) -> impl Future<Output = Result<Self::RangeScan, String>> + Send

Cursor over keys in [start, end] (inclusive) when end is non-empty; empty end means unbounded above. Matches store.query.v1.RangeRequest / ReduceRequest on the wire. limit caps rows yielded.

Source

fn get_many( &self, keys: Vec<Bytes>, ) -> impl Future<Output = Result<(Vec<(Bytes, Option<Bytes>)>, HashMap<String, Value>), String>> + Send

Batch-get plus backend-specific query metadata. Returns (key, Option<value>) for each input key, preserving order.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§