Attesto.DeviceCodeStore.ETS (Attesto v0.13.0)

Copy Markdown View Source

Single-node ETS implementation of Attesto.DeviceCodeStore.

Device-code records live in an ETS table owned by a GenServer. The state-changing callbacks (approve/2, deny/2, poll/2, consume/2) run inside GenServer.call/2, so they are serialized through the owner process — that is how this reference store gets the atomic, single-winner state transitions Attesto.DeviceCodeStore requires (a production multi-node deployment uses the Ecto store, whose transitions are single conditional UPDATE ... RETURNING statements). Reads that do not transition state (lookup_user_code/1) hit the table directly.

Start options

  • :sweep_interval_ms (default 30_000) - how often expired rows are bulk-deleted. Correctness does not depend on sweeping (redeem/4 re-checks expiry); the sweeper only bounds table size.

Wiring

children = [Attesto.DeviceCodeStore.ETS]

Summary

Functions

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()