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
impl ReadView
Sourcepub fn planner_stats_cache(&self) -> &PlannerStats
pub fn planner_stats_cache(&self) -> &PlannerStats
The store’s planner-statistics cache. Estimates only; exact answers never come from it.
Sourcepub fn owner_sets(&self) -> &OwnerSets
pub fn owner_sets(&self) -> &OwnerSets
The store’s owner-set cache, keyed by this view’s commit index.
Sourcepub fn belongs_to(&self, store: &Store) -> bool
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.
Sourcepub fn commit_index(&self) -> u64
pub fn commit_index(&self) -> u64
Commit index this view reads at.
Sourcepub fn deriver(&self) -> Option<&Arc<dyn Deriver>>
pub fn deriver(&self) -> Option<&Arc<dyn Deriver>>
The store’s apply-time deriver, if one is installed.
Sourcepub fn cancellation(&self) -> ReadCancellation
pub fn cancellation(&self) -> ReadCancellation
A cloneable handle to this view’s cancellation flag.
Sourcepub fn with_materialization_limit(
self: &Arc<Self>,
bytes: usize,
) -> Arc<ReadView> ⓘ
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.
Sourcepub fn check_cancelled(&self) -> Result<(), StorageError>
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.
Sourcepub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
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.
Sourcepub fn range_prefix(
&self,
prefix: &[u8],
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, StorageError>
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.
Sourcepub fn range(
&self,
start: &[u8],
end: &[u8],
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, StorageError>
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.
Sourcepub fn scan(
&self,
bounds: ScanBounds,
projection: ScanProjection,
) -> Result<ScanCursor<'_>, StorageError>
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.