Raxol.Payments.Checkpoint.ContextStore (Raxol Payments v0.2.0)

Copy Markdown View Source

Raxol.Payments.Checkpoint store backed by Raxol.Agent.ContextStore.

This is the recovery store for a deployed agent: the in-flight intent persists in the same durable context store that backs the agent's own crash recovery, so it survives the same restart. A payment Action that crashes mid-settlement resumes the checkpointed intent instead of re-signing.

Why a dedicated namespace

Raxol.Agent.Process saves an agent's snapshot with ContextStore.save/2, which replaces the whole entry. Storing checkpoints under the agent's own id would be clobbered on the next snapshot, so this store addresses a dedicated id, distinct from any agent id, whose entire context map is the key-to-record store.

Availability

raxol_payments depends on raxol_agent at compile time only (runtime: false). When raxol_agent is not loaded (raxol_payments used outside an agent app) the store degrades to a no-op: fetch misses, put/delete do nothing, and recovery is simply disabled -- the same as configuring no checkpoint at all.

Durability

Inherits ContextStore's durability: its ETS table survives a process crash only while owned by a process that outlives the crash. An agent app initializes the table at supervisor level, so it persists across an individual agent's restart; it does not survive a VM restart.

Summary

Functions

Build the {module, handle} store for a dedicated store_id.

Functions

new(store_id)

Build the {module, handle} store for a dedicated store_id.

store_id must be an atom distinct from any agent id (its ContextStore entry is replaced wholesale by this store, so it cannot be shared with an agent's snapshot).