View Source Electric.ShapeCacheBehaviour behaviour (electric v1.0.1)

Behaviour defining the ShapeCache functions to be used in mocks

Summary

Types

@type shape_def() :: Electric.Shapes.Shape.t()
@type shape_handle() :: String.t()

Callbacks

Link to this callback

await_snapshot_start(shape_handle, opts)

View Source
@callback await_snapshot_start(shape_handle(), opts :: Access.t()) ::
  :started | {:error, term()}
@callback clean_all_shapes(Access.t()) :: :ok
Link to this callback

clean_shape(shape_handle, t)

View Source
@callback clean_shape(shape_handle(), Access.t()) :: :ok
Link to this callback

get_or_create_shape_handle(shape_def, opts)

View Source
@callback get_or_create_shape_handle(shape_def(), opts :: Access.t()) ::
  {shape_handle(),
   current_snapshot_offset :: Electric.Replication.LogOffset.t()}
Link to this callback

get_shape(shape_def, opts)

View Source
@callback get_shape(shape_def(), opts :: Access.t()) ::
  {shape_handle(),
   current_snapshot_offset :: Electric.Replication.LogOffset.t()}
  | nil
Link to this callback

has_shape?(shape_handle, t)

View Source
@callback has_shape?(shape_handle(), Access.t()) :: boolean()
@callback list_shapes(keyword() | map()) :: [{shape_handle(), Electric.Shapes.Shape.t()}]