pub trait TransactionContext:
CatalogDdl
+ Send
+ Sync {
type Pager: Pager<Blob = EntryHandle> + Send + Sync + 'static;
type Snapshot: TransactionCatalogSnapshot;
Show 19 methods
// Required methods
fn set_snapshot(&self, snapshot: TransactionSnapshot);
fn snapshot(&self) -> TransactionSnapshot;
fn table_column_specs(
&self,
table_name: &str,
) -> Result<Vec<PlanColumnSpec>, Error>;
fn export_table_rows(
&self,
table_name: &str,
) -> Result<ExecutorRowBatch, Error>;
fn get_batches_with_row_ids(
&self,
table_name: &str,
filter: Option<Expr<'static, String>>,
) -> Result<Vec<RecordBatch>, Error>;
fn execute_select(
&self,
plan: SelectPlan,
) -> Result<SelectExecution<Self::Pager>, Error>;
fn apply_create_table_plan(
&self,
plan: CreateTablePlan,
) -> Result<TransactionResult<Self::Pager>, Error>;
fn drop_table(&self, plan: DropTablePlan) -> Result<(), Error>;
fn insert(
&self,
plan: InsertPlan,
) -> Result<TransactionResult<Self::Pager>, Error>;
fn update(
&self,
plan: UpdatePlan,
) -> Result<TransactionResult<Self::Pager>, Error>;
fn delete(
&self,
plan: DeletePlan,
) -> Result<TransactionResult<Self::Pager>, Error>;
fn truncate(
&self,
plan: TruncatePlan,
) -> Result<TransactionResult<Self::Pager>, Error>;
fn create_index(
&self,
plan: CreateIndexPlan,
) -> Result<TransactionResult<Self::Pager>, Error>;
fn append_batches_with_row_ids(
&self,
table_name: &str,
batches: Vec<RecordBatch>,
) -> Result<usize, Error>;
fn table_names(&self) -> Vec<String>;
fn table_id(&self, table_name: &str) -> Result<u16, Error>;
fn catalog_snapshot(&self) -> Self::Snapshot;
// Provided methods
fn validate_commit_constraints(&self, _txn_id: u64) -> Result<(), Error> { ... }
fn clear_transaction_state(&self, _txn_id: u64) { ... }
}Expand description
A trait for transaction context operations.
This allows SessionTransaction to work with any context that implements these operations.
The associated type Pager specifies the pager type this context uses.
Required Associated Types§
Sourcetype Pager: Pager<Blob = EntryHandle> + Send + Sync + 'static
type Pager: Pager<Blob = EntryHandle> + Send + Sync + 'static
The pager type used by this context
Sourcetype Snapshot: TransactionCatalogSnapshot
type Snapshot: TransactionCatalogSnapshot
Snapshot representation returned by this context.
Required Methods§
Sourcefn set_snapshot(&self, snapshot: TransactionSnapshot)
fn set_snapshot(&self, snapshot: TransactionSnapshot)
Update the snapshot used for MVCC visibility decisions.
Sourcefn snapshot(&self) -> TransactionSnapshot
fn snapshot(&self) -> TransactionSnapshot
Get the snapshot currently associated with this context.
Sourcefn table_column_specs(
&self,
table_name: &str,
) -> Result<Vec<PlanColumnSpec>, Error>
fn table_column_specs( &self, table_name: &str, ) -> Result<Vec<PlanColumnSpec>, Error>
Get table column specifications
Sourcefn export_table_rows(&self, table_name: &str) -> Result<ExecutorRowBatch, Error>
fn export_table_rows(&self, table_name: &str) -> Result<ExecutorRowBatch, Error>
Export table rows for snapshotting
Sourcefn get_batches_with_row_ids(
&self,
table_name: &str,
filter: Option<Expr<'static, String>>,
) -> Result<Vec<RecordBatch>, Error>
fn get_batches_with_row_ids( &self, table_name: &str, filter: Option<Expr<'static, String>>, ) -> Result<Vec<RecordBatch>, Error>
Get batches with row IDs for seeding updates
Sourcefn execute_select(
&self,
plan: SelectPlan,
) -> Result<SelectExecution<Self::Pager>, Error>
fn execute_select( &self, plan: SelectPlan, ) -> Result<SelectExecution<Self::Pager>, Error>
Execute a SELECT plan with this context’s pager type
Sourcefn apply_create_table_plan(
&self,
plan: CreateTablePlan,
) -> Result<TransactionResult<Self::Pager>, Error>
fn apply_create_table_plan( &self, plan: CreateTablePlan, ) -> Result<TransactionResult<Self::Pager>, Error>
Create a table from plan
Sourcefn drop_table(&self, plan: DropTablePlan) -> Result<(), Error>
fn drop_table(&self, plan: DropTablePlan) -> Result<(), Error>
Drop a table
Sourcefn insert(
&self,
plan: InsertPlan,
) -> Result<TransactionResult<Self::Pager>, Error>
fn insert( &self, plan: InsertPlan, ) -> Result<TransactionResult<Self::Pager>, Error>
Insert rows
Sourcefn update(
&self,
plan: UpdatePlan,
) -> Result<TransactionResult<Self::Pager>, Error>
fn update( &self, plan: UpdatePlan, ) -> Result<TransactionResult<Self::Pager>, Error>
Update rows
Sourcefn delete(
&self,
plan: DeletePlan,
) -> Result<TransactionResult<Self::Pager>, Error>
fn delete( &self, plan: DeletePlan, ) -> Result<TransactionResult<Self::Pager>, Error>
Delete rows
Sourcefn truncate(
&self,
plan: TruncatePlan,
) -> Result<TransactionResult<Self::Pager>, Error>
fn truncate( &self, plan: TruncatePlan, ) -> Result<TransactionResult<Self::Pager>, Error>
Truncate table (delete all rows)
Sourcefn create_index(
&self,
plan: CreateIndexPlan,
) -> Result<TransactionResult<Self::Pager>, Error>
fn create_index( &self, plan: CreateIndexPlan, ) -> Result<TransactionResult<Self::Pager>, Error>
Create an index
Sourcefn append_batches_with_row_ids(
&self,
table_name: &str,
batches: Vec<RecordBatch>,
) -> Result<usize, Error>
fn append_batches_with_row_ids( &self, table_name: &str, batches: Vec<RecordBatch>, ) -> Result<usize, Error>
Append batches with row IDs
Sourcefn table_names(&self) -> Vec<String>
fn table_names(&self) -> Vec<String>
Get table names for catalog snapshot
Sourcefn table_id(&self, table_name: &str) -> Result<u16, Error>
fn table_id(&self, table_name: &str) -> Result<u16, Error>
Get table ID for a given table name (for conflict detection)
Sourcefn catalog_snapshot(&self) -> Self::Snapshot
fn catalog_snapshot(&self) -> Self::Snapshot
Get an immutable catalog snapshot for transaction isolation
Provided Methods§
Sourcefn validate_commit_constraints(&self, _txn_id: u64) -> Result<(), Error>
fn validate_commit_constraints(&self, _txn_id: u64) -> Result<(), Error>
Validate any pending commit-time constraints for this transaction.
Sourcefn clear_transaction_state(&self, _txn_id: u64)
fn clear_transaction_state(&self, _txn_id: u64)
Clear any transaction-scoped state retained by the context.