acquireWriteLock Method

Attempt to acquire the write lock for this CloudContainer. For this to succeed:

  1. it must be connected to a CloudCache
  2. this CloudContainer must have been constructed with writeable: true
  3. the accessToken must authorize write access
  4. no other process may be holding an unexpired write lock

acquireWriteLock(user: string): void

throws exception if any of the above conditions fail

note Write locks expire after the duration specified in the durationSeconds property of the constructor argument, in case a process crashes or otherwise fails to release the lock. Calling acquireWriteLock with the lock already held resets the lock duration from the current time, so long running processes should call this method periodically to ensure their lock doesn't expire (they should also make sure their accessToken is refreshed before it expires.)

note on success, the manifest is polled before the promise resolves.

Parameter Type Description
user string An identifier of the process/user locking the CloudContainer. In the event of a write lock
collision, this string will be included in the exception string of the other process attempting to obtain a write lock.

Returns - void

Last Updated: 30 November, 2023