RuntimeContext

Struct RuntimeContext 

Source
pub struct RuntimeContext<P>
where P: Pager<Blob = EntryHandle> + Send + Sync,
{ /* 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>
where P: Pager<Blob = EntryHandle> + Send + Sync + 'static,

Source

pub fn new(pager: Arc<P>) -> Self

Source

pub fn txn_manager(&self) -> Arc<TxnIdManager>

Return the transaction ID manager shared with sessions.

Source

pub fn persist_next_txn_id(&self, next_txn_id: TxnId) -> Result<()>

Persist the next_txn_id to the catalog.

Source

pub fn default_snapshot(&self) -> TransactionSnapshot

Construct the default snapshot for auto-commit operations.

Source

pub fn create_session(self: &Arc<Self>) -> RuntimeSession<P>

Create a new session for transaction management. Each session can have its own independent transaction.

Source

pub fn table(self: &Arc<Self>, name: &str) -> Result<RuntimeTableHandle<P>>

Get a handle to an existing table by name.

Source

pub fn has_active_transaction(&self) -> bool

👎Deprecated: Use session-based transactions instead

Check if there’s an active transaction (legacy - checks if ANY session has a transaction).

Source

pub fn create_table<C, I>( self: &Arc<Self>, name: &str, columns: I, ) -> Result<RuntimeTableHandle<P>>
where C: IntoColumnSpec, I: IntoIterator<Item = C>,

Source

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>,

Source

pub fn create_table_plan( &self, plan: CreateTablePlan, ) -> Result<RuntimeStatementResult<P>>

Source

pub fn table_names(self: &Arc<Self>) -> Vec<String>

Source

pub fn create_table_builder( &self, name: &str, ) -> RuntimeCreateTableBuilder<'_, P>

Source

pub fn table_column_specs( self: &Arc<Self>, name: &str, ) -> Result<Vec<ColumnSpec>>

Source

pub fn export_table_rows(self: &Arc<Self>, name: &str) -> Result<RowBatch>

Source

pub fn insert(&self, plan: InsertPlan) -> Result<RuntimeStatementResult<P>>

Source

pub fn insert_with_snapshot( &self, plan: InsertPlan, snapshot: TransactionSnapshot, ) -> Result<RuntimeStatementResult<P>>

Source

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.

Source

pub fn get_batches_with_row_ids_with_snapshot( &self, table_name: &str, filter: Option<LlkvExpr<'static, String>>, snapshot: TransactionSnapshot, ) -> Result<Vec<RecordBatch>>

Source

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.

Source

pub fn update(&self, plan: UpdatePlan) -> Result<RuntimeStatementResult<P>>

Source

pub fn update_with_snapshot( &self, plan: UpdatePlan, snapshot: TransactionSnapshot, ) -> Result<RuntimeStatementResult<P>>

Source

pub fn delete(&self, plan: DeletePlan) -> Result<RuntimeStatementResult<P>>

Source

pub fn delete_with_snapshot( &self, plan: DeletePlan, snapshot: TransactionSnapshot, ) -> Result<RuntimeStatementResult<P>>

Source

pub fn table_handle( self: &Arc<Self>, name: &str, ) -> Result<RuntimeTableHandle<P>>

Source

pub fn execute_select( self: &Arc<Self>, plan: SelectPlan, ) -> Result<SelectExecution<P>>

Source

pub fn execute_select_with_snapshot( self: &Arc<Self>, plan: SelectPlan, snapshot: TransactionSnapshot, ) -> Result<SelectExecution<P>>

Source

pub fn drop_table_immediate(&self, name: &str, if_exists: bool) -> Result<()>

Source

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

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,