Normandy.Behaviours.SessionStore.ETS (normandy v2.2.0)

View Source

ETS-backed SessionStore — fast, in-node. A GenServer owns a private ETS table and serializes every mutation through its mailbox, so concurrent appends and forks to the same session_id cannot clobber each other. The handle is the owner pid.

One row per entry: {{:entry, session_id, id}, %Entry{}}, plus the session's head {{:head, session_id}, id}, its opaque turn state {{:turn_state, session_id}, term}, its config template {{:config_template, session_id}, template} and, while its turn is in flight, {{:inflight, session_id}}. An append writes two rows whatever the history's length; history/2 walks parent_id from the head (O(n), once per server start). fork/3 copies the chain from the fork point back to the root into the new session. The table is private to the owner; start one store per logical session space.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts a fresh ETS-backed store; returns its handle (the owner pid).

Starts an ETS-backed store.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

new(opts \\ [])

@spec new(keyword()) :: pid()

Starts a fresh ETS-backed store; returns its handle (the owner pid).

Options

  • :name (atom/0) - The ETS table's name (a label: the table is not a named table). The default value is :normandy_session_store.

start_link(opts \\ [])

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

Starts an ETS-backed store.

Options

  • :name (atom/0) - The ETS table's name (a label: the table is not a named table). The default value is :normandy_session_store.