Electric.ShapeCacheBehaviour behaviour (electric v1.0.20)

View Source

Behaviour defining the ShapeCache functions to be used in mocks

Summary

Types

shape_def()

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

shape_handle()

@type shape_handle() :: String.t()

Callbacks

await_snapshot_start(shape_handle, opts)

@callback await_snapshot_start(shape_handle(), opts :: Access.t()) ::
  :started | {:error, term()}

clean_all_shapes(t)

@callback clean_all_shapes(Access.t()) :: :ok

clean_all_shapes_for_relations(list, opts)

@callback clean_all_shapes_for_relations([Electric.oid_relation()], opts :: Access.t()) ::
  :ok

clean_shape(shape_handle, t)

@callback clean_shape(shape_handle(), Access.t()) :: :ok

get_or_create_shape_handle(shape_def, opts)

@callback get_or_create_shape_handle(shape_def(), opts :: Access.t()) ::
  {shape_handle(),
   current_snapshot_offset :: Electric.Replication.LogOffset.t()}

get_shape(shape_def, opts)

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

has_shape?(shape_handle, t)

@callback has_shape?(shape_handle(), Access.t()) :: boolean()

list_shapes(arg1)

@callback list_shapes(keyword() | map()) ::
  [{shape_handle(), Electric.Shapes.Shape.t()}] | :error