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_delete(&self, params: DeleteParams) -> Result<Vec<SqlPlan>>;
    fn plan_aggregate(&self, params: AggregateParams) -> Result<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_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.

Implementors§