Responsible for knowing which shapes are affected by a change to a specific table.
When add_shape/4 is called, shapes are added to a tree stored in ETS. Each node on the tree represents
an optimised (indexed) condition in the shape's where clause, with shapes that share an optimised condition
being on the same branch.
Each WhereCondition is identified by a unique reference and stores:
index_keys: MapSet of {field_key, operation} tuples for indexed conditionsother_shapes: map of {shape_id, branch_key} -> where_clause for non-optimized shapes
The logic for specific indexes (equality, inclusion) is handled by dedicated modules that also use ETS.
Summary
Functions
Returns true when the WHERE clause can use the filter's indexed routing
path instead of relying entirely on other_shapes.
Remove a shape from a WhereCondition.
Functions
@spec indexed_where?(Electric.Replication.Eval.Expr.t() | nil) :: boolean()
Returns true when the WHERE clause can use the filter's indexed routing
path instead of relying entirely on other_shapes.
@spec remove_shape( Electric.Shapes.Filter.t(), reference(), String.t(), Electric.Replication.Eval.Expr.t() | nil ) :: :deleted | :ok
Remove a shape from a WhereCondition.
Returns :deleted if the condition is now empty and was deleted,
or :ok if the condition still has shapes.