Spectre.Operation.Event (Spectre v0.3.0)

Copy Markdown View Source

Committed event envelope shared by Work, Vigil and external controllers.

Summary

Functions

Converts a committed event into a normal typed router input.

Types

t()

@type t() :: %Spectre.Operation.Event{
  agent_id: String.t(),
  artifact: term(),
  causation_id: String.t() | nil,
  correlation_id: String.t(),
  id: String.t(),
  loop_id: String.t(),
  loop_kind: :work | :vigil | :directive,
  metadata: map(),
  payload: term(),
  provenance: map(),
  revision: non_neg_integer(),
  timestamp: non_neg_integer(),
  type: atom()
}

Functions

new(loop, type, opts \\ [])

@spec new(Spectre.Operation.Loop.t(), atom(), keyword()) :: t()

to_input(event)

@spec to_input(t()) :: Spectre.Input.t()

Converts a committed event into a normal typed router input.

validate(event)

@spec validate(t()) :: :ok | {:error, term()}