CloudSqlite.withWriteLock Function

Perform an asynchronous write operation on a CloudContainer with the write lock held.

  1. if write lock is already held by the current user, refresh write lock's expiry time, call operation and return.
  2. attempt to acquire the write lock, with retries. Throw if unable to obtain write lock.
  3. 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>(args: { busyHandler?: CloudSqlite.WriteLockBusyHandler, container: CloudSqlite.CloudContainer, user: string }, operation: () => Promise<T>): Promise<T>

@returns a Promise with the result of operation

Parameter Type Description
args { busyHandler?: CloudSqlite.WriteLockBusyHandler, container: CloudSqlite.CloudContainer, user: string }  
operation () => Promise<T> an asynchronous operation performed with the write lock held.

Returns - Promise<T>

a Promise with the result of operation

Defined in

Last Updated: 17 December, 2024