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

Copy Markdown View Source

Rebuildable projection over durable dispatch journal entries.

The projection is deliberately pure. Storage adapters can rebuild it from Jido thread journals, IntentLedger lifecycle signals, or from a single append-only Squid Mesh journal table without changing the runtime invariants.

Summary

Types

anomaly()

@type anomaly() :: %{
  :reason => atom(),
  :entry_type => atom(),
  optional(:runnable_key) => String.t(),
  optional(:run_id) => String.t(),
  optional(:idempotency_key) => String.t(),
  optional(:claim_id) => String.t(),
  optional(:claim_token_hash) => String.t()
}

t()

@type t() :: %SquidMesh.Runtime.DispatchProtocol.Projection{
  anomalies: [anomaly()],
  attempts: %{
    optional(String.t()) => SquidMesh.Runtime.DispatchProtocol.ActionAttempt.t()
  },
  terminal_runs: MapSet.t(String.t())
}

Functions

anomalies(projection)

@spec anomalies(t()) :: [anomaly()]

completed_results(projection)

@spec completed_results(t()) :: [SquidMesh.Runtime.DispatchProtocol.ActionAttempt.t()]

expired_claims(projection, at)

rebuild(entries)

replay(projection, entries)

@spec replay(t(), [SquidMesh.Runtime.DispatchProtocol.Entry.t()]) :: t()

results_ready_to_apply(projection)

@spec results_ready_to_apply(t()) :: [
  SquidMesh.Runtime.DispatchProtocol.ActionAttempt.t()
]

visible_attempts(projection, at)

@spec visible_attempts(t(), DateTime.t()) :: [
  SquidMesh.Runtime.DispatchProtocol.ActionAttempt.t()
]