Cross-process handoff store for trace data captured by ExUnitJSON.Trace.Recorder.
Tracing happens inside the test process (and its tree); the JSON is emitted by
ExUnitJSON.Formatter, which runs in a separate process and only learns of a
test at :test_finished (when the test process is already dead). This module
bridges the two: a tiny registered owner process holds a named public ETS table
that recorders write to (keyed by the test's {module, name}) and the formatter
reads from.
A dedicated owner process (rather than letting the formatter own the table)
avoids an init-ordering race: a test's setup may run before the formatter's
init/1, and writing into a not-yet-created table would crash. ensure_started/0
is idempotent and safe to call from both the formatter and every traced test.
Summary
Functions
Returns a specification to start this module under a supervisor.
Drops all stored entries. Called at suite finish to bound memory against any entries left by tests that were written but never read.
Starts the store if it is not already running. Idempotent and concurrency-safe.
Stores value under key. Called by a recorder from the test process tree.
Removes and returns the value stored under key, or nil if absent.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec clear() :: :ok
Drops all stored entries. Called at suite finish to bound memory against any entries left by tests that were written but never read.
@spec ensure_started() :: :ok
Starts the store if it is not already running. Idempotent and concurrency-safe.
Stores value under key. Called by a recorder from the test process tree.
Removes and returns the value stored under key, or nil if absent.