View Source Electric.Shapes.Filter (electric v0.9.5)

Responsible for knowing which shapes are affected by a change.

affected_shapes(filter, change) will return a set of IDs for the shapes that are affected by the change considering all the shapes that have been added to the filter using add_shape/3.

The Filter module keeps track of what tables are referenced by the shapes and changes and delegates the table specific logic to the Filter.Table module.

Summary

Functions

Add a shape for the filter to track.

Returns the shape IDs for all shapes that have been added to the filter that are affected by the given change.

Remove a shape from the filter.

Types

@type shape_id() :: any()
@type t() :: %Electric.Shapes.Filter{tables: term()}

Functions

Link to this function

add_shape(filter, shape_id, shape)

View Source
@spec add_shape(t(), shape_id(), Electric.Shapes.Shape.t()) :: t()

Add a shape for the filter to track.

The shape_id can be any term you like to identify the shape. Whatever you use will be returned by affected_shapes/2 when the shape is affected by a change.

Link to this function

affected_shapes(filter, change)

View Source
@spec affected_shapes(t(), Electric.Replication.Changes.change()) ::
  MapSet.t(shape_id())

Returns the shape IDs for all shapes that have been added to the filter that are affected by the given change.

@spec new() :: t()
Link to this function

remove_shape(filter, shape_id)

View Source
@spec remove_shape(t(), shape_id()) :: t()

Remove a shape from the filter.