Skip to main content

AdminTransaction

Struct AdminTransaction 

Source
pub struct AdminTransaction {
    pub multi: MultiTransaction,
    pub single: SingleTransaction,
    pub cmd: Option<MultiWriteTransaction>,
    pub event_bus: EventBus,
    pub changes: TransactionalDefChanges,
    pub testing: Option<TestingContext>,
    /* private fields */
}
Expand description

An active admin transaction that supports Query + DML + DDL operations.

AdminTransaction is the most privileged transaction type, capable of executing DDL (schema changes), DML (data mutations), and queries. It tracks catalog definition changes (TransactionalDefChanges) for DDL.

The transaction will auto-rollback on drop if not explicitly committed.

Fields§

§multi: MultiTransaction§single: SingleTransaction§cmd: Option<MultiWriteTransaction>§event_bus: EventBus§changes: TransactionalDefChanges§testing: Option<TestingContext>

Testing audit log. Set by the VM when in test context.

Implementations§

Source§

impl AdminTransaction

Source

pub fn savepoint(&self) -> Savepoint

Create a savepoint capturing current transaction state.

Source

pub fn restore_savepoint(&mut self, sp: Savepoint)

Restore transaction state to a previously created savepoint.

Source

pub fn clear_test_flow_state(&mut self)

Reset test-only flow bookkeeping so setup statements do not appear as in-test mutations when RUN TESTS later performs an inline flush.

Source

pub fn capture_testing_pre_commit<F>(&mut self, f: F) -> Result<()>
where F: FnOnce(&mut PreCommitContext) -> Result<()>,

Execute test-only pre-commit style processing without committing.

This is used by testing helpers that need commit-time flow work materialized while still staying inside the test savepoint.

Source§

impl AdminTransaction

Source

pub fn new( multi: MultiTransaction, single: SingleTransaction, event_bus: EventBus, interceptors: Interceptors, ) -> Result<Self>

Creates a new active admin transaction with a pre-commit callback

Source

pub fn event_bus(&self) -> &EventBus

Source

pub fn commit(&mut self) -> Result<CommitVersion>

Commit the transaction. Since single transactions are short-lived and auto-commit, this only commits the multi transaction.

Source

pub fn rollback(&mut self) -> Result<()>

Rollback the transaction.

Source

pub fn pending_writes(&self) -> &PendingWrites

Get access to the pending writes in this transaction

Source

pub fn with_single_query<'a, I, F, R>(&self, keys: I, f: F) -> Result<R>
where I: IntoIterator<Item = &'a EncodedKey> + Send, F: FnOnce(&mut SingleReadTransaction<'_>) -> Result<R> + Send, R: Send,

Execute a function with query access to the single transaction.

Source

pub fn with_single_command<'a, I, F, R>(&self, keys: I, f: F) -> Result<R>
where I: IntoIterator<Item = &'a EncodedKey> + Send, F: FnOnce(&mut SingleWriteTransaction<'_>) -> Result<R> + Send, R: Send,

Execute a function with query access to the single transaction.

Source

pub fn with_multi_query<F, R>(&self, f: F) -> Result<R>
where F: FnOnce(&mut QueryTransaction) -> Result<R>,

Execute a function with a query transaction view.

Source

pub fn with_multi_query_as_of_exclusive<F, R>( &self, version: CommitVersion, f: F, ) -> Result<R>
where F: FnOnce(&mut QueryTransaction) -> Result<R>,

Source

pub fn with_multi_query_as_of_inclusive<F, R>( &self, version: CommitVersion, f: F, ) -> Result<R>
where F: FnOnce(&mut QueryTransaction) -> Result<R>,

Source

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

Begin a single-version query transaction for specific keys

Source

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

Begin a single-version command transaction for specific keys

Source

pub fn get_changes(&self) -> &TransactionalDefChanges

Get reference to catalog changes for this transaction

Source

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

Track a row change for post-commit event emission

Source

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

Track a flow change for transactional view pre-commit processing

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

Source

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

Check if a key exists

Source

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

Get a prefix batch

Source

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

Get a reverse prefix batch

Source

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

Read as of version exclusive

Source

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

Set a key-value pair

Source

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

Unset a key, preserving the deleted values.

Source

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

Remove a key without preserving the deleted values.

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.

Trait Implementations§

Source§

impl CatalogTrackDictionaryChangeOperations for AdminTransaction

Source§

impl CatalogTrackFlowChangeOperations for AdminTransaction

Source§

impl CatalogTrackHandlerChangeOperations for AdminTransaction

Source§

impl CatalogTrackMigrationChangeOperations for AdminTransaction

Source§

impl CatalogTrackMigrationEventChangeOperations for AdminTransaction

Source§

impl CatalogTrackNamespaceChangeOperations for AdminTransaction

Source§

fn track_namespace_created(&mut self, namespace: Namespace) -> Result<()>

Source§

fn track_namespace_updated( &mut self, pre: Namespace, post: Namespace, ) -> Result<()>

Source§

fn track_namespace_deleted(&mut self, namespace: Namespace) -> Result<()>

Source§

impl CatalogTrackPolicyChangeOperations for AdminTransaction

Source§

impl CatalogTrackProcedureChangeOperations for AdminTransaction

Source§

impl CatalogTrackRingBufferChangeOperations for AdminTransaction

Source§

impl CatalogTrackRoleChangeOperations for AdminTransaction

Source§

impl CatalogTrackSeriesChangeOperations for AdminTransaction

Source§

impl CatalogTrackSubscriptionChangeOperations for AdminTransaction

Source§

impl CatalogTrackSumTypeChangeOperations for AdminTransaction

Source§

impl CatalogTrackTableChangeOperations for AdminTransaction

Source§

impl CatalogTrackTestChangeOperations for AdminTransaction

Source§

impl CatalogTrackUserAuthenticationChangeOperations for AdminTransaction

Source§

impl CatalogTrackUserChangeOperations for AdminTransaction

Source§

impl CatalogTrackUserRoleChangeOperations for AdminTransaction

Source§

impl CatalogTrackViewChangeOperations for AdminTransaction

Source§

impl Drop for AdminTransaction

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
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 TransactionalDictionaryChanges for AdminTransaction

Source§

impl TransactionalFlowChanges for AdminTransaction

Source§

fn find_flow(&self, id: FlowId) -> Option<&FlowDef>

Source§

fn find_flow_by_name( &self, namespace: NamespaceId, name: &str, ) -> Option<&FlowDef>

Source§

fn is_flow_deleted(&self, id: FlowId) -> bool

Source§

fn is_flow_deleted_by_name(&self, namespace: NamespaceId, name: &str) -> bool

Source§

impl TransactionalHandlerChanges for AdminTransaction

Source§

impl TransactionalMigrationChanges for AdminTransaction

Source§

impl TransactionalNamespaceChanges for AdminTransaction

Source§

impl TransactionalPolicyChanges for AdminTransaction

Source§

impl TransactionalProcedureChanges for AdminTransaction

Source§

impl TransactionalRingBufferChanges for AdminTransaction

Source§

impl TransactionalRoleChanges for AdminTransaction

Source§

impl TransactionalSeriesChanges for AdminTransaction

Source§

impl TransactionalSubscriptionChanges for AdminTransaction

Source§

impl TransactionalSumTypeChanges for AdminTransaction

Source§

impl TransactionalTableChanges for AdminTransaction

Source§

fn find_table(&self, id: TableId) -> Option<&TableDef>

Source§

fn find_table_by_name( &self, namespace: NamespaceId, name: &str, ) -> Option<&TableDef>

Source§

fn is_table_deleted(&self, id: TableId) -> bool

Source§

fn is_table_deleted_by_name(&self, namespace: NamespaceId, name: &str) -> bool

Source§

impl TransactionalTestChanges for AdminTransaction

Source§

fn find_test(&self, id: TestId) -> Option<&TestDef>

Source§

fn find_test_by_name( &self, namespace: NamespaceId, name: &str, ) -> Option<&TestDef>

Source§

fn is_test_deleted(&self, id: TestId) -> bool

Source§

fn is_test_deleted_by_name(&self, namespace: NamespaceId, name: &str) -> bool

Source§

impl TransactionalUserAuthenticationChanges for AdminTransaction

Source§

impl TransactionalUserChanges for AdminTransaction

Source§

impl TransactionalUserRoleChanges for AdminTransaction

Source§

impl TransactionalViewChanges for AdminTransaction

Source§

fn find_view(&self, id: ViewId) -> Option<&ViewDef>

Source§

fn find_view_by_name( &self, namespace: NamespaceId, name: &str, ) -> Option<&ViewDef>

Source§

fn is_view_deleted(&self, id: ViewId) -> bool

Source§

fn is_view_deleted_by_name(&self, namespace: NamespaceId, name: &str) -> bool

Source§

impl WithEventBus for AdminTransaction

Source§

impl WithInterceptors for AdminTransaction

Source§

fn table_pre_insert_interceptors( &mut self, ) -> &mut Chain<dyn TablePreInsertInterceptor + Send + Sync>

Access table pre-insert interceptor chain
Source§

fn table_post_insert_interceptors( &mut self, ) -> &mut Chain<dyn TablePostInsertInterceptor + Send + Sync>

Access table post-insert interceptor chain
Source§

fn table_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn TablePreUpdateInterceptor + Send + Sync>

Access table pre-update interceptor chain
Source§

fn table_post_update_interceptors( &mut self, ) -> &mut Chain<dyn TablePostUpdateInterceptor + Send + Sync>

Access table post-update interceptor chain
Source§

fn table_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn TablePreDeleteInterceptor + Send + Sync>

Access table pre-delete interceptor chain
Source§

fn table_post_delete_interceptors( &mut self, ) -> &mut Chain<dyn TablePostDeleteInterceptor + Send + Sync>

Access table post-delete interceptor chain
Source§

fn ringbuffer_pre_insert_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferPreInsertInterceptor + Send + Sync>

Access ring buffer pre-insert interceptor chain
Source§

fn ringbuffer_post_insert_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferPostInsertInterceptor + Send + Sync>

Access ring buffer post-insert interceptor chain
Source§

fn ringbuffer_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferPreUpdateInterceptor + Send + Sync>

Access ring buffer pre-update interceptor chain
Source§

fn ringbuffer_post_update_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferPostUpdateInterceptor + Send + Sync>

Access ring buffer post-update interceptor chain
Source§

fn ringbuffer_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferPreDeleteInterceptor + Send + Sync>

Access ring buffer pre-delete interceptor chain
Source§

fn ringbuffer_post_delete_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferPostDeleteInterceptor + Send + Sync>

Access ring buffer post-delete interceptor chain
Source§

fn pre_commit_interceptors( &mut self, ) -> &mut Chain<dyn PreCommitInterceptor + Send + Sync>

Access pre-commit interceptor chain
Source§

fn post_commit_interceptors( &mut self, ) -> &mut Chain<dyn PostCommitInterceptor + Send + Sync>

Access post-commit interceptor chain
Source§

fn namespace_post_create_interceptors( &mut self, ) -> &mut Chain<dyn NamespacePostCreateInterceptor + Send + Sync>

Access namespace post-create interceptor chain
Source§

fn namespace_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn NamespacePreUpdateInterceptor + Send + Sync>

Access namespace pre-update interceptor chain
Source§

fn namespace_post_update_interceptors( &mut self, ) -> &mut Chain<dyn NamespacePostUpdateInterceptor + Send + Sync>

Access namespace post-update interceptor chain
Source§

fn namespace_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn NamespacePreDeleteInterceptor + Send + Sync>

Access namespace pre-delete interceptor chain
Source§

fn table_def_post_create_interceptors( &mut self, ) -> &mut Chain<dyn TableDefPostCreateInterceptor + Send + Sync>

Access table definition post-create interceptor chain
Source§

fn table_def_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn TableDefPreUpdateInterceptor + Send + Sync>

Access table definition pre-update interceptor chain
Source§

fn table_def_post_update_interceptors( &mut self, ) -> &mut Chain<dyn TableDefPostUpdateInterceptor + Send + Sync>

Access table definition post-update interceptor chain
Source§

fn table_def_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn TableDefPreDeleteInterceptor + Send + Sync>

Access table definition pre-delete interceptor chain
Source§

fn view_pre_insert_interceptors( &mut self, ) -> &mut Chain<dyn ViewPreInsertInterceptor + Send + Sync>

Access view pre-insert interceptor chain
Source§

fn view_post_insert_interceptors( &mut self, ) -> &mut Chain<dyn ViewPostInsertInterceptor + Send + Sync>

Access view post-insert interceptor chain
Source§

fn view_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn ViewPreUpdateInterceptor + Send + Sync>

Access view pre-update interceptor chain
Source§

fn view_post_update_interceptors( &mut self, ) -> &mut Chain<dyn ViewPostUpdateInterceptor + Send + Sync>

Access view post-update interceptor chain
Source§

fn view_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn ViewPreDeleteInterceptor + Send + Sync>

Access view pre-delete interceptor chain
Source§

fn view_post_delete_interceptors( &mut self, ) -> &mut Chain<dyn ViewPostDeleteInterceptor + Send + Sync>

Access view post-delete interceptor chain
Source§

fn view_def_post_create_interceptors( &mut self, ) -> &mut Chain<dyn ViewDefPostCreateInterceptor + Send + Sync>

Access view post-create interceptor chain
Source§

fn view_def_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn ViewDefPreUpdateInterceptor + Send + Sync>

Access view pre-update interceptor chain
Source§

fn view_def_post_update_interceptors( &mut self, ) -> &mut Chain<dyn ViewDefPostUpdateInterceptor + Send + Sync>

Access view post-update interceptor chain
Source§

fn view_def_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn ViewDefPreDeleteInterceptor + Send + Sync>

Access view pre-delete interceptor chain
Source§

fn ringbuffer_def_post_create_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferDefPostCreateInterceptor + Send + Sync>

Access ring buffer definition post-create interceptor chain
Source§

fn ringbuffer_def_pre_update_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferDefPreUpdateInterceptor + Send + Sync>

Access ring buffer definition pre-update interceptor chain
Source§

fn ringbuffer_def_post_update_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferDefPostUpdateInterceptor + Send + Sync>

Access ring buffer definition post-update interceptor chain
Source§

fn ringbuffer_def_pre_delete_interceptors( &mut self, ) -> &mut Chain<dyn RingBufferDefPreDeleteInterceptor + Send + Sync>

Access ring buffer definition pre-delete interceptor chain
Source§

impl CatalogTrackChangeOperations for AdminTransaction

Source§

impl TransactionalChanges for AdminTransaction

Auto Trait Implementations§

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