ExBoxPacker.Broadcast (ExBoxPacker v0.2.0)

Copy Markdown View Source

Config-driven event publisher for a live packing feed. No callbacks: when ExBoxPacker.Config.broadcast/0 is set (and absinthe is loaded), each event is published via Absinthe.Subscription.publish(endpoint, event, [{field, topic}]).

A nil topic or absent config makes every function a cheap no-op, so packing outside a broadcasting context is unaffected. A :publisher 2-arity fn in the broadcast config overrides the Absinthe path (used in tests).

Summary

Functions

box_packed(topic, box)

@spec box_packed(String.t() | nil, ExBoxPacker.Result.PackedBox.t()) :: :ok

done(topic, summary)

@spec done(String.t() | nil, map()) :: :ok

started(topic)

@spec started(String.t() | nil) :: :ok

summary(packed, leftover)

Aggregate summary for the :done event.