Skip to main content

Txn

Struct Txn 

Source
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<'_>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn put(&mut self, k: Vec<u8>, v: Vec<u8>)

Stage an insert/overwrite of k; drains as Op::Put.

Source

pub fn del(&mut self, k: Vec<u8>)

Stage a deletion of k; drains as Op::Del.

Source

pub fn purge(&mut self, k: Vec<u8>)

Stage a history-erasing erase of k (tenant purge). Unlike Txn::del the drained op is Op::Purge, so no superseded version is retained for a key whose value is intentionally destroyed.

Source

pub fn set(&mut self, k: Vec<u8>, v: Vec<u8>)

Stage a history-free overwrite of k (internal bookkeeping keys). Unlike Txn::put the drained op is Op::Set, so overwriting a hot counter does not append to its retained history.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Txn<'a>

§

impl<'a> !Send for Txn<'a>

§

impl<'a> !Sync for Txn<'a>

§

impl<'a> !UnwindSafe for Txn<'a>

§

impl<'a> Freeze for Txn<'a>

§

impl<'a> Unpin for Txn<'a>

§

impl<'a> UnsafeUnpin for Txn<'a>

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.