View Source Electric.Shapes.Filter.WhereCondition (electric v1.0.1)

Responsible for knowing which shapes are affected by a change to a specific table.

When add_shape/3 is called, shapes are added to a tree of %WhereCondition{}s. 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.

The %WhereCondition{} struct contains indexes, a map of indexes for shapes that have been optimised, and other_shapes for shapes that have not been optimised (or have no conditions left to be optimised since they've been optimised at another level of the tree). The logic for specific indexes is delegated to the index's module. Each index may contain %WhereCondition%{}s and thus a tree of optimised conditions is formed.

Summary

Functions

Link to this function

add_shape(condition, shape_instance, where_clause)

View Source
Link to this function

affected_shapes(condition, record)

View Source
Link to this function

all_shapes(where_condition)

View Source
Link to this function

remove_shape(condition, shape_id)

View Source