Skip to main content

EngineRules

Trait EngineRules 

Source
pub trait EngineRules {
    // Required methods
    fn plan_insert(&self, params: InsertParams) -> Result<Vec<SqlPlan>>;
    fn plan_upsert(&self, params: UpsertParams) -> Result<Vec<SqlPlan>>;
    fn plan_scan(&self, params: ScanParams) -> Result<SqlPlan>;
    fn plan_point_get(&self, params: PointGetParams) -> Result<SqlPlan>;
    fn plan_update(&self, params: UpdateParams) -> Result<Vec<SqlPlan>>;
    fn plan_update_from(&self, params: UpdateFromParams) -> Result<Vec<SqlPlan>>;
    fn plan_delete(&self, params: DeleteParams) -> Result<Vec<SqlPlan>>;
    fn plan_aggregate(&self, params: AggregateParams) -> Result<SqlPlan>;
    fn plan_merge(&self, params: MergeParams) -> Result<Vec<SqlPlan>>;
}
Expand description

Engine-specific planning rules.

Each engine type implements this trait to produce the correct SqlPlan variant for each operation, or return an error if the operation is not supported. This is the single source of truth for operation routing — no downstream code should ever check engine type to decide routing.

Required Methods§

Source

fn plan_insert(&self, params: InsertParams) -> Result<Vec<SqlPlan>>

Plan an INSERT. Returns Err if the engine does not support inserts (e.g. timeseries routes to TimeseriesIngest instead).

Source

fn plan_upsert(&self, params: UpsertParams) -> Result<Vec<SqlPlan>>

Plan an UPSERT (insert-or-merge). Returns Err for append-only or columnar engines that don’t support merge semantics.

Source

fn plan_scan(&self, params: ScanParams) -> Result<SqlPlan>

Plan a table scan (SELECT without point-get optimization).

Source

fn plan_point_get(&self, params: PointGetParams) -> Result<SqlPlan>

Plan a point lookup by primary key. Returns Err for engines that don’t support O(1) key lookups (e.g. timeseries).

Source

fn plan_update(&self, params: UpdateParams) -> Result<Vec<SqlPlan>>

Plan an UPDATE. Returns Err for append-only engines.

Source

fn plan_update_from(&self, params: UpdateFromParams) -> Result<Vec<SqlPlan>>

Plan an UPDATE target SET ... FROM src WHERE ....

Returns Err(SqlError::Unsupported) for engines that cannot participate as an update target in a cross-table update (timeseries, kv-with-opaque-keys).

Source

fn plan_delete(&self, params: DeleteParams) -> Result<Vec<SqlPlan>>

Plan a DELETE (point or bulk).

Source

fn plan_aggregate(&self, params: AggregateParams) -> Result<SqlPlan>

Plan a GROUP BY / aggregate query.

Source

fn plan_merge(&self, params: MergeParams) -> Result<Vec<SqlPlan>>

Plan a MERGE statement.

Returns Err(SqlError::Unsupported) for engines that do not support MERGE semantics (everything except document_schemaless and document_strict).

Implementors§