Skip to main content

ExecutionContext

Struct ExecutionContext 

Source
pub struct ExecutionContext { /* private fields */ }
Expand description

Context for query execution.

Implementations§

Source§

impl ExecutionContext

Source

pub fn new() -> Self

Source

pub fn begin_snapshot(&mut self)

Take an MVCC snapshot — subsequent reads will only see rows visible at this version.

Source

pub fn commit_snapshot(&mut self)

Release the MVCC snapshot and advance the clock.

Source

pub fn rollback_snapshot(&mut self)

Release the MVCC snapshot without advancing.

Source

pub fn current_version(&self) -> u64

Current version clock value.

Source

pub fn with_batch_size(self, size: usize) -> Self

Source

pub fn add_table(&mut self, table: TableData)

Source

pub fn get_table(&self, name: &str) -> Option<Arc<RwLock<TableData>>>

Source

pub fn batch_size(&self) -> usize

Source

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.

Source

pub fn drop_table(&mut self, name: &str, if_exists: bool) -> ExecutorResult<()>

Drop a table.

Source

pub fn alter_table( &mut self, name: &str, op: &PlanAlterOperation, ) -> ExecutorResult<()>

Alter a table.

Source

pub fn create_index( &mut self, name: String, table: String, columns: Vec<String>, unique: bool, if_not_exists: bool, ) -> ExecutorResult<()>

Create an index.

Source

pub fn drop_index(&mut self, name: &str, if_exists: bool) -> ExecutorResult<()>

Drop an index.

Source

pub fn get_index_manager(&self, table: &str) -> Option<Arc<TableIndexManager>>

Get the index manager for a table.

Source

pub fn get_indexes(&self, table: &str) -> Option<&Vec<IndexSchema>>

Get index metadata for a table.

Source

pub fn get_table_schema(&self, name: &str) -> Option<&TableSchema>

Get table schema.

Source

pub fn list_tables(&self) -> Vec<String>

List all table names.

Source

pub fn to_snapshot(&self) -> ExecutionContextSnapshot

Create a serializable snapshot of the execution context.

Source

pub fn from_snapshot(snapshot: ExecutionContextSnapshot) -> Self

Restore execution context from a snapshot.

Source

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.

Source

pub fn save_to_file(&self, path: &Path) -> Result<()>

Save the execution context to a file.

Source

pub fn load_from_file(path: &Path) -> Result<Self>

Load the execution context from a file.

Source

pub fn merge_from_file(&mut self, path: &Path) -> Result<()>

Merge data from a file into the current context (for loading on startup).

Source

pub fn insert_rows( &self, table_name: &str, columns: &[String], rows: Vec<Vec<Value>>, ) -> ExecutorResult<u64>

Insert rows into a table.

Source

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.

Source

pub fn delete_rows( &self, table_name: &str, predicate: Option<&dyn Fn(&Row, &[String]) -> bool>, ) -> ExecutorResult<u64>

Delete rows from a table.

Trait Implementations§

Source§

impl Default for ExecutionContext

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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