LogBuffer class

The Hub's log sink: a bounded, per-node tail of what nodes have reported, plus a live stream of it.

In memory, and bounded on purpose. Logs are the highest-volume thing a fleet produces, and a Hub that wrote every line of every node to disk would quietly become a log server nobody asked for — filling the disk that the audit trail and the metric history actually need. This is a tail: the last capacityPerNode lines, for looking at a node that is misbehaving right now. It is not the audit trail (which is persisted, and answers "who did what"), and it is not a substitute for shipping logs somewhere that keeps them.

Nodes have been able to push log batches since the beginning, and the Hub decoded them and threw them away. This is where they land instead.

Constructors

LogBuffer({int capacityPerNode = 500})
Creates a buffer retaining capacityPerNode lines for each node.

Properties

capacityPerNode int
How many lines are retained per node.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<LogLine>
Every line as it arrives — for tailing.
no setter

Methods

clear(String nodeId) → void
Forgets everything a node reported (it was removed, or is being replaced).
close() Future<void>
Releases the live stream.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recentFor(String nodeId, {int tail = 200}) List<LogLine>
The last tail lines from nodeId, oldest first — the order a log is read in.
record(Iterable<LogLine> lines) → void
Records lines, evicting the oldest beyond the cap.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited