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/lib.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/lib.rs')
-rw-r--r-- | ext/kv/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/kv/lib.rs b/ext/kv/lib.rs index 8782fbec6..f17ed55e3 100644 --- a/ext/kv/lib.rs +++ b/ext/kv/lib.rs @@ -519,7 +519,7 @@ async fn op_kv_atomic_write<DBH>( checks: Vec<V8KvCheck>, mutations: Vec<V8KvMutation>, enqueues: Vec<V8Enqueue>, -) -> Result<bool, AnyError> +) -> Result<Option<String>, AnyError> where DBH: DatabaseHandler + 'static, { @@ -585,7 +585,7 @@ where let result = db.atomic_write(atomic_write).await?; - Ok(result) + Ok(result.map(|res| hex::encode(res.versionstamp))) } // (prefix, start, end) |