diff options
author | Heyang Zhou <zhy20000919@hotmail.com> | 2023-08-22 13:56:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 13:56:00 +0800 |
commit | 6d4a005e4108a5dd762b339a02bc4d802755ba0d (patch) | |
tree | 69679038bfbd3127f6c1e1b85dbc347c8c52e36e /ext/kv/lib.rs | |
parent | 5834d282d4de5d0b5cacb9bf068f3896bef0a48a (diff) |
feat(ext/kv): connect to remote database (#20178)
This patch adds a `remote` backend for `ext/kv`. This supports
connection to Deno Deploy and potentially other services compatible with
the KV Connect protocol.
Diffstat (limited to 'ext/kv/lib.rs')
-rw-r--r-- | ext/kv/lib.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/kv/lib.rs b/ext/kv/lib.rs index 7164a700b..f226b11ae 100644 --- a/ext/kv/lib.rs +++ b/ext/kv/lib.rs @@ -1,7 +1,10 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. pub mod codec; +pub mod dynamic; mod interface; +mod proto; +pub mod remote; pub mod sqlite; use std::borrow::Cow; @@ -285,7 +288,8 @@ where let opts = SnapshotReadOptions { consistency: consistency.into(), }; - let output_ranges = db.snapshot_read(read_ranges, opts).await?; + let output_ranges = + db.snapshot_read(state.clone(), read_ranges, opts).await?; let output_ranges = output_ranges .into_iter() .map(|x| { @@ -323,7 +327,7 @@ where resource.db.clone() }; - let mut handle = db.dequeue_next_message().await?; + let mut handle = db.dequeue_next_message(state.clone()).await?; let payload = handle.take_payload().await?.into(); let handle_rid = { let mut state = state.borrow_mut(); @@ -660,7 +664,7 @@ where enqueues, }; - let result = db.atomic_write(atomic_write).await?; + let result = db.atomic_write(state.clone(), atomic_write).await?; Ok(result.map(|res| hex::encode(res.versionstamp))) } |