AttestoClient.AuthorizationTransaction.Store.ETS (AttestoClient v2.26.0)

Copy Markdown View Source

Single-node authorization transaction store backed by a private ETS table.

Start it under your application's supervisor and pass {AttestoClient.AuthorizationTransaction.Store.ETS, pid} to AttestoClient.AuthorizationCode.start/2 and AttestoClient.AuthorizationCode.callback/3. The owning GenServer serializes insert and consume operations, providing atomic single-use state. Entries expire against monotonic time and are removed lazily on access.

At :max_entries, a new transaction evicts the oldest live transaction and emits [:attesto_client, :authorization_transaction, :evicted] with %{count: 1} and %{reason: :capacity}. This keeps unauthenticated login starts from pinning the store at capacity. Applications must still rate-limit their login-start endpoint because sustained churn can evict an in-flight transaction.

This implementation is intentionally not distributed. Use a database or distributed cache adapter implementing AttestoClient.AuthorizationTransaction.Store when callbacks can reach different nodes.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

option()

@type option() :: GenServer.option() | {:max_entries, pos_integer()}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link([option()]) :: GenServer.on_start()