JsonlSessionStorage class final
Append-only JSONL session storage on top of a FileSystem.
Ported from pi's JsonlSessionStorage.
- Implemented types
Properties
- cachedMetadata → SessionMetadata
-
The header metadata, available synchronously (it is parsed at
construction). Backs Session.cachedId.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- healedLeafEntries → int
-
no setter
- quarantinedEntries → int
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
appendEntry(
SessionRecord record) → Future< void> -
Appends
recordto the file and the in-memory index.override -
createEntryId(
) → Future< String> -
Generates a record id that is unique within this storage.
override
-
findEntries(
String type) → Future< List< SessionRecord> > -
Returns all records of the given
type, in file order.override -
getEntries(
) → Future< List< SessionRecord> > -
Returns all records in file order.
override
-
getEntry(
String id) → Future< SessionRecord?> -
Looks up a record by id.
override
-
getLabel(
String id) → Future< String?> -
Returns the current label attached to the record
id, if any.override -
getLeafId(
) → Future< String?> -
Returns the id of the active leaf record, or
nullat the tree root.override -
getMetadata(
) → Future< SessionMetadata> -
Returns the session metadata (from the file header).
override
-
getPathToRoot(
String? leafId) → Future< List< SessionRecord> > -
Walks from
leafIdto the tree root, returning records root-first.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setLeafId(
String? leafId) → Future< void> -
Persists a leaf record that moves the active leaf to
leafId.override -
toString(
) → String -
A string representation of this object.
inherited
-
withRotationLimits(
{int? rotateBytes, int? hardCapBytes}) → JsonlSessionStorage - Test/host hook: the same session state with different rotation limits (the shipped defaults ride the top-level constants).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- onRotationWarning ↔ void Function(String message)?
-
Warning sink for segment-rotation events (hard-cap truncations,
rotation fallbacks). Silent by default — the CLI wires
stderr.writelnat startup. Never throws.getter/setter pair
Static Methods
-
create(
FileSystem fs, String filePath, {required String cwd, required String sessionId, String? parentSessionPath, Map< String, dynamic> ? metadata, SessionIoRetryConfig ioRetry = const SessionIoRetryConfig()}) → Future<JsonlSessionStorage> - Creates a new session file with just the header line.
-
open(
FileSystem fs, String filePath, {SessionParseExecutor? parseExecutor, SessionIoRetryConfig ioRetry = const SessionIoRetryConfig(), SessionTimingLogger? timingLog, int maxFullOpenBytes = defaultMaxFullOpenBytes, bool wholeFileOnly = false}) → Future< JsonlSessionStorage> - Opens an existing session file.