A one-shot record of post-mortem artifacts we have already emitted a capsule for.
What it is
A public ETS set keyed by the artifact's sha256:... id. emit_once/2 runs
an emit only for an id not recorded yet, and records it atomically first
(:ets.insert_new/2), so two concurrent sweeps on the same dump cannot both
emit. If the emit then fails, the id is forgotten again, so the next sweep
retries it rather than treating a report that never went out as delivered.
Not persistent across BEAM restarts. That is deliberate: a fresh BEAM should re-emit the dumps it finds on disk, because the recipient of those capsules (the defect bus + subscribers) is also fresh. Persisting the seen-set would silence the exact restart-and-look-again pattern that recovers a defect an earlier BEAM's bus never got to observe.
What does persist is Mob.PostMortem.Journal: entries the OS hands over only
once (MetricKit, ApplicationExitInfo) are kept there until observed, and a
fresh BEAM re-emits them through this registry like a dump still on disk.
The table is owned by a Mob.Diag.Store owner, and the write path never
goes through a GenServer mailbox.
Summary
Functions
How many artifact ids are currently recorded.
Run emit for id unless it was already recorded, and return its result in
a list (empty when skipped or failed).
Forget id, so a later sweep emits it again.
Record id if it is not already present.
True when id has been recorded by any prior mark_seen/1.
Functions
@spec count() :: non_neg_integer()
How many artifact ids are currently recorded.
Run emit for id unless it was already recorded, and return its result in
a list (empty when skipped or failed).
A failing emit is counted as lost in Mob.Diag.health/0 and un-records
id, so an artifact still on disk is retried by the next sweep. Never raises.
@spec forget(String.t()) :: :ok
Forget id, so a later sweep emits it again.
Record id if it is not already present.
Returns true when this call is the first observation (so the caller
should emit its capsule), false when another sweep already recorded it.
If the record itself fails, returns true: a duplicate report is better
than a lost one.
True when id has been recorded by any prior mark_seen/1.