ProjectLock class final

One change at a time per project: an install, an edit, an upgrade.

The lock is a file in JustProject.workDir, made exclusively, naming its holder: the process id, where it runs (the machine, the system and, on Linux, the pid namespace and boot) and a random token. While it is held it is touched every heartbeat; one left untouched for stale belongs to a holder that died, and is taken over — at once when its holder ran here and is no longer running. Only its holder's release removes it.

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
release() → void
Lets the next change in: removes the lock, if it is still this one.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

acquire(JustProject project) → ProjectLock
Takes the lock on project. Throws ProjectBusyException when another change holds it, naming the holder, the lock file and when it goes stale.
tryAcquire(JustProject project) → ProjectLock?
Takes the lock on project, or returns null when another change holds it. Throws a FileSystemException when the lock can't be made at all (a read-only folder, a path too long).

Constants

heartbeat → const Duration
How often a held lock is touched.
path → const String
Where the lock lives in a project.
stale → const Duration
How long a lock may go untouched before it counts as left by a crash.