Skip to content

Commit

Permalink
Replace Sha256 with Blake3 in DedupStore
Browse files Browse the repository at this point in the history
We switch from Sha256 to Blake3 due to its faster speed. The
DedupStore code has no direct connection to any external Api so
it's safe to change the hash function without affecting clients.
  • Loading branch information
allada committed Jul 21, 2023
1 parent 656e7f7 commit b30dfce
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 20 deletions.
194 changes: 192 additions & 2 deletions Cargo.Bazel.lock
@@ -1,5 +1,5 @@
{
"checksum": "eebd7d004f166798f8703ec28b174b9e0408e4978ce9d8885b9f67e0e53fedde",
"checksum": "461c6fc060010e68f913e54c1f63f256f3ff70f1bb37216541fd347b5f56be53",
"crates": {
"addr2line 0.20.0": {
"name": "addr2line",
Expand Down Expand Up @@ -599,6 +599,66 @@
},
"license": "MIT OR Apache-2.0"
},
"arrayref 0.3.7": {
"name": "arrayref",
"version": "0.3.7",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/arrayref/0.3.7/download",
"sha256": "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545"
}
},
"targets": [
{
"Library": {
"crate_name": "arrayref",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "arrayref",
"common_attrs": {
"compile_data_glob": [
"**"
],
"edition": "2015",
"version": "0.3.7"
},
"license": "BSD-2-Clause"
},
"arrayvec 0.7.4": {
"name": "arrayvec",
"version": "0.7.4",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/arrayvec/0.7.4/download",
"sha256": "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
}
},
"targets": [
{
"Library": {
"crate_name": "arrayvec",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "arrayvec",
"common_attrs": {
"compile_data_glob": [
"**"
],
"edition": "2018",
"version": "0.7.4"
},
"license": "MIT OR Apache-2.0"
},
"async-lock 2.7.0": {
"name": "async-lock",
"version": "2.7.0",
Expand Down Expand Up @@ -1276,6 +1336,96 @@
},
"license": "MIT OR Apache-2.0"
},
"blake3 1.4.1": {
"name": "blake3",
"version": "1.4.1",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/blake3/1.4.1/download",
"sha256": "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5"
}
},
"targets": [
{
"Library": {
"crate_name": "blake3",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
},
{
"BuildScript": {
"crate_name": "build_script_build",
"crate_root": "build.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "blake3",
"common_attrs": {
"compile_data_glob": [
"**"
],
"crate_features": {
"common": [
"default",
"digest",
"std"
],
"selects": {}
},
"deps": {
"common": [
{
"id": "arrayref 0.3.7",
"target": "arrayref"
},
{
"id": "arrayvec 0.7.4",
"target": "arrayvec"
},
{
"id": "blake3 1.4.1",
"target": "build_script_build"
},
{
"id": "cfg-if 1.0.0",
"target": "cfg_if"
},
{
"id": "constant_time_eq 0.3.0",
"target": "constant_time_eq"
},
{
"id": "digest 0.10.7",
"target": "digest"
}
],
"selects": {}
},
"edition": "2021",
"version": "1.4.1"
},
"build_script_attrs": {
"data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "cc 1.0.79",
"target": "cc"
}
],
"selects": {}
}
},
"license": "CC0-1.0 OR Apache-2.0"
},
"block-buffer 0.10.4": {
"name": "block-buffer",
"version": "0.10.4",
Expand Down Expand Up @@ -1854,6 +2004,36 @@
},
"license": "MIT OR Apache-2.0"
},
"constant_time_eq 0.3.0": {
"name": "constant_time_eq",
"version": "0.3.0",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/constant_time_eq/0.3.0/download",
"sha256": "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2"
}
},
"targets": [
{
"Library": {
"crate_name": "constant_time_eq",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "constant_time_eq",
"common_attrs": {
"compile_data_glob": [
"**"
],
"edition": "2021",
"version": "0.3.0"
},
"license": "CC0-1.0 OR MIT-0 OR Apache-2.0"
},
"core-foundation 0.9.3": {
"name": "core-foundation",
"version": "0.9.3",
Expand Down Expand Up @@ -2240,7 +2420,9 @@
"block-buffer",
"core-api",
"default",
"std"
"mac",
"std",
"subtle"
],
"selects": {}
},
Expand All @@ -2253,6 +2435,10 @@
{
"id": "crypto-common 0.1.6",
"target": "crypto_common"
},
{
"id": "subtle 2.4.1",
"target": "subtle"
}
],
"selects": {}
Expand Down Expand Up @@ -2565,6 +2751,10 @@
"id": "bincode 1.3.3",
"target": "bincode"
},
{
"id": "blake3 1.4.1",
"target": "blake3"
},
{
"id": "byteorder 1.4.3",
"target": "byteorder"
Expand Down
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -61,6 +61,7 @@ hyper = "0.14.27"
axum = "0.6.18"
tower = "0.4.13"
prometheus-client = "0.21.2"
blake3 = "1.4.1"

[dev-dependencies]
stdext = "0.3.1"
Expand Down
2 changes: 1 addition & 1 deletion cas/store/BUILD
Expand Up @@ -175,7 +175,7 @@ rust_library(
"@crate_index//:bincode",
"@crate_index//:futures",
"@crate_index//:serde",
"@crate_index//:sha2",
"@crate_index//:blake3",
"@crate_index//:tokio",
"@crate_index//:tokio-util",
],
Expand Down

0 comments on commit b30dfce

Please sign in to comment.