Skip to main content

ReadableValueSet

Trait ReadableValueSet 

Source
pub trait ReadableValueSet: ValueSet {
    // Required methods
    fn list_values<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<IndexMap<Self::Id, Record<Self::Value>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_value<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 Self::Id,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Record<Self::Value>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_some_value<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<(Self::Id, Record<Self::Value>)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn stream_values(
        &self,
    ) -> Pin<Box<dyn Stream<Item = Result<(Self::Id, Record<Self::Value>)>> + Send + '_>>
       where Self: Sync { ... }
}
Expand description

Read-only access to raw storage values without entity deserialization.

See documentation for ValueSet for implementation example.

Required Methods§

Source

fn list_values<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<IndexMap<Self::Id, Record<Self::Value>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve all records as raw storage values preserving insertion order where supported.

§Performance

In Vantage you can’t retrieve values of a Set partially. Instead you should create a sub-set of your existing set, then list values of that set instead.

Source

fn get_value<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 Self::Id, ) -> Pin<Box<dyn Future<Output = Result<Option<Record<Self::Value>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve a specific record by ID as a structured record.

Returns Ok(None) when no record exists with the given ID. Returns an error only if the lookup itself fails.

Source

fn get_some_value<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<(Self::Id, Record<Self::Value>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve one single record from the set. If records are ordered - return first record. will return Ok(None).

Useful when you operate with a very specific subset of data.

Provided Methods§

Source

fn stream_values( &self, ) -> Pin<Box<dyn Stream<Item = Result<(Self::Id, Record<Self::Value>)>> + Send + '_>>
where Self: Sync,

Stream all records as (Id, Record) pairs.

Default wraps list_values(). Backends with native streaming (e.g. paginated REST APIs) can override for incremental fetching.

Implementors§