Listex.Event (Listex v0.1.0)

View Source

What a subscriber is told happened, in the order the list process decided it happened.

Every event carries the :version of the list. State-changing events (:inserted, :updated, :moved, :deleted) carry the version after they were applied, and versions are consecutive: if you receive 7 right after 5 you missed one and should re-read the list with Listex.snapshot/1.

Fields per type:

typefields
:inserted:item, :after (:start, :end or an anchor id)
:updated:item
:moved:id, :after
:deleted:id
:editing:id, :data, :by — ephemeral, does not bump :version

Summary

Types

t()

@type t() :: %Listex.Event{
  after: Listex.ID.t() | :start | :end | nil,
  by: pid() | nil,
  data: term(),
  id: Listex.ID.t() | nil,
  item: Listex.Item.t() | nil,
  list_id: Listex.ID.t(),
  type: type(),
  version: non_neg_integer()
}

type()

@type type() :: :inserted | :updated | :moved | :deleted | :editing