Parrhesia.Storage.Events behaviour
(parrhesia v0.14.0)
Copy Markdown
Storage callbacks for event persistence and query operations.
Summary
Types
@type context() :: map()
@type count_result() :: non_neg_integer() | %{optional(atom()) => term()}
@type event() :: map()
@type event_id() :: binary()
@type event_ref() :: %{created_at: non_neg_integer(), id: binary()}
@type filter() :: map()
@type paginate_opts() :: keyword()
@type query_opts() :: keyword()
@type reason() :: term()
Callbacks
@callback count(context(), [filter()], query_opts()) :: {:ok, count_result()} | {:error, reason()}
@callback delete_by_request(context(), event()) :: {:ok, non_neg_integer()} | {:error, reason()}
@callback paginate_events(context(), filter(), paginate_opts()) :: {:ok, [event()]} | {:error, reason()}
@callback purge_expired(query_opts()) :: {:ok, non_neg_integer()} | {:error, reason()}
@callback query(context(), [filter()], query_opts()) :: {:ok, [event()]} | {:error, reason()}
@callback query_event_refs(context(), [filter()], query_opts()) :: {:ok, [event_ref()]} | {:error, reason()}
@callback vanish(context(), event()) :: {:ok, non_neg_integer()} | {:error, reason()}