Fact.Seam.EventId behaviour (Fact v0.2.0)

View Source

Behaviour defining how to generate event ids for events in a Fact database.

Implementations of this seam provide the logic for producing unique identifiers for events. The generated ID can be any binary value, such as a UUID or hash.

Callback

  • generate/2 – Generates a new event ID for the given seam instance. Accepts optional parameters via opts. Returns a binary ID or an error tuple.

Summary

Types

t()

@type t() :: struct()

Callbacks

default_options()

@callback default_options() :: map()

family()

@callback family() :: atom()

generate(state, opts)

@callback generate(state :: t(), opts :: keyword()) :: binary() | {:error, term()}

id()

@callback id() :: {atom(), non_neg_integer()}

init(map)

@callback init(map()) :: struct() | {:error, term()}

normalize_options(map)

@callback normalize_options(map()) :: {:ok, map()} | {:error, term()}

option_specs()

@callback option_specs() :: %{required(atom()) => map()}

prepare_options(map)

@callback prepare_options(map()) :: map()

version()

@callback version() :: non_neg_integer()