UsageEventStore class

Append-only JSONL store at <dataDir>/usage-events.jsonl; ids stay monotonic across processes, and a full file is gzipped into usage-archive/ (newest 20 MB kept) instead of being cut. Writes are best-effort and never throw.

Constructors

UsageEventStore(String dataDir, {int rotateBytes = 5 * 1024 * 1024, int keepOnRotate = 5000, int archiveMaxBytes = 20 * 1024 * 1024, Duration retryAfter = const Duration(minutes: 5)})

Properties

archiveDir → String
no setter
archiveMaxBytes → int
final
dataDir → String
final
hashCode → int
The hash code for this object.
no setterinherited
keepOnRotate → int
Newest lines that stay in the live file after a rotation, so reports keep their window and ids keep counting up.
final
lastId ↔ int
Highest id present in the file at open time, then after each append.
getter/setter pair
path → String
no setter
retryAfter → Duration
How long a rotation that found nothing to archive, or failed, waits before reading the file again.
final
rotateBytes → int
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

append(ToolEvent event) → void
count() → int
Total persisted rows (bounded by rotation).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rowsAfterId(int afterId, {int limit = 50000}) → List<Map<String, Object?>>
Rows with id > afterId, oldest first.
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

archiveDirName → const String
fileName → const String