Fact.EventStreamWriter (Fact v0.2.1)

View Source

A per-stream, on-demand GenServer responsible for serializing writes to an event stream. It ensures that events are appended in order, enriched with stream metadata, and committed atomically.

Summary

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

commit(database_id, events, event_stream, expected_position \\ :any, opts \\ [])

@spec commit(
  Fact.database_id(),
  Fact.event() | [Fact.event(), ...],
  Fact.event_stream_id(),
  Fact.event_position() | :any | :none | :exists,
  keyword()
) :: {:ok, Fact.event_position()} | {:error, term()}

start_link(opts)