pub trait CompiledPlanner: Send {
// Provided methods
fn plan(&mut self, _context: &PlanContext<'_>) -> Result<(), GenerateError> { ... }
fn writes(&self) -> &[String] { ... }
fn generate_row(
&mut self,
_row_index: u64,
_output: &mut [GeneratedValue],
) -> Result<(), GenerateError> { ... }
fn verification_predicates(&self) -> Vec<PlannerPredicate> { ... }
fn family_child_table(&self) -> Option<&str> { ... }
fn family_relationship(&self) -> Option<&str> { ... }
fn child_writes(&self) -> &[String] { ... }
fn take_family_children(
&mut self,
) -> Box<dyn Iterator<Item = Result<Vec<GeneratedValue>, GenerateError>> + '_> { ... }
fn family_sum_checks(&self) -> Vec<FamilySumCheck> { ... }
}Expand description
A compiled planner: coordinates several columns of a table together.
Planners split their work across two phases. plan runs once
per table before any row and provides the table-scope extension point for
spooling. generate_row runs once per row in the
engine’s row pipeline and produces the values of the columns the planner
owns — a planner writes several correlated columns together (e.g. an
interval’s start/end/duration/open) rather than one column at a
time. The engine maps writes to row-buffer slots once per
table, then scatters each produced value into place; a planner-owned column
therefore takes its value from the planner, not from a generator.
Provided Methods§
Sourcefn plan(&mut self, _context: &PlanContext<'_>) -> Result<(), GenerateError>
fn plan(&mut self, _context: &PlanContext<'_>) -> Result<(), GenerateError>
Contribute this planner’s table-level decisions for context. Runs once
per table before any row is generated. Default: nothing to do.
Sourcefn writes(&self) -> &[String]
fn writes(&self) -> &[String]
The columns this planner produces, in the positional order
generate_row writes them. The engine resolves
each name to a row-buffer slot once per table. Default: none (a planner
that contributes only structural decisions, not column values).
Sourcefn generate_row(
&mut self,
_row_index: u64,
_output: &mut [GeneratedValue],
) -> Result<(), GenerateError>
fn generate_row( &mut self, _row_index: u64, _output: &mut [GeneratedValue], ) -> Result<(), GenerateError>
Produce this planner’s owned column values for the row at row_index,
writing them into output positionally aligned with
writes. Runs once per row, before column modifiers and
the sink. Default: no-op (nothing owned).
Sourcefn verification_predicates(&self) -> Vec<PlannerPredicate>
fn verification_predicates(&self) -> Vec<PlannerPredicate>
Machine-checkable invariants this planner guarantees over its owned columns, surfaced so the verifier can assert them without knowing the planner’s internals. Default: none.
Sourcefn family_child_table(&self) -> Option<&str>
fn family_child_table(&self) -> Option<&str>
The name of the child table this planner coordinates as a cross-table
family, if any. A same-table planner returns None; a family planner
(e.g. commerce.order_family) names the child table whose rows it
produces alongside its parent columns. The engine spools those child
rows and renders them at the child table’s dependency position.
Sourcefn family_relationship(&self) -> Option<&str>
fn family_relationship(&self) -> Option<&str>
The child-table relationship (declared on the child) that carries the
foreign key back to this planner’s parent, so the engine sets each
spooled child row’s FK to the exact parent that produced it. Only
meaningful when family_child_table is
Some.
Sourcefn child_writes(&self) -> &[String]
fn child_writes(&self) -> &[String]
The child columns this planner produces, in the positional order of the
per-child value vectors returned by
take_family_children. Only meaningful for
a family planner. Default: none.
Sourcefn take_family_children(
&mut self,
) -> Box<dyn Iterator<Item = Result<Vec<GeneratedValue>, GenerateError>> + '_>
fn take_family_children( &mut self, ) -> Box<dyn Iterator<Item = Result<Vec<GeneratedValue>, GenerateError>> + '_>
Take an incremental stream of child rows produced by the most recent
generate_row call. Each item is one child line,
aligned with child_writes, so the engine can spool
it immediately without retaining a parent-sized child vector.
Default: an empty stream.
Sourcefn family_sum_checks(&self) -> Vec<FamilySumCheck>
fn family_sum_checks(&self) -> Vec<FamilySumCheck>
Cross-table sum invariants this family planner guarantees between a
parent aggregate column and the child rows that reference each parent
row. Same-table planners (whose invariants are stated as
verification_predicates) return none;
a family planner (e.g. commerce.order_family) surfaces the equalities
the verifier checks by grouping child rows on the
declared family_relationship foreign key.
Default: none.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".