SquidMesh.Runtime.DispatchProtocol (squid_mesh v0.1.0-alpha.7)

Copy Markdown View Source

Defines the durable dispatch journal contract.

The protocol separates durable facts from live effects:

  • run-thread entries record workflow lifecycle facts
  • dispatch-thread entries record runnable intent, claims, leases, heartbeats, completions, failures, retries, and live wakeups
  • run-index entries support rebuildable lookup projections

A live wakeup or action execution is valid only after the runnable intent is appended. Claims are fenced by claim_id and claim_token_hash; completions, failures, and heartbeats from stale claim owners are ignored by the projection and surfaced as anomalies.

Summary

Types

entry_type()

@type entry_type() ::
  :run_started
  | :runnables_planned
  | :runnable_applied
  | :run_terminal
  | :run_indexed
  | :attempt_scheduled
  | :attempt_claimed
  | :attempt_heartbeat
  | :attempt_completed
  | :attempt_failed
  | :live_wakeup_emitted

Functions

new_entry(type, attrs)

@spec new_entry(entry_type(), map() | keyword()) ::
  {:ok, SquidMesh.Runtime.DispatchProtocol.Entry.t()}
  | {:error, {:unknown_entry_type, atom()} | {:missing_fields, [atom()]}}