RequestSeal.Replay behaviour (RequestSeal v0.3.0)

Copy Markdown View Source

Atomic whole-envelope replay port with caller-owned stores and commitments.

Adapters implement claim/3 and sweep/3. Claiming never evicts entries. Sweep inputs are integers from 0 through 253,402,300,799 Unix seconds. Generic and Web Bot Auth verification reject a derived retention end above that maximum with RequestSeal.Error reason :retention_exceeded at :replay before commitment or storage. Such claims cannot be swept. Direct store callers still receive the existing invalid-claim failure; Claim.valid?/1 rejects them. Negative retention ends are already expired. A single monotonic deadline covers the commitment and store operation; caller death or deadline expiry kills the operation worker. Cancellation cannot undo an already committed claim. No error permits automatic retry. Multi-node operators sweep at now - max_internode_skew to preserve claims while any verifier still accepts the authenticated input. One namespace should use one freshness bound because duplicates never extend retention.

Summary

Functions

Submit one atomic claim under a bounded operation deadline.

Callbacks

claim(term, t, t)

@callback claim(term(), RequestSeal.Replay.Claim.t(), RequestSeal.Custody.Context.t()) ::
  :claimed
  | :already_claimed
  | {:error, :unavailable | :timeout | :full | :failure}

sweep(term, .., t)

@callback sweep(term(), 0..253_402_300_799, RequestSeal.Custody.Context.t()) ::
  {:ok, non_neg_integer()} | {:error, atom()}

Functions

claim(store, claim, opts)

@spec claim(RequestSeal.Replay.Store.t(), RequestSeal.Replay.Claim.t(), keyword()) ::
  :claimed | :already_claimed | {:error, RequestSeal.Replay.Error.t()}

Submit one atomic claim under a bounded operation deadline.