Mob.PostMortem.Registry (mob v0.8.3)

Copy Markdown View Source

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. mark_seen/1 returns true if the id was new (so a caller should emit), false if it had already been recorded. That is atomic in one ETS op — :ets.insert_new/2 — so two concurrent sweeps on the same dump cannot both emit.

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.

Same pattern as Mob.Agent.Receipts.Owner and Mob.Invariant.Owner: the table is :public and named, its lifecycle owner is unlinked, and the write path never goes through a GenServer mailbox.

Summary

Functions

How many artifact ids are currently recorded.

Record id if it is not already present.

True when id has been recorded by any prior mark_seen/1.

Functions

count()

@spec count() :: non_neg_integer()

How many artifact ids are currently recorded.

mark_seen(id)

@spec mark_seen(String.t()) :: boolean()

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.

seen?(id)

@spec seen?(String.t()) :: boolean()

True when id has been recorded by any prior mark_seen/1.