Skip to main content

Transaction

Enum Transaction 

Source
pub enum Transaction<'a> {
    Command(&'a mut CommandTransaction),
    Admin(&'a mut AdminTransaction),
    Query(&'a mut QueryTransaction),
    Subscription(&'a mut SubscriptionTransaction),
}
Expand description

An enum that can hold either a command, admin, query, or subscription transaction for flexible execution

Variants§

§

Command(&'a mut CommandTransaction)

§

Admin(&'a mut AdminTransaction)

§

Query(&'a mut QueryTransaction)

§

Subscription(&'a mut SubscriptionTransaction)

Implementations§

Source§

impl<'a> Transaction<'a>

Source

pub fn version(&self) -> CommitVersion

Get the transaction version

Source

pub fn id(&self) -> TransactionId

Get the transaction ID

Source

pub fn get(&mut self, key: &EncodedKey) -> Result<Option<MultiVersionValues>>

Get a value by key (async method)

Source

pub fn contains_key(&mut self, key: &EncodedKey) -> Result<bool>

Check if a key exists (async method)

Source

pub fn prefix(&mut self, prefix: &EncodedKey) -> Result<MultiVersionBatch>

Get a prefix batch (async method)

Source

pub fn prefix_rev(&mut self, prefix: &EncodedKey) -> Result<MultiVersionBatch>

Get a reverse prefix batch (async method)

Source

pub fn read_as_of_version_exclusive( &mut self, version: CommitVersion, ) -> Result<()>

Read as of version exclusive (async method)

Source

pub fn range( &mut self, range: EncodedKeyRange, batch_size: usize, ) -> Result<Box<dyn Iterator<Item = Result<MultiVersionValues>> + Send + '_>>

Create a streaming iterator for forward range queries.

Source

pub fn range_rev( &mut self, range: EncodedKeyRange, batch_size: usize, ) -> Result<Box<dyn Iterator<Item = Result<MultiVersionValues>> + Send + '_>>

Create a streaming iterator for reverse range queries.

Source§

impl<'a> Transaction<'a>

Source

pub fn reborrow(&mut self) -> Transaction<'_>

Re-borrow this transaction with a shorter lifetime, enabling multiple sequential uses of the same transaction binding.

Source

pub fn command(self) -> &'a mut CommandTransaction

Extract the underlying CommandTransaction, panics if this is not a Command transaction

Source

pub fn admin(self) -> &'a mut AdminTransaction

Extract the underlying AdminTransaction, panics if this is not an Admin transaction

Source

pub fn query(self) -> &'a mut QueryTransaction

Extract the underlying QueryTransaction, panics if this is not a Query transaction

Source

pub fn subscription(self) -> &'a mut SubscriptionTransaction

Extract the underlying SubscriptionTransaction, panics if this is not a Subscription transaction

Source

pub fn command_mut(&mut self) -> &mut CommandTransaction

Get a mutable reference to the underlying CommandTransaction, panics if this is not a Command transaction

Source

pub fn admin_mut(&mut self) -> &mut AdminTransaction

Get a mutable reference to the underlying AdminTransaction, panics if this is not an Admin transaction

Source

pub fn query_mut(&mut self) -> &mut QueryTransaction

Get a mutable reference to the underlying QueryTransaction, panics if this is not a Query transaction

Source

pub fn subscription_mut(&mut self) -> &mut SubscriptionTransaction

Get a mutable reference to the underlying SubscriptionTransaction, panics if this is not a Subscription transaction

Source

pub fn begin_single_query<'b, I>( &self, keys: I, ) -> Result<SingleReadTransaction<'_>>
where I: IntoIterator<Item = &'b EncodedKey>,

Begin a single-version query transaction for specific keys

Source

pub fn begin_single_command<'b, I>( &self, keys: I, ) -> Result<SingleWriteTransaction<'_>>
where I: IntoIterator<Item = &'b EncodedKey>,

Begin a single-version write transaction for specific keys. Panics on Query transactions.

Source

pub fn set(&mut self, key: &EncodedKey, row: EncodedValues) -> Result<()>

Set a key-value pair. Panics on Query transactions.

Source

pub fn unset(&mut self, key: &EncodedKey, values: EncodedValues) -> Result<()>

Unset (delete with tombstone) a key-value pair. Panics on Query transactions.

Source

pub fn remove(&mut self, key: &EncodedKey) -> Result<()>

Remove a key. Panics on Query transactions.

Source

pub fn track_row_change(&mut self, change: RowChange)

Track a row change for post-commit event emission. Panics on Query transactions.

Source

pub fn track_flow_change(&mut self, change: Change)

Track a flow change for transactional view pre-commit processing. Panics on Query transactions.

Trait Implementations§

Source§

impl<'a> From<&'a mut AdminTransaction> for Transaction<'a>

Source§

fn from(txn: &'a mut AdminTransaction) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a mut CommandTransaction> for Transaction<'a>

Source§

fn from(txn: &'a mut CommandTransaction) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a mut QueryTransaction> for Transaction<'a>

Source§

fn from(txn: &'a mut QueryTransaction) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a mut SubscriptionTransaction> for Transaction<'a>

Source§

fn from(txn: &'a mut SubscriptionTransaction) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for Transaction<'a>

§

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

§

impl<'a> Send for Transaction<'a>

§

impl<'a> Sync for Transaction<'a>

§

impl<'a> Unpin for Transaction<'a>

§

impl<'a> UnsafeUnpin for Transaction<'a>

§

impl<'a> !UnwindSafe for Transaction<'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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more