Implements immutable, bounded storage for compact flight-recorder values.
History rejects stale sequences, starts a new segment across sequence gaps, and enforces age, count, and estimated-byte limits on every append. It never stores historical runtime snapshots.
Summary
Functions
Appends one committed frame plus bounded lifecycle events.
Appends direct lifecycle events to the current segment under every history bound.
Creates empty history under validated recorder configuration.
Removes expired values and reapplies all hard limits at the supplied monotonic time.
Returns scalar usage and omission counters for recorder health reporting.
Types
@type size_estimator() :: (map() -> non_neg_integer())
@type t() :: %BeamConsole.Recorder.History{ config: BeamConsole.Recorder.Config.t(), dropped_events: non_neg_integer(), dropped_frames: non_neg_integer(), estimated_bytes: non_neg_integer(), events: [BeamConsole.Lifecycle.Event.t()], frames: [BeamConsole.Recorder.Frame.t()], last_sequence: non_neg_integer() | nil, segment: non_neg_integer() }
Functions
@spec append( t(), BeamConsole.Recorder.Frame.t(), [BeamConsole.Lifecycle.Event.t()], keyword() ) :: append_result()
Appends one committed frame plus bounded lifecycle events.
Duplicate or older frame sequences return {:stale, history} without
mutation. Pass reset?: true to start a new correlation segment explicitly.
Tests may inject :now_ms and a deterministic unary :size_estimator.
@spec append_events(t(), [BeamConsole.Lifecycle.Event.t()], keyword()) :: t()
Appends direct lifecycle events to the current segment under every history bound.
@spec new(BeamConsole.Recorder.Config.t()) :: t()
Creates empty history under validated recorder configuration.
Examples
iex> history = BeamConsole.Recorder.History.new()
iex> BeamConsole.Recorder.History.stats(history).frame_count
0
@spec prune(t(), integer(), size_estimator() | :default) :: t()
Removes expired values and reapplies all hard limits at the supplied monotonic time.
Returns scalar usage and omission counters for recorder health reporting.