Maestro.Types.Event (Maestro v0.5.0)

View Source

Events are the key component from which state changes are made and projections can be built.

In order to ensure consistent application of events, they are always retrieved in order by sequence number. Additionally, events with conflicting sequence numbers will be rejected, and the aggregate can retry the command that generated the events that were committed second.

Summary

Functions

Ensure that events are well formed and that sequence conflicts surface properly when attempting to commit them to the log.

Types

aggregate_id()

@type aggregate_id() :: HLClock.Timestamp.t()

sequence()

@type sequence() :: integer()

t()

@type t() :: %Maestro.Types.Event{
  __meta__: term(),
  aggregate_id: aggregate_id(),
  body: map(),
  sequence: sequence(),
  timestamp: HLClock.Timestamp.t(),
  type: String.t()
}

uncommitted()

@type uncommitted() :: %Maestro.Types.Event{
  __meta__: term(),
  aggregate_id: aggregate_id(),
  body: map(),
  sequence: nil,
  timestamp: nil,
  type: String.t()
}

Functions

changeset(e)

Ensure that events are well formed and that sequence conflicts surface properly when attempting to commit them to the log.