ExBoxPacker.Preview.Collector (ExBoxPacker v0.2.0)

Copy Markdown View Source

In-memory store of recent packings for the ExBoxPacker.PackerPreview dev tool. Holds a bounded ring buffer and notifies subscribed Server-Sent-Events connections of new packings. Add it to your supervision tree (typically dev-only) to enable the preview.

Summary

Functions

Store a packing (payload map + summary). Async; safe to call often.

Like capture/3 but synchronous; returns the assigned packing id.

Returns a specification to start this module under a supervisor.

Full payload map for one packing id, or nil.

Recent packings, newest first — summaries only (%{id, inserted_at, label, summary}).

Subscribe the calling process to {:preview_packing, entry} messages for new packings.

Functions

capture(payload, summary, opts \\ [])

Store a packing (payload map + summary). Async; safe to call often.

capture_sync(payload, summary, opts \\ [])

Like capture/3 but synchronous; returns the assigned packing id.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get(id)

Full payload map for one packing id, or nil.

list()

Recent packings, newest first — summaries only (%{id, inserted_at, label, summary}).

start_link(opts \\ [])

subscribe()

Subscribe the calling process to {:preview_packing, entry} messages for new packings.