AttestoClient. AuthorizationTransaction. Store behaviour
(AttestoClient v2.2.0)
Copy Markdown
View Source
Storage contract for replay-safe authorization transactions.
Both callbacks must be atomic. put_new/4 must never replace a live entry,
and take/2 must delete before returning so the same state cannot be used
twice, including under concurrent callbacks. ttl_ms is a relative lifetime
in milliseconds.
A store is represented as {module, handle}. The included
AttestoClient.AuthorizationTransaction.Store.ETS implementation uses a
supervised process as the handle.
Summary
Types
Callbacks
@callback put_new( handle(), String.t(), AttestoClient.AuthorizationTransaction.t(), pos_integer() ) :: :ok | {:error, :already_exists | term()}
@callback take(handle(), String.t()) :: {:ok, AttestoClient.AuthorizationTransaction.t()} | {:error, :not_found | :expired | term()}