diff options
author | Luca Casonato <hello@lcas.dev> | 2023-03-30 20:57:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-30 20:57:21 +0200 |
commit | e888c3f534c6ce9574f1d57e5cc61573a046039e (patch) | |
tree | 3bb52d77e111142c372826bb2cfd38f49da90ef1 /ext/kv/interface.rs | |
parent | 206c593519681a024409d9dd23ef55b1d13d938f (diff) |
feat(ext/kv): return versionstamp from set/commit (#18512)
This commit updates the `Deno.Kv` API to return the new commited
versionstamp for the mutated data from `db.set` and `ao.commit`. This is
returned in the form of a `Deno.KvCommitResult` object that has a
`versionstamp` property.
Diffstat (limited to 'ext/kv/interface.rs')
-rw-r--r-- | ext/kv/interface.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/kv/interface.rs b/ext/kv/interface.rs index 6e520b9c5..31b7638b4 100644 --- a/ext/kv/interface.rs +++ b/ext/kv/interface.rs @@ -31,7 +31,10 @@ pub trait Database { options: SnapshotReadOptions, ) -> Result<Vec<ReadRangeOutput>, AnyError>; - async fn atomic_write(&self, write: AtomicWrite) -> Result<bool, AnyError>; + async fn atomic_write( + &self, + write: AtomicWrite, + ) -> Result<Option<CommitResult>, AnyError>; } /// Options for a snapshot read. @@ -304,3 +307,9 @@ impl MutationKind { } } } + +/// The result of a successful commit of an atomic write operation. +pub struct CommitResult { + /// The new versionstamp of the data that was committed. + pub versionstamp: Versionstamp, +} |