CloudSqlite.withWriteLock Function
Perform an asynchronous write operation on a CloudContainer with the write lock held.
- if write lock is already held, call operation and return.
- attempt to acquire the write lock, with retries. Throw if unable to obtain write lock.
- perform the operation
3.a if the operation throws, abandon all changes and re-throw 4. release the write lock. 5. return value from operation
withWriteLock<T>(user: string, container: CloudSqlite.CloudContainer, operation: () => T, busyHandler?: CloudSqlite.WriteLockBusyHandler): Promise<T>
Parameter | Type | Description |
---|---|---|
user | string | the name to be displayed to other users in the event they attempt to obtain the lock while it is held by us |
container | CloudSqlite.CloudContainer | the CloudContainer for which the lock is to be acquired |
operation | () => T | an asynchronous operation performed with the write lock held. |
busyHandler | CloudSqlite.WriteLockBusyHandler | if present, function called when the write lock is currently held by another user. |
Returns - Promise<T>
a Promise with the result of operation
Defined in
- backend/src/CloudSqlite.ts Line 448
Last Updated: 20 June, 2023