FileSessionPresenceStore class final

Implemented types

Constructors

FileSessionPresenceStore({required ExecutionEnv env, required String root, DateTime now()?, Duration staleAfter = const Duration(seconds: 15), Duration cleanupAfter = defaultCleanupAfter, bool? pidAlive(int pid)?})
Creates the store over root (the shared sessions root; the heartbeats live in a .presence subdirectory that never collides with the cwd-encoded session folders). now and staleAfter are injectable for tests.

Properties

cleanupAfter → Duration
How old a dead heartbeat FILE may get before the sweep deletes it (see defaultCleanupAfter).
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
staleAfter → Duration
How old a heartbeat may be before its process is considered dead.
final

Methods

list() → Future<Map<String, SessionPresence>>
The fresh presence records, keyed by session id. Stale entries (their touchedAt older than the store's staleness window) are treated as dead and never returned.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register(String sessionId, {int? pid, String? host}) → Future<void>
Announces a live process owning sessionId. Also refreshes touchedAt (a register is a touch).
override
toString() → String
A string representation of this object.
inherited
touch(String sessionId) → Future<void>
Refreshes the heartbeat for sessionId (no-op when not registered).
override
unregister(String sessionId) → Future<void>
Removes the heartbeat for sessionId (clean exit path).
override

Operators

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

Constants

defaultCleanupAfter → const Duration
How old a heartbeat file may get before list() deletes it (gh-1660): long enough that a suspended process (laptop sleep) still finds its file to resume heartbeating, short enough that crash/kill -9 garbage stays bounded. A file with a live pid is never deleted, whatever its age.