Skip to main content

ReadView

Struct ReadView 

Source
pub struct ReadView { /* private fields */ }
Expand description

Owns all resources needed to read; it can outlive the Store and be shared with asynchronous providers without self-referential borrowed lifetimes.

Implementations§

Source§

impl ReadView

Source

pub fn planner_stats_cache(&self) -> &PlannerStats

The store’s planner-statistics cache. Estimates only; exact answers never come from it.

Source

pub fn owner_sets(&self) -> &OwnerSets

The store’s owner-set cache, keyed by this view’s commit index.

Source

pub fn belongs_to(&self, store: &Store) -> bool

Process-local Store identity, independent of tenant and commit index. Prevents accidentally pairing a view with another engine’s catalogs.

Source

pub fn commit_index(&self) -> u64

Commit index this view reads at.

Source

pub fn deriver(&self) -> Option<&Arc<dyn Deriver>>

The store’s apply-time deriver, if one is installed.

Source

pub fn cancellation(&self) -> ReadCancellation

A cloneable handle to this view’s cancellation flag.

Source

pub fn with_materialization_limit( self: &Arc<Self>, bytes: usize, ) -> Arc<ReadView> ⓘ

Create a child view over this exact pinned snapshot with narrower per-item and materialized-prefix limits. The child has its own limits, while cancellation remains shared with the parent.

Source

pub fn check_cancelled(&self) -> Result<(), StorageError>

Check cancellation between non-storage operations (for example, serializing output) without performing an otherwise unnecessary read.

§Errors

Returns StorageError::Cancelled if the view has been cancelled.

Source

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

Read a single key at this view’s snapshot.

§Errors

Returns StorageError if the view is cancelled, the item exceeds the read limit, or the backend read fails.

Source

pub fn range_prefix( &self, prefix: &[u8], ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, StorageError>

Transitional materializing helper for consumers migrating to cursors. The local ceiling is not a substitute for shared query admission.

§Errors

Returns StorageError if the view is cancelled, the item exceeds the read limit, or the materialized result exceeds the 64 MiB ceiling.

§Panics

Panics if a key/value projection batch unexpectedly yields a row without a value.

Source

pub fn range( &self, start: &[u8], end: &[u8], ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, StorageError>

Materialize every key/value pair with start <= key < end, in key order. An empty end means unbounded above. Shares the prefix path’s aggregate materialization ceiling.

§Errors

Returns StorageError if the view is cancelled, the item exceeds the read limit, or the materialized result exceeds the 64 MiB ceiling.

Source

pub fn scan( &self, bounds: ScanBounds, projection: ScanProjection, ) -> Result<ScanCursor<'_>, StorageError>

Open a forward scan cursor over bounds with the given projection.

§Errors

Returns StorageError::Cancelled if the view is cancelled, StorageError::InvalidRead if the bounds are inverted, or StorageError::ResourceExhausted if a bound key exceeds the read limit.

Trait Implementations§

Source§

impl DeriveRead for ReadView

Source§

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

Current value of key, or None when absent. Read more
Source§

fn range_prefix( &self, prefix: &[u8], ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, StorageError>

Every live (key, value) whose key starts with prefix, in key order. Read more
Source§

fn range( &self, start: &[u8], end: &[u8], ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, StorageError>

Every live (key, value) with start <= key < end, in key order. An empty end is unbounded above. Read more
Source§

impl Drop for ReadView

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.