LockManagerSync class
Synchronous file-based implementation of ILockManagerSync.
Lock files are stored in a parallel directory structure:
- Data:
./WorkDB/collection/item - Lock:
./WorkDBLocks/collection/item.lock
Usage
final lockManager = LockManagerSync(fileSystem);
if (lockManager.tryAcquireSync('users/user-1')) {
try {
// perform operation
} finally {
lockManager.releaseSync('users/user-1');
}
}
- Implemented types
Constructors
- LockManagerSync(IWorkFileSystemSync _fs, [int _waitingMs = 0])
- Creates a new LockManagerSync.
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
-
clearAllLocksSync(
) → void -
Clears all locks synchronously.
override
-
isLockedSync(
String documentPath) → bool -
Checks if a document is currently locked synchronously.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
releaseSync(
String documentPath) → void -
Releases the lock on the document synchronously.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
tryAcquireSync(
String documentPath) → bool -
Attempts to acquire a lock on the document synchronously.
override
-
tryAcquireThrowSync(
String documentPath) → void - Attempts to acquire a lock synchronously, throwing if already locked.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited