ExSwan.Plug.CeremonyStore.Memory (exswan_plug v0.1.0)

Copy Markdown View Source

Deterministic in-memory ceremony store intended for tests and single-node use.

The caller supplies monotonic timestamps to make expiration tests deterministic. Use a shared transactional store when ceremonies can finish on multiple nodes.

Summary

Functions

Returns a specification to start this module under a supervisor.

Atomically consumes an entry from the named store or server process.

Stores an entry in the named store or server process.

Starts an isolated ceremony store.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

consume(server, token, now)

@spec consume(GenServer.server(), String.t(), integer()) ::
  {:ok, term()} | {:error, :not_found | :expired}

Atomically consumes an entry from the named store or server process.

put(server, token, ceremony, expires_at)

@spec put(GenServer.server(), String.t(), term(), integer()) :: :ok

Stores an entry in the named store or server process.

start_link(opts \\ [])

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

Starts an isolated ceremony store.