From 2d9298f5f5550c21ba218ff7095aa9afe80c7e02 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Tue, 31 Oct 2023 12:13:57 +0100 Subject: chore: update ext/kv to use denokv_* crates (#20986) This commit updates the ext/kv module to use the denokv_* crates for the protocol and the sqlite backend. This also fixes a couple of bugs in the sqlite backend, and updates versionstamps to be updated less linearly. --- runtime/build.rs | 2 +- runtime/errors.rs | 4 ++++ runtime/web_worker.rs | 14 +++++++++++++- runtime/worker.rs | 10 ++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/build.rs b/runtime/build.rs index dec687b6e..ce1896e6f 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -222,7 +222,7 @@ mod startup_snapshot { deno_tls::deno_tls::init_ops_and_esm(), deno_kv::deno_kv::init_ops_and_esm(deno_kv::sqlite::SqliteDbHandler::< Permissions, - >::new(None)), + >::new(None, None)), deno_napi::deno_napi::init_ops_and_esm::(), deno_http::deno_http::init_ops_and_esm::(), deno_io::deno_io::init_ops_and_esm(Default::default()), diff --git a/runtime/errors.rs b/runtime/errors.rs index e6ae14abb..47925fe5c 100644 --- a/runtime/errors.rs +++ b/runtime/errors.rs @@ -211,6 +211,10 @@ pub fn get_error_class_name(e: &AnyError) -> Option<&'static str> { e.downcast_ref::() .map(get_url_parse_error_class) }) + .or_else(|| { + e.downcast_ref::() + .map(|_| "TypeError") + }) .or_else(|| { #[cfg(unix)] let maybe_get_nix_error_class = diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index c1fe5a619..de69ce43b 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -436,7 +436,19 @@ impl WebWorker { ), deno_tls::deno_tls::init_ops_and_esm(), deno_kv::deno_kv::init_ops_and_esm( - MultiBackendDbHandler::remote_or_sqlite::(None), + MultiBackendDbHandler::remote_or_sqlite::( + None, + options.seed, + deno_kv::remote::HttpOptions { + user_agent: options.bootstrap.user_agent.clone(), + root_cert_store_provider: options.root_cert_store_provider.clone(), + unsafely_ignore_certificate_errors: options + .unsafely_ignore_certificate_errors + .clone(), + client_cert_chain_and_key: None, + proxy: None, + }, + ), ), deno_napi::deno_napi::init_ops_and_esm::(), deno_http::deno_http::init_ops_and_esm::(), diff --git a/runtime/worker.rs b/runtime/worker.rs index e8d9ca6bc..f0fc25aa2 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -261,6 +261,16 @@ impl MainWorker { deno_kv::deno_kv::init_ops_and_esm( MultiBackendDbHandler::remote_or_sqlite::( options.origin_storage_dir.clone(), + options.seed, + deno_kv::remote::HttpOptions { + user_agent: options.bootstrap.user_agent.clone(), + root_cert_store_provider: options.root_cert_store_provider.clone(), + unsafely_ignore_certificate_errors: options + .unsafely_ignore_certificate_errors + .clone(), + client_cert_chain_and_key: None, + proxy: None, + }, ), ), deno_napi::deno_napi::init_ops_and_esm::(), -- cgit v1.2.3