Record
cas-options
Preconditions for a swap. Every condition that is set must hold for the write to be
applied. At least one condition must be set: a swap with an empty cas-options is a
misuse and is rejected with error::invalid-argument (use store.set for an unconditional
write).
record cas-options {
require-version: option<version>,
require-value: option<list<u8>>,
}Fields
| Name | Type | Description |
|---|---|---|
| require-version | option<version> | Require the entry's current version to equal this. This is the ABA-safe check: it detects a value that changed A -> B -> A, which a value comparison misses. Omit it if you do not care about ABA. |
| require-value | option<list<u8>> | Require the entry's current value to equal this. A version-free optimistic check: simpler, but ABA-prone. Omit to skip. |