ClientWorkDbLockSync class
Client implementation of IWorkDb and IWorkDbSync with file-based locking on both async and sync operations.
Extends ClientWorkDbLock (which covers async locking) and additionally
protects all *Sync methods with a LockManagerSync.
Usage
final db = ClientWorkDbLockSync(IoWorkDb('./data'));
// Async operations are locked (inherited from ClientWorkDbLock)
await db.create(ItemWithId(...));
// Sync operations are also locked
db.createSync(ItemWithId(...));
Lock Configuration
final db = ClientWorkDbLockSync.withWaitingMs(
IoWorkDb('./data'),
waitingMs: 300,
);
- Inheritance
-
- Object
- ClientWorkDb
- ClientWorkDbLock
- ClientWorkDbLockSync
Constructors
- ClientWorkDbLockSync(IWorkFileSystem workDbInternal, {int? maxRecordsPerCollection})
- Creates a new ClientWorkDbLockSync with default lock settings.
- ClientWorkDbLockSync.withWaitingMs(IWorkFileSystem workDbInternal, {required int waitingMs, int? maxRecordsPerCollection})
- Creates a ClientWorkDbLockSync with custom stale lock detection timeout.
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
-
clearDatabase(
) → Future< void> -
Clears all data from the database.
inherited
-
clearDatabaseSync(
) → void -
Clears all data from the database.
inherited
-
create(
ItemWithId input) → Future< void> -
Creates a new item in the database.
inherited
-
createMultiple(
List< ItemWithId> inputs) → Future<void> -
Creates multiple items in the database.
inherited
-
createMultipleSync(
List< ItemWithId> inputs) → void -
Creates multiple items in the database.
override
-
createOrUpdate(
ItemWithId input) → Future< void> -
Creates an item if it doesn't exist, or updates it if it does.
inherited
-
createOrUpdateMultiple(
List< ItemWithId> inputs) → Future<void> -
Creates or updates multiple items in the database.
inherited
-
createOrUpdateMultipleSync(
List< ItemWithId> inputs) → void -
Creates or updates multiple items in the database.
override
-
createOrUpdateSync(
ItemWithId input) → void -
Creates an item if it doesn't exist, or updates it if it does.
override
-
createSync(
ItemWithId input) → void -
Creates a new item in the database.
override
-
delete(
ItemId input) → Future< void> -
Deletes an item from the database.
inherited
-
deleteCollection(
String collection) → Future< void> -
Deletes an entire collection from the database.
inherited
-
deleteCollectionSync(
String collection) → void -
Deletes an entire collection from the database.
inherited
-
deleteSync(
ItemId input) → void -
Deletes an item from the database.
override
-
getCollections(
) → Future< List< String> > -
Returns a list of all collection names in the database.
inherited
-
getCollectionsSync(
) → List< String> -
Returns a list of all collection names in the database.
inherited
-
getItemsInCollection(
String collection) → Future< List< String> > -
Returns a list of all item IDs in a collection.
inherited
-
getItemsInCollectionSync(
String collection) → List< String> -
Returns a list of all item IDs in a collection.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
retrieve(
ItemId input) → Future< ItemOutput?> -
Retrieves an item from the database.
inherited
-
retrieveMultiple(
List< ItemId> ids) → Future<List< ItemOutput?> > -
Retrieves multiple items from the database.
inherited
-
retrieveMultipleSync(
List< ItemId> ids) → List<ItemOutput?> -
Retrieves multiple items from the database.
inherited
-
retrieveSync(
ItemId input) → ItemOutput? -
Retrieves an item from the database.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
ItemWithId input) → Future< void> -
Updates an existing item in the database.
inherited
-
updateSync(
ItemWithId input) → void -
Updates an existing item in the database.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited