TempDirLockStrategy class final
Multi-process LockStrategy that keeps the container directory strictly
single-file by placing a tiny lock file in lockDirectory (default:
Directory.systemTemp).
Every process opening the container must resolve the same lock
directory: processes with different TMPDIR values (for example a GUI
session versus a cron job, a container, or another user) would lock
different files and lose mutual exclusion. Pass an explicit
lockDirectory shared by all peers, or use the default
AdjacentLockStrategy, whose location depends only on the container path.
- Implemented types
Constructors
- TempDirLockStrategy(String targetPath, {String? lockDirectory, bool readOnly = false, Duration? timeout})
-
Creates a TempDirLockStrategy for the container at
targetPath.
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
-
close(
) → Future< void> -
Releases any lock descriptors or handles maintained by this strategy.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readGenerationSync(
) → int -
Reads the stored compaction generation (
0if uninitialized), callable while holding withSharedLock or withExclusiveLock.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
withExclusiveLock<
T> (Future< T> action()) → Future<T> -
Acquires an exclusive (writer/compactor) lock, runs
action, and releases the lock.inherited -
Acquires a shared (reader) lock, runs
action, and releases the lock.inherited -
writeGenerationSync(
int generation) → void -
Stores
generationinside the lock descriptor, callable while holding withExclusiveLock.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited