X402.AuthCapture.ETSStore (X402 v0.9.0)

Copy Markdown View Source

Volatile, serialized auth-capture store for development and tests.

A dedicated owner serializes mutations over a private ETS table. There is no TTL, takeover, or eviction. Losing the owner loses all records and is unsafe once payments exist. Do not restart an empty store against funded payments. Production applications must implement X402.AuthCapture.Store with shared, durable storage instead.

Summary

Functions

Returns a specification to start this module under a supervisor.

Reads one record from the owner.

Starts a private store. The optional :name must be an atom.

Serializes a mutation; callback failure leaves the previous record intact.

Serializes a multi-record snapshot and applies its selected writes atomically.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

fetch(server, key)

(since 0.9.0)
@spec fetch(GenServer.server(), term()) :: {:ok, X402.AuthCapture.Store.value()}

Reads one record from the owner.

start_link(opts \\ [])

(since 0.9.0)
@spec start_link(keyword()) ::
  GenServer.on_start() | {:error, NimbleOptions.ValidationError.t()}

Starts a private store. The optional :name must be an atom.

transact(server, key, mutation)

(since 0.9.0)
@spec transact(GenServer.server(), term(), X402.AuthCapture.Store.mutation()) ::
  {:ok, term()} | {:error, term()}

Serializes a mutation; callback failure leaves the previous record intact.

transact_many(server, keys, mutation)

(since 0.9.0)
@spec transact_many(
  GenServer.server(),
  [term()],
  X402.AuthCapture.Store.multi_mutation()
) ::
  {:ok, term()} | {:error, term()}

Serializes a multi-record snapshot and applies its selected writes atomically.