pub struct RuntimeSession { /* private fields */ }Expand description
A session for executing operations with optional transaction support.
This is a high-level wrapper around the transaction machinery that provides a clean API for users. Operations can be executed directly or within a transaction.
Implementations§
Source§impl RuntimeSession
impl RuntimeSession
pub fn namespace_registry(&self) -> Arc<RwLock<RuntimeStorageNamespaceRegistry>>
Sourcepub fn begin_transaction(&self) -> Result<RuntimeStatementResult<BoxedPager>>
pub fn begin_transaction(&self) -> Result<RuntimeStatementResult<BoxedPager>>
Begin a transaction in this session. Creates an empty staging context for new tables created within the transaction. Existing tables are accessed via MVCC visibility filtering - NO data copying occurs.
Sourcepub fn abort_transaction(&self)
pub fn abort_transaction(&self)
Mark the current transaction as aborted due to an error. This should be called when any error occurs during a transaction.
Sourcepub fn has_active_transaction(&self) -> bool
pub fn has_active_transaction(&self) -> bool
Check if this session has an active transaction.
Sourcepub fn is_aborted(&self) -> bool
pub fn is_aborted(&self) -> bool
Check if the current transaction has been aborted due to an error.
Sourcepub fn is_table_created_in_transaction(&self, table_name: &str) -> bool
pub fn is_table_created_in_transaction(&self, table_name: &str) -> bool
Check if a table was created in the current active transaction.
Sourcepub fn table_column_specs_from_transaction(
&self,
table_name: &str,
) -> Option<Vec<PlanColumnSpec>>
pub fn table_column_specs_from_transaction( &self, table_name: &str, ) -> Option<Vec<PlanColumnSpec>>
Get column specifications for a table created in the current transaction.
Returns None if there’s no active transaction or the table wasn’t created in it.
Sourcepub fn tables_referencing_in_transaction(
&self,
referenced_table: &str,
) -> Vec<String>
pub fn tables_referencing_in_transaction( &self, referenced_table: &str, ) -> Vec<String>
Get tables that reference the given table via foreign keys created in the current transaction. Returns an empty vector if there’s no active transaction or no transactional FKs reference this table.
Sourcepub fn commit_transaction(&self) -> Result<RuntimeStatementResult<BoxedPager>>
pub fn commit_transaction(&self) -> Result<RuntimeStatementResult<BoxedPager>>
Commit the current transaction and apply changes to the base context. If the transaction was aborted, this acts as a ROLLBACK instead.
Sourcepub fn rollback_transaction(&self) -> Result<RuntimeStatementResult<BoxedPager>>
pub fn rollback_transaction(&self) -> Result<RuntimeStatementResult<BoxedPager>>
Rollback the current transaction, discarding all changes.
Sourcepub fn execute_insert_plan(
&self,
plan: InsertPlan,
) -> Result<RuntimeStatementResult<BoxedPager>>
pub fn execute_insert_plan( &self, plan: InsertPlan, ) -> Result<RuntimeStatementResult<BoxedPager>>
Insert rows (outside or inside transaction).
Sourcepub fn execute_select_plan(
&self,
plan: SelectPlan,
) -> Result<RuntimeStatementResult<BoxedPager>>
pub fn execute_select_plan( &self, plan: SelectPlan, ) -> Result<RuntimeStatementResult<BoxedPager>>
Select rows (outside or inside transaction).
Sourcepub fn table_rows(&self, table: &str) -> Result<Vec<Vec<PlanValue>>>
pub fn table_rows(&self, table: &str) -> Result<Vec<Vec<PlanValue>>>
Convenience helper to fetch all rows from a table within this session.
pub fn execute_update_plan( &self, plan: UpdatePlan, ) -> Result<RuntimeStatementResult<BoxedPager>>
pub fn execute_delete_plan( &self, plan: DeletePlan, ) -> Result<RuntimeStatementResult<BoxedPager>>
pub fn execute_truncate_plan( &self, plan: TruncatePlan, ) -> Result<RuntimeStatementResult<BoxedPager>>
Trait Implementations§
Source§impl CatalogDdl for RuntimeSession
Implement CatalogDdl directly on the session so callers must import the trait
to perform schema mutations. This keeps all runtime DDL entry points aligned with
the shared contract used by contexts and storage namespaces.
impl CatalogDdl for RuntimeSession
Implement CatalogDdl directly on the session so callers must import the trait
to perform schema mutations. This keeps all runtime DDL entry points aligned with
the shared contract used by contexts and storage namespaces.
Source§type CreateTableOutput = RuntimeStatementResult<BoxedPager>
type CreateTableOutput = RuntimeStatementResult<BoxedPager>
Source§type DropTableOutput = RuntimeStatementResult<BoxedPager>
type DropTableOutput = RuntimeStatementResult<BoxedPager>
Source§type RenameTableOutput = ()
type RenameTableOutput = ()
Source§type AlterTableOutput = RuntimeStatementResult<BoxedPager>
type AlterTableOutput = RuntimeStatementResult<BoxedPager>
Source§type CreateIndexOutput = RuntimeStatementResult<BoxedPager>
type CreateIndexOutput = RuntimeStatementResult<BoxedPager>
Source§type DropIndexOutput = RuntimeStatementResult<BoxedPager>
type DropIndexOutput = RuntimeStatementResult<BoxedPager>
Source§fn create_table(&self, plan: CreateTablePlan) -> Result<Self::CreateTableOutput>
fn create_table(&self, plan: CreateTablePlan) -> Result<Self::CreateTableOutput>
Source§fn drop_table(&self, plan: DropTablePlan) -> Result<Self::DropTableOutput>
fn drop_table(&self, plan: DropTablePlan) -> Result<Self::DropTableOutput>
Source§fn create_view(&self, plan: CreateViewPlan) -> Result<()>
fn create_view(&self, plan: CreateViewPlan) -> Result<()>
Source§fn drop_view(&self, plan: DropViewPlan) -> Result<()>
fn drop_view(&self, plan: DropViewPlan) -> Result<()>
Source§fn rename_table(&self, plan: RenameTablePlan) -> Result<Self::RenameTableOutput>
fn rename_table(&self, plan: RenameTablePlan) -> Result<Self::RenameTableOutput>
Source§fn alter_table(&self, plan: AlterTablePlan) -> Result<Self::AlterTableOutput>
fn alter_table(&self, plan: AlterTablePlan) -> Result<Self::AlterTableOutput>
Source§fn create_index(&self, plan: CreateIndexPlan) -> Result<Self::CreateIndexOutput>
fn create_index(&self, plan: CreateIndexPlan) -> Result<Self::CreateIndexOutput>
Source§fn drop_index(&self, plan: DropIndexPlan) -> Result<Self::DropIndexOutput>
fn drop_index(&self, plan: DropIndexPlan) -> Result<Self::DropIndexOutput>
Auto Trait Implementations§
impl Freeze for RuntimeSession
impl !RefUnwindSafe for RuntimeSession
impl Send for RuntimeSession
impl Sync for RuntimeSession
impl Unpin for RuntimeSession
impl !UnwindSafe for RuntimeSession
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