Function

swap

Conditionally and atomically set key to value if every precondition in options holds.

Returns cas-result::swapped on success, or cas-result::stale with the current entry if a precondition fails. A lost race is the expected stale outcome, not an error. options must set at least one precondition; an empty cas-options returns err(error::invalid-argument) rather than performing an unconditional write. Other err(error) values are store-level failures.

swap: async func(bucket: borrow​<bucket>, key: string, value: list​<u8>, options: cas-options) -> result​<cas-result, error>;