summaryrefslogtreecommitdiff
path: root/cli/cache/common.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-05-29 14:38:18 -0400
committerGitHub <noreply@github.com>2024-05-29 18:38:18 +0000
commit94f040ac2867706d261e2fe1ec8bc2c4263eb6ab (patch)
tree5eaed4d41efd8d25da839bc29b8d32554e1a0fca /cli/cache/common.rs
parentfada25b0dd593efee496dabb48ed9cb7a9cb6647 (diff)
fix: bump cache sqlite dbs to v2 for WAL journal mode change (#24030)
In https://github.com/denoland/deno/pull/23955 we changed the sqlite db journal mode to WAL. This causes issues when someone is running an old version of Deno using TRUNCATE and a new version because the two fight against each other.
Diffstat (limited to 'cli/cache/common.rs')
-rw-r--r--cli/cache/common.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/cli/cache/common.rs b/cli/cache/common.rs
index 3e7c4885b..a88ef8c97 100644
--- a/cli/cache/common.rs
+++ b/cli/cache/common.rs
@@ -3,16 +3,17 @@
use std::hash::Hasher;
/// A very fast insecure hasher that uses the xxHash algorithm.
-#[derive(Default)]
pub struct FastInsecureHasher(twox_hash::XxHash64);
impl FastInsecureHasher {
- pub fn new() -> Self {
- Self::default()
+ pub fn new_without_deno_version() -> Self {
+ Self(Default::default())
}
- pub fn hash(hashable: impl std::hash::Hash) -> u64 {
- Self::new().write_hashable(hashable).finish()
+ pub fn new_deno_versioned() -> Self {
+ let mut hasher = Self::new_without_deno_version();
+ hasher.write_str(crate::version::deno());
+ hasher
}
pub fn write_str(&mut self, text: &str) -> &mut Self {