View Source Electric.ShapeCacheBehaviour behaviour (electric v0.9.5)

Behaviour defining the ShapeCache functions to be used in mocks

Summary

Types

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

Callbacks

Link to this callback

await_snapshot_start(shape_handle, opts)

View Source
@callback await_snapshot_start(shape_handle(), opts :: keyword()) ::
  :started | {:error, term()}
Link to this callback

clean_all_shapes(keyword)

View Source
@callback clean_all_shapes(keyword()) :: :ok
Link to this callback

clean_shape(shape_handle, keyword)

View Source
@callback clean_shape(
  shape_handle(),
  keyword()
) :: :ok
Link to this callback

get_or_create_shape_handle(shape_def, opts)

View Source
@callback get_or_create_shape_handle(shape_def(), opts :: keyword()) ::
  {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 :: keyword()) ::
  {shape_handle(),
   current_snapshot_offset :: Electric.Replication.LogOffset.t()}
  | nil
Link to this callback

handle_truncate(shape_handle, keyword)

View Source
@callback handle_truncate(
  shape_handle(),
  keyword()
) :: :ok
Link to this callback

has_shape?(shape_handle, keyword)

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

update_shape_latest_offset(shape_handle, t, keyword)

View Source
@callback update_shape_latest_offset(
  shape_handle(),
  Electric.Replication.LogOffset.t(),
  keyword()
) :: :ok

Update a shape's status with a new log offset