pub enum Transaction<'a> {
Command(&'a mut CommandTransaction),
Admin(&'a mut AdminTransaction),
Query(&'a mut QueryTransaction),
Test(Box<TestTransaction<'a>>),
Replica(&'a mut ReplicaTransaction),
}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)
Test(Box<TestTransaction<'a>>)
Replica(&'a mut ReplicaTransaction)
Implementations§
Source§impl<'a> Transaction<'a>
impl<'a> Transaction<'a>
Sourcepub fn version(&self) -> CommitVersion
pub fn version(&self) -> CommitVersion
Get the transaction version
Sourcepub fn id(&self) -> TransactionId
pub fn id(&self) -> TransactionId
Get the transaction ID
Sourcepub fn get(&mut self, key: &EncodedKey) -> Result<Option<MultiVersionRow>>
pub fn get(&mut self, key: &EncodedKey) -> Result<Option<MultiVersionRow>>
Get a value by key (async method)
Sourcepub fn get_committed(
&mut self,
key: &EncodedKey,
) -> Result<Option<MultiVersionRow>>
pub fn get_committed( &mut self, key: &EncodedKey, ) -> Result<Option<MultiVersionRow>>
Read the committed value at the transaction’s read version, ignoring
pending intra-tx writes. For read-only transaction variants (Query,
Replica) this is equivalent to get since they hold no pending
writes.
Sourcepub fn contains_key(&mut self, key: &EncodedKey) -> Result<bool>
pub fn contains_key(&mut self, key: &EncodedKey) -> Result<bool>
Check if a key exists (async method)
Sourcepub fn prefix(&mut self, prefix: &EncodedKey) -> Result<MultiVersionBatch>
pub fn prefix(&mut self, prefix: &EncodedKey) -> Result<MultiVersionBatch>
Get a prefix batch (async method)
Sourcepub fn prefix_rev(&mut self, prefix: &EncodedKey) -> Result<MultiVersionBatch>
pub fn prefix_rev(&mut self, prefix: &EncodedKey) -> Result<MultiVersionBatch>
Get a reverse prefix batch (async method)
Sourcepub fn read_as_of_version_exclusive(
&mut self,
version: CommitVersion,
) -> Result<()>
pub fn read_as_of_version_exclusive( &mut self, version: CommitVersion, ) -> Result<()>
Read as of version exclusive (async method)
Sourcepub fn range(
&mut self,
range: EncodedKeyRange,
batch_size: usize,
) -> Result<Box<dyn Iterator<Item = Result<MultiVersionRow>> + Send + '_>>
pub fn range( &mut self, range: EncodedKeyRange, batch_size: usize, ) -> Result<Box<dyn Iterator<Item = Result<MultiVersionRow>> + Send + '_>>
Create a streaming iterator for forward range queries.
Sourcepub fn range_rev(
&mut self,
range: EncodedKeyRange,
batch_size: usize,
) -> Result<Box<dyn Iterator<Item = Result<MultiVersionRow>> + Send + '_>>
pub fn range_rev( &mut self, range: EncodedKeyRange, batch_size: usize, ) -> Result<Box<dyn Iterator<Item = Result<MultiVersionRow>> + Send + '_>>
Create a streaming iterator for reverse range queries.
Source§impl<'a> Transaction<'a>
impl<'a> Transaction<'a>
Sourcepub fn identity(&self) -> IdentityId
pub fn identity(&self) -> IdentityId
Get the identity associated with this transaction.
Sourcepub fn set_identity(&mut self, identity: IdentityId)
pub fn set_identity(&mut self, identity: IdentityId)
Set the identity associated with this transaction.
Sourcepub fn rql(&mut self, rql: &str, params: Params) -> ExecutionResult
pub fn rql(&mut self, rql: &str, params: Params) -> ExecutionResult
Execute RQL within this transaction using the attached executor.
Panics if no RqlExecutor has been set on the underlying transaction.
Sourcepub fn reborrow(&mut self) -> Transaction<'_>
pub fn reborrow(&mut self) -> Transaction<'_>
Re-borrow this transaction with a shorter lifetime, enabling multiple sequential uses of the same transaction binding.
Sourcepub fn command(self) -> &'a mut CommandTransaction
pub fn command(self) -> &'a mut CommandTransaction
Extract the underlying CommandTransaction, panics if this is not a Command transaction
Sourcepub fn admin(self) -> &'a mut AdminTransaction
pub fn admin(self) -> &'a mut AdminTransaction
Extract the underlying AdminTransaction, panics if this is not an Admin transaction
Sourcepub fn query(self) -> &'a mut QueryTransaction
pub fn query(self) -> &'a mut QueryTransaction
Extract the underlying QueryTransaction, panics if this is not a Query transaction
Sourcepub fn replica(self) -> &'a mut ReplicaTransaction
pub fn replica(self) -> &'a mut ReplicaTransaction
Extract the underlying ReplicaTransaction, panics if this is not a Replica transaction
Sourcepub fn command_mut(&mut self) -> &mut CommandTransaction
pub fn command_mut(&mut self) -> &mut CommandTransaction
Get a mutable reference to the underlying CommandTransaction, panics if this is not a Command transaction
Sourcepub fn admin_mut(&mut self) -> &mut AdminTransaction
pub fn admin_mut(&mut self) -> &mut AdminTransaction
Get a mutable reference to the underlying AdminTransaction, panics if this is not an Admin transaction
Sourcepub fn query_mut(&mut self) -> &mut QueryTransaction
pub fn query_mut(&mut self) -> &mut QueryTransaction
Get a mutable reference to the underlying QueryTransaction, panics if this is not a Query transaction
Sourcepub fn replica_mut(&mut self) -> &mut ReplicaTransaction
pub fn replica_mut(&mut self) -> &mut ReplicaTransaction
Get a mutable reference to the underlying ReplicaTransaction, panics if this is not a Replica transaction
Sourcepub fn begin_single_query<'b, I>(
&self,
keys: I,
) -> Result<SingleReadTransaction<'_>>where
I: IntoIterator<Item = &'b EncodedKey>,
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
Sourcepub fn begin_single_command<'b, I>(
&self,
keys: I,
) -> Result<SingleWriteTransaction<'_>>where
I: IntoIterator<Item = &'b EncodedKey>,
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 and Replica transactions.
Sourcepub fn set(&mut self, key: &EncodedKey, row: EncodedRow) -> Result<()>
pub fn set(&mut self, key: &EncodedKey, row: EncodedRow) -> Result<()>
Set a key-value pair. Panics on Query transactions.
Sourcepub fn unset(&mut self, key: &EncodedKey, row: EncodedRow) -> Result<()>
pub fn unset(&mut self, key: &EncodedKey, row: EncodedRow) -> Result<()>
Unset (delete with tombstone) a key-value pair. Panics on Query transactions.
Sourcepub fn remove(&mut self, key: &EncodedKey) -> Result<()>
pub fn remove(&mut self, key: &EncodedKey) -> Result<()>
Remove a key. Panics on Query transactions.
pub fn mark_preexisting(&mut self, key: &EncodedKey) -> Result<()>
Sourcepub fn track_row_change(&mut self, change: RowChange)
pub fn track_row_change(&mut self, change: RowChange)
Track a row change for post-commit event emission. No-op on Replica transactions. Panics on Query transactions.
Sourcepub fn track_flow_change(&mut self, change: Change)
pub fn track_flow_change(&mut self, change: Change)
Track a flow change for transactional view pre-commit processing. No-op on Replica transactions. Panics on Query transactions.
Sourcepub fn record_test_event(
&mut self,
namespace: String,
event: String,
variant: String,
depth: u8,
columns: Columns,
)
pub fn record_test_event( &mut self, namespace: String, event: String, variant: String, depth: u8, columns: Columns, )
Record a test event dispatch. No-op for non-Test transactions.
Sourcepub fn record_test_handler(&mut self, invocation: CapturedInvocation)
pub fn record_test_handler(&mut self, invocation: CapturedInvocation)
Record a test handler invocation. No-op for non-Test transactions.
The sequence field of invocation will be overwritten with the next handler sequence number.
Trait Implementations§
Source§impl<'a> From<&'a mut AdminTransaction> for Transaction<'a>
impl<'a> From<&'a mut AdminTransaction> for Transaction<'a>
Source§fn from(txn: &'a mut AdminTransaction) -> Self
fn from(txn: &'a mut AdminTransaction) -> Self
Source§impl<'a> From<&'a mut CommandTransaction> for Transaction<'a>
impl<'a> From<&'a mut CommandTransaction> for Transaction<'a>
Source§fn from(txn: &'a mut CommandTransaction) -> Self
fn from(txn: &'a mut CommandTransaction) -> Self
Source§impl<'a> From<&'a mut QueryTransaction> for Transaction<'a>
impl<'a> From<&'a mut QueryTransaction> for Transaction<'a>
Source§fn from(txn: &'a mut QueryTransaction) -> Self
fn from(txn: &'a mut QueryTransaction) -> Self
Source§impl<'a> From<&'a mut ReplicaTransaction> for Transaction<'a>
impl<'a> From<&'a mut ReplicaTransaction> for Transaction<'a>
Source§fn from(txn: &'a mut ReplicaTransaction) -> Self
fn from(txn: &'a mut ReplicaTransaction) -> Self
Source§impl WithInterceptors for Transaction<'_>
impl WithInterceptors for Transaction<'_>
fn table_row_pre_insert_interceptors( &mut self, ) -> &mut Chain<dyn TableRowPreInsertInterceptor + Send + Sync>
fn table_row_post_insert_interceptors( &mut self, ) -> &mut Chain<dyn TableRowPostInsertInterceptor + Send + Sync>
fn table_row_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn TableRowPreUpdateInterceptor + Send + Sync>
fn table_row_post_update_interceptors( &mut self, ) -> &mut Chain<dyn TableRowPostUpdateInterceptor + Send + Sync>
fn table_row_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn TableRowPreDeleteInterceptor + Send + Sync>
fn table_row_post_delete_interceptors( &mut self, ) -> &mut Chain<dyn TableRowPostDeleteInterceptor + Send + Sync>
fn ringbuffer_row_pre_insert_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferRowPreInsertInterceptor + Send + Sync>
fn ringbuffer_row_post_insert_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferRowPostInsertInterceptor + Send + Sync>
fn ringbuffer_row_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferRowPreUpdateInterceptor + Send + Sync>
fn ringbuffer_row_post_update_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferRowPostUpdateInterceptor + Send + Sync>
fn ringbuffer_row_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferRowPreDeleteInterceptor + Send + Sync>
fn ringbuffer_row_post_delete_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferRowPostDeleteInterceptor + Send + Sync>
fn pre_commit_interceptors( &mut self, ) -> &mut Chain<dyn PreCommitInterceptor + Send + Sync>
fn post_commit_interceptors( &mut self, ) -> &mut Chain<dyn PostCommitInterceptor + Send + Sync>
fn namespace_post_create_interceptors( &mut self, ) -> &mut Chain<dyn NamespacePostCreateInterceptor + Send + Sync>
fn namespace_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn NamespacePreUpdateInterceptor + Send + Sync>
fn namespace_post_update_interceptors( &mut self, ) -> &mut Chain<dyn NamespacePostUpdateInterceptor + Send + Sync>
fn namespace_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn NamespacePreDeleteInterceptor + Send + Sync>
fn table_post_create_interceptors( &mut self, ) -> &mut Chain<dyn TablePostCreateInterceptor + Send + Sync>
fn table_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn TablePreUpdateInterceptor + Send + Sync>
fn table_post_update_interceptors( &mut self, ) -> &mut Chain<dyn TablePostUpdateInterceptor + Send + Sync>
fn table_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn TablePreDeleteInterceptor + Send + Sync>
fn view_row_pre_insert_interceptors( &mut self, ) -> &mut Chain<dyn ViewRowPreInsertInterceptor + Send + Sync>
fn view_row_post_insert_interceptors( &mut self, ) -> &mut Chain<dyn ViewRowPostInsertInterceptor + Send + Sync>
fn view_row_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn ViewRowPreUpdateInterceptor + Send + Sync>
fn view_row_post_update_interceptors( &mut self, ) -> &mut Chain<dyn ViewRowPostUpdateInterceptor + Send + Sync>
fn view_row_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn ViewRowPreDeleteInterceptor + Send + Sync>
fn view_row_post_delete_interceptors( &mut self, ) -> &mut Chain<dyn ViewRowPostDeleteInterceptor + Send + Sync>
fn view_post_create_interceptors( &mut self, ) -> &mut Chain<dyn ViewPostCreateInterceptor + Send + Sync>
fn view_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn ViewPreUpdateInterceptor + Send + Sync>
fn view_post_update_interceptors( &mut self, ) -> &mut Chain<dyn ViewPostUpdateInterceptor + Send + Sync>
fn view_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn ViewPreDeleteInterceptor + Send + Sync>
fn ringbuffer_post_create_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferPostCreateInterceptor + Send + Sync>
fn ringbuffer_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferPreUpdateInterceptor + Send + Sync>
fn ringbuffer_post_update_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferPostUpdateInterceptor + Send + Sync>
fn ringbuffer_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferPreDeleteInterceptor + Send + Sync>
fn dictionary_row_pre_insert_interceptors( &mut self, ) -> &mut Chain<dyn DictionaryRowPreInsertInterceptor + Send + Sync>
fn dictionary_row_post_insert_interceptors( &mut self, ) -> &mut Chain<dyn DictionaryRowPostInsertInterceptor + Send + Sync>
fn dictionary_row_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn DictionaryRowPreUpdateInterceptor + Send + Sync>
fn dictionary_row_post_update_interceptors( &mut self, ) -> &mut Chain<dyn DictionaryRowPostUpdateInterceptor + Send + Sync>
fn dictionary_row_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn DictionaryRowPreDeleteInterceptor + Send + Sync>
fn dictionary_row_post_delete_interceptors( &mut self, ) -> &mut Chain<dyn DictionaryRowPostDeleteInterceptor + Send + Sync>
fn dictionary_post_create_interceptors( &mut self, ) -> &mut Chain<dyn DictionaryPostCreateInterceptor + Send + Sync>
fn dictionary_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn DictionaryPreUpdateInterceptor + Send + Sync>
fn dictionary_post_update_interceptors( &mut self, ) -> &mut Chain<dyn DictionaryPostUpdateInterceptor + Send + Sync>
fn dictionary_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn DictionaryPreDeleteInterceptor + Send + Sync>
fn series_row_pre_insert_interceptors( &mut self, ) -> &mut Chain<dyn SeriesRowPreInsertInterceptor + Send + Sync>
fn series_row_post_insert_interceptors( &mut self, ) -> &mut Chain<dyn SeriesRowPostInsertInterceptor + Send + Sync>
fn series_row_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn SeriesRowPreUpdateInterceptor + Send + Sync>
fn series_row_post_update_interceptors( &mut self, ) -> &mut Chain<dyn SeriesRowPostUpdateInterceptor + Send + Sync>
fn series_row_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn SeriesRowPreDeleteInterceptor + Send + Sync>
fn series_row_post_delete_interceptors( &mut self, ) -> &mut Chain<dyn SeriesRowPostDeleteInterceptor + Send + Sync>
fn series_post_create_interceptors( &mut self, ) -> &mut Chain<dyn SeriesPostCreateInterceptor + Send + Sync>
fn series_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn SeriesPreUpdateInterceptor + Send + Sync>
fn series_post_update_interceptors( &mut self, ) -> &mut Chain<dyn SeriesPostUpdateInterceptor + Send + Sync>
fn series_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn SeriesPreDeleteInterceptor + Send + Sync>
fn identity_post_create_interceptors( &mut self, ) -> &mut Chain<dyn IdentityPostCreateInterceptor + Send + Sync>
fn identity_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn IdentityPreUpdateInterceptor + Send + Sync>
fn identity_post_update_interceptors( &mut self, ) -> &mut Chain<dyn IdentityPostUpdateInterceptor + Send + Sync>
fn identity_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn IdentityPreDeleteInterceptor + Send + Sync>
fn role_post_create_interceptors( &mut self, ) -> &mut Chain<dyn RolePostCreateInterceptor + Send + Sync>
fn role_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn RolePreUpdateInterceptor + Send + Sync>
fn role_post_update_interceptors( &mut self, ) -> &mut Chain<dyn RolePostUpdateInterceptor + Send + Sync>
fn role_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn RolePreDeleteInterceptor + Send + Sync>
fn granted_role_post_create_interceptors( &mut self, ) -> &mut Chain<dyn GrantedRolePostCreateInterceptor + Send + Sync>
fn granted_role_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn GrantedRolePreDeleteInterceptor + Send + Sync>
fn authentication_post_create_interceptors( &mut self, ) -> &mut Chain<dyn AuthenticationPostCreateInterceptor + Send + Sync>
fn authentication_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn AuthenticationPreDeleteInterceptor + Send + Sync>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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