pub struct Txn<'a> { /* private fields */ }Expand description
Buffered view handed to admission/apply: reads see committed data merged with staged writes; writes stay buffered until the closure succeeds.
Implementations§
Source§impl Txn<'_>
impl Txn<'_>
Sourcepub fn get(&self, k: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
pub fn get(&self, k: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
Read the value staged in this transaction, falling back to the underlying committed view.
§Errors
Returns StorageError::ResourceExhausted when the key plus value
exceeds the default read item limit.
Sourcepub fn get_tracked(&mut self, k: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
pub fn get_tracked(&mut self, k: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
Read-through helper that also records a point dependency.
§Errors
Returns StorageError::ResourceExhausted when the key plus value
exceeds the default read item limit.
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>
Collect the committed and staged entries in the half-open byte range
[start, end); an empty end means unbounded above.
§Errors
Returns StorageError::ResourceExhausted if the materialized result
would exceed the 64 MiB transaction-range ceiling.
Sourcepub fn range_prefix_tracked(
&mut self,
prefix: &[u8],
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, StorageError>
pub fn range_prefix_tracked( &mut self, prefix: &[u8], ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, StorageError>
Range-scan helper that records the scanned range dependency.
§Errors
Returns StorageError::ResourceExhausted if the materialized result
would exceed the 64 MiB transaction-range ceiling.
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>
Collect the committed and staged entries under prefix.
§Errors
Returns StorageError::ResourceExhausted if the materialized result
would exceed the 64 MiB transaction-range ceiling.
Sourcepub fn keys_prefix(&self, prefix: &[u8]) -> Result<Vec<Vec<u8>>, StorageError>
pub fn keys_prefix(&self, prefix: &[u8]) -> Result<Vec<Vec<u8>>, StorageError>
Key-only ordered scan merged with staged replacements/tombstones. Payloads are not copied or charged as result bytes. The transitional 64 MiB materialization ceiling still applies to copied key bytes.
§Errors
Returns StorageError::ResourceExhausted if the materialized result
would exceed the 64 MiB transaction-range ceiling.
Sourcepub fn keys_prefix_limited(
&self,
prefix: &[u8],
limit: usize,
) -> Result<Vec<Vec<u8>>, StorageError>
pub fn keys_prefix_limited( &self, prefix: &[u8], limit: usize, ) -> Result<Vec<Vec<u8>>, StorageError>
Bounded keys-only enumeration under a prefix, merged with the staged
buffer (staged replacements are included, tombstones skipped): at most
limit live keys in ascending order. Unlike Txn::keys_prefix it
never applies the 64 MiB materialization ceiling — callers use it to
make bounded progress over an arbitrarily large keyspace (chunked
tenant purge) instead of materializing the whole range.
§Errors
Returns StorageError::ResourceExhausted when a single key exceeds
the default read item limit.
§Panics
Panics only if an internal peeked iterator yields None immediately
after peek reported an element, which cannot happen for the merged
in-memory iterators used here.
Sourcepub fn put(&mut self, k: Vec<u8>, v: Vec<u8>)
pub fn put(&mut self, k: Vec<u8>, v: Vec<u8>)
Stage an insert/overwrite of k; drains as Op::Put.