Chronicle.EventSequences.PreparedEvent (cratis_chronicle v3.16.1)

Copy Markdown View Source

An immutable, pre-serialized snapshot of an event, bound to the client, namespace and event sequence that prepared it.

Create with Chronicle.EventSequences.EventLog.prepare/2 and reuse with Chronicle.EventSequences.EventLog.append_prepared/3 and Chronicle.EventSequences.Streams.verify_content/3. The content is serialized once, at preparation time; later changes to the original event struct have no effect on it. Appending a prepared event through a different client, namespace, or event sequence than the one that prepared it returns {:error, :prepared_event_belongs_to_another_sequence}.

Mirrors the .NET client's PreparedEvent (IEventSequence.Prepare). Unlike .NET, single use is not enforced - a prepared event can be appended more than once, exactly like appending the same event struct twice.

Summary

Types

owner()

@type owner() ::
  {client :: atom(), namespace :: String.t(), event_sequence_id :: String.t()}

t()

@type t() :: %Chronicle.EventSequences.PreparedEvent{
  content: String.t(),
  event: struct(),
  event_type: struct(),
  owner: owner()
}