HashlineSnapshotStore class final
In-memory snapshot store: a bounded set of paths, each with a short history of full-file versions so in-session edit chains can still recover against the version a stale tag names.
Recording byte-identical content again refreshes recency and reuses the existing tag (read fusion); recording new content unshifts a fresh version onto the front of the path history. Two distinct texts that collide on the short 4-hex tag are retained as separate versions so callers can still tell them apart via HashlineSnapshot.text — the tag is only a fast index, never the identity (omp issue #4075).
Constructors
- HashlineSnapshotStore({int maxPaths = _defaultMaxPaths, int maxVersionsPerPath = _defaultMaxVersionsPerPath, int maxTotalBytes = _defaultMaxTotalBytes})
- Creates a store with the given bounds.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
byContent(
String path, String fullText) → HashlineSnapshot? -
Recorded version for
pathwhose text equalsfullText, ornull. The patcher uses it on the no-drift path to attach seen-line provenance to the exact text the model read. -
byHash(
String path, String hash) → HashlineSnapshot? -
Recorded version for
pathwhose tag equalshash, ornull. When two distinct texts collide on the 16-bit tag, returns the most-recently recorded one (histories are newest-first). -
clear(
) → void - Drops every version history.
-
findByHash(
String hash) → List< HashlineSnapshot> -
Every retained version whose tag equals
hash, across all tracked paths. The patcher uses this to recover the intended file when a section names a path that does not exist on disk but carries a tag the store minted. -
head(
String path) → HashlineSnapshot? -
Most-recently recorded version for
path, ornullif none. -
invalidate(
String path) → void - Drops the version history for a single path.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
record(
String path, String fullText, [Iterable< int> ? seenLines]) → String -
Records the full normalized text of
pathand returns its content tag.seenLines(optional) are the 1-indexed lines the producer displayed; they merge into HashlineSnapshot.seenLines across reads of identical text. -
recordSeenLines(
String path, String hash, Iterable< int> lines) → void -
Merges
linesinto the seen-lines of the version ofpathwhose tag equalshash. No-op when no such version is retained. -
relocate(
String from, String to) → void -
Moves retained version history (and read provenance) from
fromtoto. No-op whenfromhas no history. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited