pub struct RuntimeContext<P>{ /* private fields */ }Expand description
In-memory execution context shared by plan-based queries.
Important: “lazy loading” here refers to table metadata only (schema, executor-side column descriptors, and a small next-row-id counter). We do NOT eagerly load or materialize the table’s row data into memory. All row/column data remains on the ColumnStore and is streamed in chunks during query execution. This keeps the memory footprint low even for very large tables.
Typical resource usage:
- Metadata per table: ~100s of bytes to a few KB (schema + field ids)
- ExecutorTable struct: small (handles + counters)
- Actual table rows: streamed from disk in chunks (never fully resident)
Implementations§
Source§impl<P> RuntimeContext<P>
impl<P> RuntimeContext<P>
pub fn new(pager: Arc<P>) -> Self
Sourcepub fn txn_manager(&self) -> Arc<TxnIdManager>
pub fn txn_manager(&self) -> Arc<TxnIdManager>
Return the transaction ID manager shared with sessions.
Sourcepub fn persist_next_txn_id(&self, next_txn_id: TxnId) -> Result<()>
pub fn persist_next_txn_id(&self, next_txn_id: TxnId) -> Result<()>
Persist the next_txn_id to the catalog.
Sourcepub fn default_snapshot(&self) -> TransactionSnapshot
pub fn default_snapshot(&self) -> TransactionSnapshot
Construct the default snapshot for auto-commit operations.
Sourcepub fn create_session(self: &Arc<Self>) -> RuntimeSession<P>
pub fn create_session(self: &Arc<Self>) -> RuntimeSession<P>
Create a new session for transaction management. Each session can have its own independent transaction.
Sourcepub fn table(self: &Arc<Self>, name: &str) -> Result<RuntimeTableHandle<P>>
pub fn table(self: &Arc<Self>, name: &str) -> Result<RuntimeTableHandle<P>>
Get a handle to an existing table by name.
Sourcepub fn has_active_transaction(&self) -> bool
👎Deprecated: Use session-based transactions instead
pub fn has_active_transaction(&self) -> bool
Check if there’s an active transaction (legacy - checks if ANY session has a transaction).
pub fn create_table<C, I>(
self: &Arc<Self>,
name: &str,
columns: I,
) -> Result<RuntimeTableHandle<P>>where
C: IntoColumnSpec,
I: IntoIterator<Item = C>,
pub fn create_table_if_not_exists<C, I>(
self: &Arc<Self>,
name: &str,
columns: I,
) -> Result<RuntimeTableHandle<P>>where
C: IntoColumnSpec,
I: IntoIterator<Item = C>,
pub fn create_table_plan( &self, plan: CreateTablePlan, ) -> Result<RuntimeStatementResult<P>>
pub fn table_names(self: &Arc<Self>) -> Vec<String>
pub fn create_table_builder( &self, name: &str, ) -> RuntimeCreateTableBuilder<'_, P>
pub fn table_column_specs( self: &Arc<Self>, name: &str, ) -> Result<Vec<ColumnSpec>>
pub fn export_table_rows(self: &Arc<Self>, name: &str) -> Result<RowBatch>
pub fn insert(&self, plan: InsertPlan) -> Result<RuntimeStatementResult<P>>
pub fn insert_with_snapshot( &self, plan: InsertPlan, snapshot: TransactionSnapshot, ) -> Result<RuntimeStatementResult<P>>
Sourcepub fn get_batches_with_row_ids(
&self,
table_name: &str,
filter: Option<LlkvExpr<'static, String>>,
) -> Result<Vec<RecordBatch>>
pub fn get_batches_with_row_ids( &self, table_name: &str, filter: Option<LlkvExpr<'static, String>>, ) -> Result<Vec<RecordBatch>>
Get raw batches from a table including row_ids, optionally filtered. This is used for transaction seeding where we need to preserve existing row_ids.
pub fn get_batches_with_row_ids_with_snapshot( &self, table_name: &str, filter: Option<LlkvExpr<'static, String>>, snapshot: TransactionSnapshot, ) -> Result<Vec<RecordBatch>>
Sourcepub fn append_batches_with_row_ids(
&self,
table_name: &str,
batches: Vec<RecordBatch>,
) -> Result<usize>
pub fn append_batches_with_row_ids( &self, table_name: &str, batches: Vec<RecordBatch>, ) -> Result<usize>
Append batches directly to a table, preserving row_ids from the batches. This is used for transaction seeding where we need to preserve existing row_ids.
pub fn update(&self, plan: UpdatePlan) -> Result<RuntimeStatementResult<P>>
pub fn update_with_snapshot( &self, plan: UpdatePlan, snapshot: TransactionSnapshot, ) -> Result<RuntimeStatementResult<P>>
pub fn delete(&self, plan: DeletePlan) -> Result<RuntimeStatementResult<P>>
pub fn delete_with_snapshot( &self, plan: DeletePlan, snapshot: TransactionSnapshot, ) -> Result<RuntimeStatementResult<P>>
pub fn table_handle( self: &Arc<Self>, name: &str, ) -> Result<RuntimeTableHandle<P>>
pub fn execute_select( self: &Arc<Self>, plan: SelectPlan, ) -> Result<SelectExecution<P>>
pub fn execute_select_with_snapshot( self: &Arc<Self>, plan: SelectPlan, snapshot: TransactionSnapshot, ) -> Result<SelectExecution<P>>
pub fn drop_table_immediate(&self, name: &str, if_exists: bool) -> Result<()>
pub fn is_table_marked_dropped(&self, canonical_name: &str) -> bool
Auto Trait Implementations§
impl<P> !Freeze for RuntimeContext<P>
impl<P> RefUnwindSafe for RuntimeContext<P>where
P: RefUnwindSafe,
impl<P> Send for RuntimeContext<P>
impl<P> Sync for RuntimeContext<P>
impl<P> Unpin for RuntimeContext<P>
impl<P> UnwindSafe for RuntimeContext<P>where
P: RefUnwindSafe,
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