Excessibility.TelemetryCapture.SnapshotStore (Excessibility v0.19.0)

Copy Markdown View Source

Owns the :excessibility_snapshots ETS table so its lifetime is decoupled from any single test process.

ETS tables are destroyed when their owner process dies. Previously the table was created by whichever process first called Excessibility.TelemetryCapture.attach/0 — a test process. When that process finished (or another test's attach/0 saw the table still owned by a previous, mid-teardown test process and therefore skipped creation), the table could vanish out from under a test still writing to it, surfacing intermittently as ArgumentError: the table identifier does not refer to an existing ETS table and a missing timeline.json.

A dedicated, long-lived owner process holds the table for the whole VM/test run, so its existence no longer depends on test scheduling. The table stays :public, so every process reads and writes it exactly as before.

Summary

Functions

Returns a specification to start this module under a supervisor.

Idempotently ensure the owner process (and therefore the ETS table) exist.

The name of the ETS table this store owns.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

ensure_started()

Idempotently ensure the owner process (and therefore the ETS table) exist.

Safe to call from any process, concurrently: the named GenServer.start/3 is atomic, so exactly one owner is created and every other caller observes it as already started.

table()

The name of the ETS table this store owns.