Skip to content

Commit e904bbe

Browse files
authored
[explainer] Fix: Disallow batch inner locks, don't ignore
The explainer incorrectly stated that batch inner locks would be ignored. They are actually disallowed and will cause an error. This commit corrects the explainer.
1 parent b8a37bd commit e904bbe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ The shared storage worklet invocation methods (`addModule`, `createWorklet`, and
153153
* `withLock`: acquire a lock on the designated resource before executing. See [Locking for modifier methods](#locking-for-modifier-methods) for details.
154154
* `window.sharedStorage.batchUpdate(methods, options)`
155155
* Execute `methods` in order. All updates within a `batchUpdate()` call are executed as a single unit of work. If any method fails, none of them will commit.
156-
* `methods` is an array of method objects defining the operations to perform. Each object must be one of the following types: `SharedStorageSetMethod`, `SharedStorageAppendMethod`, `SharedStorageDeleteMethod`, or `SharedStorageClearMethod`. Each method object's constructor accepts the same parameters as the corresponding individual method (e.g., `set`, `append`, `delete`, `clear`). Note that the `withLock` option within these methods will be ignored (for transactional behavior), but the lock for the `batchUpdate()` method itself (if specified) will be acquired.
156+
* `methods` is an array of method objects defining the operations to perform. Each object must be one of the following types: `SharedStorageSetMethod`, `SharedStorageAppendMethod`, `SharedStorageDeleteMethod`, or `SharedStorageClearMethod`. Each method object's constructor accepts the same parameters as the corresponding individual method (e.g., `set`, `append`, `delete`, `clear`). For transactional integrity, the `withLock` option within these methods is not permitted and will result in an error, but the lock for the `batchUpdate()` method itself (if specified) will be acquired.
157157
* Options include:
158158
* `withLock`: acquire a lock on the designated resource before executing. See [Locking for modifier methods](#locking-for-modifier-methods) for details.
159159
* This method, with the `withLock` option, allows multiple modifier methods to be executed atomically and mutually exclusively with other concurrent operations acquiring the same lock, enabling use cases where a website needs to maintain consistency while updating data organized across multiple keys.

0 commit comments

Comments
 (0)