ConsolidationLockService class

Consolidation lock service — manages the lock file that tracks when the last consolidation ran, prevents concurrent consolidations, and lists sessions touched since the last one.

Constructors

ConsolidationLockService({required String getAutoMemPath(), required String getProjectDir(), required bool isProcessRunning(int pid), required Future<int?> statMtimeMs(String path), required Future<String?> readFileOrNull(String path), required Future<void> writeFile(String path, String content), required Future<void> deleteFile(String path), required Future<void> setMtime(String path, DateTime time), required Future<void> mkdirRecursive(String path), required Future<List<SessionCandidate>> listCandidates(String dir), required void logDebug(String message)})

Properties

deleteFile Future<void> Function(String path)
Delete file (no-throw if absent).
final
getAutoMemPath String Function()
Get the auto-memory root path.
final
getProjectDir String Function()
Get the transcript/project directory.
final
hashCode int
The hash code for this object.
no setterinherited
isProcessRunning bool Function(int pid)
Check if a PID is currently running.
final
listCandidates Future<List<SessionCandidate>> Function(String dir)
List session candidates in a directory.
final
logDebug → void Function(String message)
Debug logger.
final
mkdirRecursive Future<void> Function(String path)
Create directory recursively.
final
readFileOrNull Future<String?> Function(String path)
Read file as string (returns null if absent).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
setMtime Future<void> Function(String path, DateTime time)
Set file mtime (utimes).
final
statMtimeMs Future<int?> Function(String path)
File stat (returns mtimeMs, or null if absent).
final
writeFile Future<void> Function(String path, String content)
Write file.
final

Methods

listSessionsTouchedSince(int sinceMs) Future<List<String>>
Session IDs with mtime after sinceMs.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readLastConsolidatedAt() Future<int>
mtime of the lock file = lastConsolidatedAt. 0 if absent.
recordConsolidation() Future<void>
Stamp from manual /dream. Best-effort.
rollbackLock(int priorMtimeMs) Future<void>
Rewind mtime to pre-acquire after a failed fork.
toString() String
A string representation of this object.
inherited
tryAcquireLock() Future<int?>
Acquire: write PID -> mtime = now. Returns the pre-acquire mtime (for rollback), or null if blocked / lost a race.

Operators

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