pub struct ExecutionContext { /* private fields */ }Expand description
Context for query execution.
Implementations§
Source§impl ExecutionContext
impl ExecutionContext
pub fn new() -> Self
Sourcepub fn begin_snapshot(&mut self)
pub fn begin_snapshot(&mut self)
Take an MVCC snapshot — subsequent reads will only see rows visible at this version.
Sourcepub fn commit_snapshot(&mut self)
pub fn commit_snapshot(&mut self)
Release the MVCC snapshot and advance the clock.
Sourcepub fn rollback_snapshot(&mut self)
pub fn rollback_snapshot(&mut self)
Release the MVCC snapshot without advancing.
Sourcepub fn current_version(&self) -> u64
pub fn current_version(&self) -> u64
Current version clock value.
pub fn with_batch_size(self, size: usize) -> Self
pub fn add_table(&mut self, table: TableData)
pub fn get_table(&self, name: &str) -> Option<Arc<RwLock<TableData>>>
pub fn batch_size(&self) -> usize
Sourcepub fn create_table(
&mut self,
name: String,
columns: Vec<ColumnSchema>,
primary_key: Option<Vec<String>>,
constraints: Vec<StoredConstraint>,
if_not_exists: bool,
) -> ExecutorResult<()>
pub fn create_table( &mut self, name: String, columns: Vec<ColumnSchema>, primary_key: Option<Vec<String>>, constraints: Vec<StoredConstraint>, if_not_exists: bool, ) -> ExecutorResult<()>
Create a new table.
Sourcepub fn drop_table(&mut self, name: &str, if_exists: bool) -> ExecutorResult<()>
pub fn drop_table(&mut self, name: &str, if_exists: bool) -> ExecutorResult<()>
Drop a table.
Sourcepub fn alter_table(
&mut self,
name: &str,
op: &PlanAlterOperation,
) -> ExecutorResult<()>
pub fn alter_table( &mut self, name: &str, op: &PlanAlterOperation, ) -> ExecutorResult<()>
Alter a table.
Sourcepub fn create_index(
&mut self,
name: String,
table: String,
columns: Vec<String>,
unique: bool,
if_not_exists: bool,
) -> ExecutorResult<()>
pub fn create_index( &mut self, name: String, table: String, columns: Vec<String>, unique: bool, if_not_exists: bool, ) -> ExecutorResult<()>
Create an index.
Sourcepub fn drop_index(&mut self, name: &str, if_exists: bool) -> ExecutorResult<()>
pub fn drop_index(&mut self, name: &str, if_exists: bool) -> ExecutorResult<()>
Drop an index.
Sourcepub fn get_index_manager(&self, table: &str) -> Option<Arc<TableIndexManager>>
pub fn get_index_manager(&self, table: &str) -> Option<Arc<TableIndexManager>>
Get the index manager for a table.
Sourcepub fn get_indexes(&self, table: &str) -> Option<&Vec<IndexSchema>>
pub fn get_indexes(&self, table: &str) -> Option<&Vec<IndexSchema>>
Get index metadata for a table.
Sourcepub fn get_table_schema(&self, name: &str) -> Option<&TableSchema>
pub fn get_table_schema(&self, name: &str) -> Option<&TableSchema>
Get table schema.
Sourcepub fn list_tables(&self) -> Vec<String>
pub fn list_tables(&self) -> Vec<String>
List all table names.
Sourcepub fn to_snapshot(&self) -> ExecutionContextSnapshot
pub fn to_snapshot(&self) -> ExecutionContextSnapshot
Create a serializable snapshot of the execution context.
Sourcepub fn from_snapshot(snapshot: ExecutionContextSnapshot) -> Self
pub fn from_snapshot(snapshot: ExecutionContextSnapshot) -> Self
Restore execution context from a snapshot.
Sourcepub fn restore_from_snapshot(&mut self, snapshot: ExecutionContextSnapshot)
pub fn restore_from_snapshot(&mut self, snapshot: ExecutionContextSnapshot)
Restore this context in-place from a snapshot (used for ROLLBACK). Resets MVCC version_clock and snapshot_version to ensure consistency.
Sourcepub fn save_to_file(&self, path: &Path) -> Result<()>
pub fn save_to_file(&self, path: &Path) -> Result<()>
Save the execution context to a file.
Sourcepub fn load_from_file(path: &Path) -> Result<Self>
pub fn load_from_file(path: &Path) -> Result<Self>
Load the execution context from a file.
Sourcepub fn merge_from_file(&mut self, path: &Path) -> Result<()>
pub fn merge_from_file(&mut self, path: &Path) -> Result<()>
Merge data from a file into the current context (for loading on startup).
Sourcepub fn insert_rows(
&self,
table_name: &str,
columns: &[String],
rows: Vec<Vec<Value>>,
) -> ExecutorResult<u64>
pub fn insert_rows( &self, table_name: &str, columns: &[String], rows: Vec<Vec<Value>>, ) -> ExecutorResult<u64>
Insert rows into a table.
Sourcepub fn update_rows(
&self,
table_name: &str,
assignments: &[(String, Value)],
predicate: Option<&dyn Fn(&Row, &[String]) -> bool>,
) -> ExecutorResult<u64>
pub fn update_rows( &self, table_name: &str, assignments: &[(String, Value)], predicate: Option<&dyn Fn(&Row, &[String]) -> bool>, ) -> ExecutorResult<u64>
Update rows in a table.
Sourcepub fn delete_rows(
&self,
table_name: &str,
predicate: Option<&dyn Fn(&Row, &[String]) -> bool>,
) -> ExecutorResult<u64>
pub fn delete_rows( &self, table_name: &str, predicate: Option<&dyn Fn(&Row, &[String]) -> bool>, ) -> ExecutorResult<u64>
Delete rows from a table.