mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
chore(ext/kv): update denokv crates (#21357)
This commit is contained in:
parent
32c041c8d7
commit
75ec650f08
4 changed files with 17 additions and 14 deletions
13
Cargo.lock
generated
13
Cargo.lock
generated
|
@ -1704,9 +1704,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "denokv_proto"
|
||||
version = "0.2.1"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8952fb8c38c1dcd796d49b00030afb74aa184160ae86817b72a32a994c8e16f0"
|
||||
checksum = "dd501a6b10a8b7fe7e605cafe4aad1d266ed0791b788dab78889df14b1a23e5f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
@ -1720,9 +1720,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "denokv_remote"
|
||||
version = "0.2.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edfc8447324d783b01e215bd5040ff9149c34d9715c7b7b5080dd648ebf1148a"
|
||||
checksum = "7d94fd3da7d1fa9ef1515bf3bc5b2fe75389edb3f15e9445e345679fda44987c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
@ -1742,9 +1742,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "denokv_sqlite"
|
||||
version = "0.2.1"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ec76b691ff069f14e56e3e053c2b2163540b27e4b60179f2b120064a7e4960d"
|
||||
checksum = "c2d2ab5fe45079dc41ab76549bb9fc3aeb9be4e54fddbdfb16a779db4a0b38df"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
@ -1756,6 +1756,7 @@ dependencies = [
|
|||
"rand",
|
||||
"rusqlite",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"uuid",
|
||||
]
|
||||
|
|
|
@ -49,10 +49,10 @@ test_util = { path = "./test_util" }
|
|||
deno_lockfile = "0.17.2"
|
||||
deno_media_type = { version = "0.1.1", features = ["module_specifier"] }
|
||||
|
||||
denokv_proto = "0.2.1"
|
||||
denokv_proto = "0.4.0"
|
||||
# denokv_sqlite brings in bundled sqlite if we don't disable the default features
|
||||
denokv_sqlite = { default-features = false, version = "0.2.1" }
|
||||
denokv_remote = "0.2.3"
|
||||
denokv_sqlite = { default-features = false, version = "0.4.0" }
|
||||
denokv_remote = "0.4.0"
|
||||
|
||||
# exts
|
||||
deno_broadcast_channel = { version = "0.119.0", path = "./ext/broadcast_channel" }
|
||||
|
|
|
@ -18,7 +18,7 @@ use deno_core::error::AnyError;
|
|||
use deno_core::unsync::spawn_blocking;
|
||||
use deno_core::OpState;
|
||||
use deno_node::PathClean;
|
||||
pub use denokv_sqlite::TypeError;
|
||||
pub use denokv_sqlite::SqliteBackendError;
|
||||
use rand::RngCore;
|
||||
use rand::SeedableRng;
|
||||
use rusqlite::OpenFlags;
|
||||
|
@ -95,14 +95,16 @@ impl<P: SqliteDbHandlerPermissions> DatabaseHandler for SqliteDbHandler<P> {
|
|||
(Some(path), _) => {
|
||||
let flags =
|
||||
OpenFlags::default().difference(OpenFlags::SQLITE_OPEN_URI);
|
||||
let resolved_path = canonicalize_path(&PathBuf::from(path))?;
|
||||
let resolved_path = canonicalize_path(&PathBuf::from(path))
|
||||
.map_err(|_| SqliteBackendError::DatabaseClosed)?;
|
||||
(
|
||||
rusqlite::Connection::open_with_flags(path, flags)?,
|
||||
Some(resolved_path),
|
||||
)
|
||||
}
|
||||
(None, Some(path)) => {
|
||||
std::fs::create_dir_all(path)?;
|
||||
std::fs::create_dir_all(path)
|
||||
.map_err(|_| SqliteBackendError::DatabaseClosed)?;
|
||||
let path = path.join("kv.sqlite3");
|
||||
(rusqlite::Connection::open(path.clone())?, Some(path))
|
||||
}
|
||||
|
@ -110,7 +112,7 @@ impl<P: SqliteDbHandlerPermissions> DatabaseHandler for SqliteDbHandler<P> {
|
|||
|
||||
conn.pragma_update(None, "journal_mode", "wal")?;
|
||||
|
||||
Ok::<_, AnyError>((conn, queue_waker_key))
|
||||
Ok::<_, SqliteBackendError>((conn, queue_waker_key))
|
||||
})
|
||||
})
|
||||
.await
|
||||
|
|
|
@ -212,7 +212,7 @@ pub fn get_error_class_name(e: &AnyError) -> Option<&'static str> {
|
|||
.map(get_url_parse_error_class)
|
||||
})
|
||||
.or_else(|| {
|
||||
e.downcast_ref::<deno_kv::sqlite::TypeError>()
|
||||
e.downcast_ref::<deno_kv::sqlite::SqliteBackendError>()
|
||||
.map(|_| "TypeError")
|
||||
})
|
||||
.or_else(|| {
|
||||
|
|
Loading…
Reference in a new issue