pub struct OverlayView { /* private fields */ }Expand description
A pinned base snapshot plus an uncommitted key overlay.
Clone is cheap for the base (Arc) and copies the overlay map; callers
that only read should share one instance behind an Arc.
Implementations§
Source§impl OverlayView
impl OverlayView
Sourcepub fn with_buffer(
base: Arc<ReadView>,
buffer: BTreeMap<Vec<u8>, Option<Vec<u8>>>,
) -> Self
pub fn with_buffer( base: Arc<ReadView>, buffer: BTreeMap<Vec<u8>, Option<Vec<u8>>>, ) -> Self
Wrap a pinned snapshot with a pre-existing overlay buffer.
Sourcepub fn buffer(&self) -> &BTreeMap<Vec<u8>, Option<Vec<u8>>>
pub fn buffer(&self) -> &BTreeMap<Vec<u8>, Option<Vec<u8>>>
The current overlay buffer (read-buffer-first).
Sourcepub fn commit_index(&self) -> u64
pub fn commit_index(&self) -> u64
Commit index this view reads its committed base at.
Sourcepub fn cancellation(&self) -> ReadCancellation
pub fn cancellation(&self) -> ReadCancellation
Cancellation handle shared with the base snapshot.
Sourcepub fn apply_ops(&mut self, ops: &[Op])
pub fn apply_ops(&mut self, ops: &[Op])
Fold a batch of LMPG ops into the overlay. History is irrelevant to
reads, so Put/Set become live values and Del/Purge tombstones.
Sourcepub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
pub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
Read one key: overlay first, then the pinned base.
§Errors
Returns the underlying storage error from the base read.
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>
Materialize every key/value with key starting with prefix, merging
the overlay over the base (overlay wins; tombstones hide base rows).
§Errors
Returns the underlying storage error from the base scan.
Sourcepub fn range_keys(
&self,
start: &[u8],
end: &[u8],
) -> Result<Vec<Vec<u8>>, StorageError>
pub fn range_keys( &self, start: &[u8], end: &[u8], ) -> Result<Vec<Vec<u8>>, StorageError>
Materialize the keys with start <= key < end, merging the overlay over
the base (overlay wins; tombstones hidden). Values are never read, so a
keys-only scan does not pay for large payloads.
§Errors
Returns the underlying storage error from the base scan.