Skip to main content

commit

method Deno.AtomicOperation.prototype.commit
Jump to headingAtomicOperation.prototype.commit(): Promise<KvCommitResult | KvCommitError>

Commit the operation to the KV store. Returns a value indicating whether checks passed and mutations were performed. If the operation failed because of a failed check, the return value will be a Deno.KvCommitError with an ok: false property. If the operation failed for any other reason (storage error, invalid value, etc.), an exception will be thrown. If the operation succeeded, the return value will be a Deno.KvCommitResult object with a ok: true property and the versionstamp of the value committed to KV.

If the commit returns ok: false, one may create a new atomic operation with updated checks and mutations and attempt to commit it again. See the note on optimistic locking in the documentation for Deno.AtomicOperation.

Return Type Jump to heading

Back to top