Spectre.Journal.Store behaviour (Spectre v0.3.3)

Copy Markdown View Source

Storage boundary for structured Spectre journal records.

A runtime store only needs to append records. Querying, retention, indexing, and transactional outboxes remain application concerns. Adapters used by configured Instance erasure additionally expose the optional, idempotent erase_instance/2 callback.

Summary

Functions

Erases all journal records bound to one exact Instance Ref.

Checks whether a configured journal supports idempotent Instance erasure.

Normalizes the journal configurations accepted by the runtime.

Types

config()

@type config() :: module() | {module(), keyword()} | keyword() | false | nil

normalized()

@type normalized() :: nil | {module(), keyword()}

Callbacks

append(t, keyword)

@callback append(
  Spectre.Journal.Record.t(),
  keyword()
) :: :ok | {:ok, term()} | {:error, term()}

erase_instance(t, keyword)

(optional)
@callback erase_instance(
  Spectre.Instance.Ref.t(),
  keyword()
) :: {:ok, :erased | :already_erased} | {:error, term()}

Functions

erase_instance(store, ref, opts)

@spec erase_instance(normalized(), Spectre.Instance.Ref.t(), keyword()) ::
  {:ok, :erased | :already_erased | :not_configured} | {:error, term()}

Erases all journal records bound to one exact Instance Ref.

erasure_capability(arg1)

@spec erasure_capability(normalized()) :: :ok | {:error, term()}

Checks whether a configured journal supports idempotent Instance erasure.

normalize(value)

@spec normalize(config()) :: {:ok, normalized()} | {:error, term()}

Normalizes the journal configurations accepted by the runtime.