WIP add content defined chunking #42

Closed
trinity-1686a wants to merge 42 commits from content-defined-chunking into master
18 changed files with 142 additions and 273 deletions
Showing only changes of commit f4346cc5f4 - Show all commits

254
Cargo.lock generated
View file

@ -11,12 +11,6 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "arc-swap"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8"
[[package]] [[package]]
name = "arc-swap" name = "arc-swap"
version = "1.2.0" version = "1.2.0"
@ -33,17 +27,6 @@ dependencies = [
"odds", "odds",
] ]
[[package]]
name = "async-trait"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -80,20 +63,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a5720225ef5daecf08657f23791354e1685a8c91a4c60c7f3d3b2892f978f4" checksum = "10a5720225ef5daecf08657f23791354e1685a8c91a4c60c7f3d3b2892f978f4"
dependencies = [ dependencies = [
"crypto-mac 0.8.0", "crypto-mac 0.8.0",
"digest 0.9.0", "digest",
"opaque-debug 0.3.0", "opaque-debug",
]
[[package]]
name = "block-buffer"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
dependencies = [
"block-padding",
"byte-tools",
"byteorder",
"generic-array 0.12.3",
] ]
[[package]] [[package]]
@ -102,16 +73,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [ dependencies = [
"generic-array 0.14.4", "generic-array",
]
[[package]]
name = "block-padding"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
dependencies = [
"byte-tools",
] ]
[[package]] [[package]]
@ -120,28 +82,12 @@ version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "byte-tools"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "1.4.2" version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
[[package]]
name = "bytes"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
dependencies = [
"byteorder",
"iovec",
]
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.0.1" version = "1.0.1"
@ -190,6 +136,12 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "cpuid-bool"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.2.1" version = "1.2.1"
@ -225,33 +177,24 @@ dependencies = [
"loom", "loom",
] ]
[[package]]
name = "crypto-mac"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5"
dependencies = [
"generic-array 0.12.3",
"subtle 1.0.0",
]
[[package]] [[package]]
name = "crypto-mac" name = "crypto-mac"
version = "0.8.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
dependencies = [ dependencies = [
"generic-array 0.14.4", "generic-array",
"subtle 2.4.0", "subtle",
] ]
[[package]] [[package]]
name = "digest" name = "crypto-mac"
version = "0.8.1" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6"
dependencies = [ dependencies = [
"generic-array 0.12.3", "generic-array",
"subtle",
] ]
[[package]] [[package]]
@ -260,7 +203,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [ dependencies = [
"generic-array 0.14.4", "generic-array",
] ]
[[package]] [[package]]
@ -278,9 +221,9 @@ dependencies = [
[[package]] [[package]]
name = "err-derive" name = "err-derive"
version = "0.2.4" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22deed3a8124cff5fa835713fa105621e43bbdc46690c3a6b68328a012d350d4" checksum = "dcc7f65832b62ed38939f98966824eb6294911c3629b0e9a262bfb80836d9686"
dependencies = [ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
@ -290,12 +233,6 @@ dependencies = [
"synstructure", "synstructure",
] ]
[[package]]
name = "fake-simd"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
[[package]] [[package]]
name = "fasthash" name = "fasthash"
version = "0.4.0" version = "0.4.0"
@ -458,7 +395,7 @@ dependencies = [
name = "garage" name = "garage"
version = "0.1.1" version = "0.1.1"
dependencies = [ dependencies = [
"bytes 0.4.12", "bytes",
"futures", "futures",
"futures-util", "futures-util",
"garage_api", "garage_api",
@ -471,10 +408,9 @@ dependencies = [
"hex", "hex",
"log", "log",
"pretty_env_logger", "pretty_env_logger",
"rand 0.7.3", "rand 0.8.3",
"rmp-serde", "rmp-serde",
"serde", "serde",
"sha2",
"sled", "sled",
"structopt", "structopt",
"tokio", "tokio",
@ -486,9 +422,9 @@ name = "garage_api"
version = "0.1.1" version = "0.1.1"
dependencies = [ dependencies = [
"base64", "base64",
"bytes 0.4.12", "bytes",
"chrono", "chrono",
"crypto-mac 0.7.0", "crypto-mac 0.10.0",
"err-derive", "err-derive",
"futures", "futures",
"futures-util", "futures-util",
@ -504,7 +440,6 @@ dependencies = [
"log", "log",
"md-5", "md-5",
"percent-encoding", "percent-encoding",
"rand 0.7.3",
"roxmltree", "roxmltree",
"sha2", "sha2",
"tokio", "tokio",
@ -515,9 +450,7 @@ dependencies = [
name = "garage_model" name = "garage_model"
version = "0.1.1" version = "0.1.1"
dependencies = [ dependencies = [
"arc-swap 0.4.8", "arc-swap",
"async-trait",
"bytes 0.4.12",
"futures", "futures",
"futures-util", "futures-util",
"garage_rpc", "garage_rpc",
@ -525,11 +458,10 @@ dependencies = [
"garage_util", "garage_util",
"hex", "hex",
"log", "log",
"rand 0.7.3", "rand 0.8.3",
"rmp-serde", "rmp-serde",
"serde", "serde",
"serde_bytes", "serde_bytes",
"sha2",
"sled", "sled",
"tokio", "tokio",
] ]
@ -538,8 +470,8 @@ dependencies = [
name = "garage_rpc" name = "garage_rpc"
version = "0.1.1" version = "0.1.1"
dependencies = [ dependencies = [
"arc-swap 0.4.8", "arc-swap",
"bytes 0.4.12", "bytes",
"futures", "futures",
"futures-util", "futures-util",
"garage_util", "garage_util",
@ -549,12 +481,10 @@ dependencies = [
"hyper", "hyper",
"hyper-rustls", "hyper-rustls",
"log", "log",
"rand 0.7.3",
"rmp-serde", "rmp-serde",
"rustls", "rustls",
"serde", "serde",
"serde_json", "serde_json",
"sha2",
"tokio", "tokio",
"tokio-rustls", "tokio-rustls",
"tokio-stream", "tokio-stream",
@ -565,16 +495,14 @@ dependencies = [
name = "garage_table" name = "garage_table"
version = "0.1.1" version = "0.1.1"
dependencies = [ dependencies = [
"async-trait", "bytes",
"bytes 0.4.12",
"futures", "futures",
"futures-util", "futures-util",
"garage_rpc", "garage_rpc",
"garage_util", "garage_util",
"hex",
"hexdump", "hexdump",
"log", "log",
"rand 0.7.3", "rand 0.8.3",
"rmp-serde", "rmp-serde",
"serde", "serde",
"serde_bytes", "serde_bytes",
@ -586,20 +514,17 @@ dependencies = [
name = "garage_util" name = "garage_util"
version = "0.1.1" version = "0.1.1"
dependencies = [ dependencies = [
"arc-swap 1.2.0",
"blake2", "blake2",
"chrono", "chrono",
"err-derive", "err-derive",
"fasthash", "fasthash",
"futures", "futures",
"futures-util",
"hex", "hex",
"http", "http",
"hyper", "hyper",
"log", "log",
"rand 0.7.3", "rand 0.8.3",
"rmp-serde", "rmp-serde",
"roxmltree",
"rustls", "rustls",
"serde", "serde",
"serde_json", "serde_json",
@ -625,7 +550,6 @@ dependencies = [
"idna", "idna",
"log", "log",
"percent-encoding", "percent-encoding",
"roxmltree",
] ]
[[package]] [[package]]
@ -647,15 +571,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "generic-array"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
dependencies = [
"typenum",
]
[[package]] [[package]]
name = "generic-array" name = "generic-array"
version = "0.14.4" version = "0.14.4"
@ -678,13 +593,13 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.1.16" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"wasi 0.9.0+wasi-snapshot-preview1", "wasi",
] ]
[[package]] [[package]]
@ -715,7 +630,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d832b01df74254fe364568d6ddc294443f61cbec82816b60904303af87efae78" checksum = "d832b01df74254fe364568d6ddc294443f61cbec82816b60904303af87efae78"
dependencies = [ dependencies = [
"bytes 1.0.1", "bytes",
"fnv", "fnv",
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -754,9 +669,9 @@ dependencies = [
[[package]] [[package]]
name = "hex" name = "hex"
version = "0.3.2" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]] [[package]]
name = "hexdump" name = "hexdump"
@ -770,12 +685,12 @@ dependencies = [
[[package]] [[package]]
name = "hmac" name = "hmac"
version = "0.7.1" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15"
dependencies = [ dependencies = [
"crypto-mac 0.7.0", "crypto-mac 0.10.0",
"digest 0.8.1", "digest",
] ]
[[package]] [[package]]
@ -784,7 +699,7 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747"
dependencies = [ dependencies = [
"bytes 1.0.1", "bytes",
"fnv", "fnv",
"itoa", "itoa",
] ]
@ -795,7 +710,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994"
dependencies = [ dependencies = [
"bytes 1.0.1", "bytes",
"http", "http",
] ]
@ -832,7 +747,7 @@ version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7"
dependencies = [ dependencies = [
"bytes 1.0.1", "bytes",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-util", "futures-util",
@ -895,15 +810,6 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
[[package]]
name = "iovec"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.4.19" version = "0.4.19"
@ -978,9 +884,9 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15"
dependencies = [ dependencies = [
"block-buffer 0.9.0", "block-buffer",
"digest 0.9.0", "digest",
"opaque-debug 0.3.0", "opaque-debug",
] ]
[[package]] [[package]]
@ -1077,12 +983,6 @@ version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
[[package]]
name = "opaque-debug"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]] [[package]]
name = "opaque-debug" name = "opaque-debug"
version = "0.3.0" version = "0.3.0"
@ -1243,25 +1143,24 @@ dependencies = [
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.7.3" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
dependencies = [ dependencies = [
"getrandom",
"libc", "libc",
"rand_chacha", "rand_chacha",
"rand_core 0.5.1", "rand_core 0.6.2",
"rand_hc", "rand_hc",
] ]
[[package]] [[package]]
name = "rand_chacha" name = "rand_chacha"
version = "0.2.2" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [ dependencies = [
"ppv-lite86", "ppv-lite86",
"rand_core 0.5.1", "rand_core 0.6.2",
] ]
[[package]] [[package]]
@ -1281,20 +1180,20 @@ checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.5.1" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
dependencies = [ dependencies = [
"getrandom", "getrandom",
] ]
[[package]] [[package]]
name = "rand_hc" name = "rand_hc"
version = "0.2.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [ dependencies = [
"rand_core 0.5.1", "rand_core 0.6.2",
] ]
[[package]] [[package]]
@ -1360,9 +1259,9 @@ dependencies = [
[[package]] [[package]]
name = "rmp-serde" name = "rmp-serde"
version = "0.14.4" version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ce7d70c926fe472aed493b902010bccc17fa9f7284145cb8772fd22fdb052d8" checksum = "839395ef53057db96b84c9238ab29e1a13f2e5c8ec9f66bef853ab4197303924"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"rmp", "rmp",
@ -1371,9 +1270,9 @@ dependencies = [
[[package]] [[package]]
name = "roxmltree" name = "roxmltree"
version = "0.11.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5001f134077069d87f77c8b9452b690df2445f7a43f1c7ca4a1af8dd505789d" checksum = "bf58a7d05b28e14b1e8902fa04c4d5d6109f5450ef71a5e6597f66e53f541504"
dependencies = [ dependencies = [
"xmlparser", "xmlparser",
] ]
@ -1473,14 +1372,15 @@ dependencies = [
[[package]] [[package]]
name = "sha2" name = "sha2"
version = "0.8.2" version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de"
dependencies = [ dependencies = [
"block-buffer 0.7.3", "block-buffer",
"digest 0.8.1", "cfg-if 1.0.0",
"fake-simd", "cpuid-bool",
"opaque-debug 0.2.3", "digest",
"opaque-debug",
] ]
[[package]] [[package]]
@ -1561,12 +1461,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "subtle"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
[[package]] [[package]]
name = "subtle" name = "subtle"
version = "2.4.0" version = "2.4.0"
@ -1630,7 +1524,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [ dependencies = [
"libc", "libc",
"wasi 0.10.0+wasi-snapshot-preview1", "wasi",
"winapi", "winapi",
] ]
@ -1656,7 +1550,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d56477f6ed99e10225f38f9f75f872f29b8b8bd8c0b946f63345bb144e9eeda" checksum = "8d56477f6ed99e10225f38f9f75f872f29b8b8bd8c0b946f63345bb144e9eeda"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes 1.0.1", "bytes",
"libc", "libc",
"memchr", "memchr",
"mio", "mio",
@ -1707,7 +1601,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec31e5cc6b46e653cf57762f36f71d5e6386391d88a72fd6db4508f8f676fb29" checksum = "ec31e5cc6b46e653cf57762f36f71d5e6386391d88a72fd6db4508f8f676fb29"
dependencies = [ dependencies = [
"bytes 1.0.1", "bytes",
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"log", "log",
@ -1832,12 +1726,6 @@ dependencies = [
"try-lock", "try-lock",
] ]
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.10.0+wasi-snapshot-preview1" version = "0.10.0+wasi-snapshot-preview1"

View file

@ -17,17 +17,16 @@ garage_util = { version = "0.1.1", path = "../util" }
garage_table = { version = "0.1.1", path = "../table" } garage_table = { version = "0.1.1", path = "../table" }
garage_model = { version = "0.1.1", path = "../model" } garage_model = { version = "0.1.1", path = "../model" }
err-derive = "0.2.3" err-derive = "0.3"
bytes = "0.4" bytes = "1.0"
hex = "0.3" hex = "0.4"
base64 = "0.13" base64 = "0.13"
log = "0.4" log = "0.4"
chrono = "0.4" chrono = "0.4"
md-5 = "0.9.1" md-5 = "0.9"
sha2 = "0.8" sha2 = "0.9"
hmac = "0.7" hmac = "0.10"
crypto-mac = "0.7" crypto-mac = "0.10"
rand = "0.7"
futures = "0.3" futures = "0.3"
futures-util = "0.3" futures-util = "0.3"
@ -38,5 +37,5 @@ hyper = "0.14"
url = "2.1" url = "2.1"
httpdate = "0.3" httpdate = "0.3"
percent-encoding = "2.1.0" percent-encoding = "2.1.0"
roxmltree = "0.11" roxmltree = "0.14"
http-range = "0.1" http-range = "0.1"

View file

@ -33,7 +33,7 @@ pub enum Error {
InvalidBase64(#[error(source)] base64::DecodeError), InvalidBase64(#[error(source)] base64::DecodeError),
#[error(display = "Invalid XML: {}", _0)] #[error(display = "Invalid XML: {}", _0)]
InvalidXML(#[error(source)] roxmltree::Error), InvalidXML(String),
#[error(display = "Invalid header value: {}", _0)] #[error(display = "Invalid header value: {}", _0)]
InvalidHeader(#[error(source)] hyper::header::ToStrError), InvalidHeader(#[error(source)] hyper::header::ToStrError),
@ -45,6 +45,12 @@ pub enum Error {
BadRequest(String), BadRequest(String),
} }
impl From<roxmltree::Error> for Error {
fn from(err: roxmltree::Error) -> Self {
Self::InvalidXML(format!("{}", err))
}
}
impl Error { impl Error {
pub fn http_status_code(&self) -> StatusCode { pub fn http_status_code(&self) -> StatusCode {
match self { match self {

View file

@ -5,7 +5,7 @@ use std::sync::Arc;
use futures::stream::*; use futures::stream::*;
use hyper::{Body, Request, Response}; use hyper::{Body, Request, Response};
use md5::{digest::generic_array::*, Digest as Md5Digest, Md5}; use md5::{digest::generic_array::*, Digest as Md5Digest, Md5};
use sha2::{Digest as Sha256Digest, Sha256}; use sha2::Sha256;
use garage_table::*; use garage_table::*;
use garage_util::data::*; use garage_util::data::*;
@ -188,7 +188,7 @@ async fn read_and_put_blocks(
let mut md5hasher = Md5::new(); let mut md5hasher = Md5::new();
let mut sha256hasher = Sha256::new(); let mut sha256hasher = Sha256::new();
md5hasher.update(&first_block[..]); md5hasher.update(&first_block[..]);
sha256hasher.input(&first_block[..]); sha256hasher.update(&first_block[..]);
let mut next_offset = first_block.len(); let mut next_offset = first_block.len();
let mut put_curr_version_block = put_block_meta( let mut put_curr_version_block = put_block_meta(
@ -208,7 +208,7 @@ async fn read_and_put_blocks(
futures::try_join!(put_curr_block, put_curr_version_block, chunker.next())?; futures::try_join!(put_curr_block, put_curr_version_block, chunker.next())?;
if let Some(block) = next_block { if let Some(block) = next_block {
md5hasher.update(&block[..]); md5hasher.update(&block[..]);
sha256hasher.input(&block[..]); sha256hasher.update(&block[..]);
let block_hash = blake2sum(&block[..]); let block_hash = blake2sum(&block[..]);
let block_len = block.len(); let block_len = block.len();
put_curr_version_block = put_block_meta( put_curr_version_block = put_block_meta(
@ -229,7 +229,7 @@ async fn read_and_put_blocks(
let total_size = next_offset as u64; let total_size = next_offset as u64;
let data_md5sum = md5hasher.finalize(); let data_md5sum = md5hasher.finalize();
let data_sha256sum = sha256hasher.result(); let data_sha256sum = sha256hasher.finalize();
let data_sha256sum = Hash::try_from(&data_sha256sum[..]).unwrap(); let data_sha256sum = Hash::try_from(&data_sha256sum[..]).unwrap();
Ok((total_size, data_md5sum, data_sha256sum)) Ok((total_size, data_md5sum, data_sha256sum))

View file

@ -1,7 +1,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use chrono::{DateTime, Duration, NaiveDateTime, Utc}; use chrono::{DateTime, Duration, NaiveDateTime, Utc};
use hmac::{Hmac, Mac}; use hmac::{Hmac, Mac, NewMac};
use hyper::{Body, Method, Request}; use hyper::{Body, Method, Request};
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha256};
@ -91,8 +91,8 @@ pub async fn check_signature(
"s3", "s3",
) )
.ok_or_internal_error("Unable to build signing HMAC")?; .ok_or_internal_error("Unable to build signing HMAC")?;
hmac.input(string_to_sign.as_bytes()); hmac.update(string_to_sign.as_bytes());
let signature = hex::encode(hmac.result().code()); let signature = hex::encode(hmac.finalize().into_bytes());
if authorization.signature != signature { if authorization.signature != signature {
trace!("Canonical request: ``{}``", canonical_request); trace!("Canonical request: ``{}``", canonical_request);
@ -218,12 +218,12 @@ fn parse_credential(cred: &str) -> Result<(String, String), Error> {
fn string_to_sign(datetime: &DateTime<Utc>, scope_string: &str, canonical_req: &str) -> String { fn string_to_sign(datetime: &DateTime<Utc>, scope_string: &str, canonical_req: &str) -> String {
let mut hasher = Sha256::default(); let mut hasher = Sha256::default();
hasher.input(canonical_req.as_bytes()); hasher.update(canonical_req.as_bytes());
[ [
"AWS4-HMAC-SHA256", "AWS4-HMAC-SHA256",
&datetime.format(LONG_DATETIME).to_string(), &datetime.format(LONG_DATETIME).to_string(),
scope_string, scope_string,
&hex::encode(hasher.result().as_slice()), &hex::encode(hasher.finalize().as_slice()),
] ]
.join("\n") .join("\n")
} }
@ -236,14 +236,14 @@ fn signing_hmac(
) -> Result<HmacSha256, crypto_mac::InvalidKeyLength> { ) -> Result<HmacSha256, crypto_mac::InvalidKeyLength> {
let secret = String::from("AWS4") + secret_key; let secret = String::from("AWS4") + secret_key;
let mut date_hmac = HmacSha256::new_varkey(secret.as_bytes())?; let mut date_hmac = HmacSha256::new_varkey(secret.as_bytes())?;
date_hmac.input(datetime.format(SHORT_DATE).to_string().as_bytes()); date_hmac.update(datetime.format(SHORT_DATE).to_string().as_bytes());
let mut region_hmac = HmacSha256::new_varkey(&date_hmac.result().code())?; let mut region_hmac = HmacSha256::new_varkey(&date_hmac.finalize().into_bytes())?;
region_hmac.input(region.as_bytes()); region_hmac.update(region.as_bytes());
let mut service_hmac = HmacSha256::new_varkey(&region_hmac.result().code())?; let mut service_hmac = HmacSha256::new_varkey(&region_hmac.finalize().into_bytes())?;
service_hmac.input(service.as_bytes()); service_hmac.update(service.as_bytes());
let mut signing_hmac = HmacSha256::new_varkey(&service_hmac.result().code())?; let mut signing_hmac = HmacSha256::new_varkey(&service_hmac.finalize().into_bytes())?;
signing_hmac.input(b"aws4_request"); signing_hmac.update(b"aws4_request");
let hmac = HmacSha256::new_varkey(&signing_hmac.result().code())?; let hmac = HmacSha256::new_varkey(&signing_hmac.finalize().into_bytes())?;
Ok(hmac) Ok(hmac)
} }

View file

@ -21,10 +21,9 @@ garage_model = { version = "0.1.1", path = "../model" }
garage_api = { version = "0.1.1", path = "../api" } garage_api = { version = "0.1.1", path = "../api" }
garage_web = { version = "0.1.1", path = "../web" } garage_web = { version = "0.1.1", path = "../web" }
bytes = "0.4" bytes = "1.0"
rand = "0.7" rand = "0.8"
hex = "0.3" hex = "0.4"
sha2 = "0.8"
log = "0.4" log = "0.4"
pretty_env_logger = "0.4" pretty_env_logger = "0.4"
git-version = "0.3.4" git-version = "0.3.4"
@ -33,7 +32,7 @@ sled = "0.34"
structopt = { version = "0.3", default-features = false } structopt = { version = "0.3", default-features = false }
toml = "0.5" toml = "0.5"
rmp-serde = "0.14.3" rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] } serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
futures = "0.3" futures = "0.3"

View file

@ -17,20 +17,17 @@ garage_util = { version = "0.1.1", path = "../util" }
garage_rpc = { version = "0.1.1", path = "../rpc" } garage_rpc = { version = "0.1.1", path = "../rpc" }
garage_table = { version = "0.1.1", path = "../table" } garage_table = { version = "0.1.1", path = "../table" }
bytes = "0.4" rand = "0.8"
rand = "0.7" hex = "0.4"
hex = "0.3" arc-swap = "1.0"
sha2 = "0.8"
arc-swap = "0.4"
log = "0.4" log = "0.4"
sled = "0.34" sled = "0.34"
rmp-serde = "0.14.3" rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] } serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_bytes = "0.11" serde_bytes = "0.11"
async-trait = "0.1.30"
futures = "0.3" futures = "0.3"
futures-util = "0.3" futures-util = "0.3"
tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] } tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] }

View file

@ -15,22 +15,20 @@ path = "lib.rs"
[dependencies] [dependencies]
garage_util = { version = "0.1.1", path = "../util" } garage_util = { version = "0.1.1", path = "../util" }
bytes = "0.4" bytes = "1.0"
rand = "0.7" hex = "0.4"
hex = "0.3" arc-swap = "1.0"
sha2 = "0.8"
arc-swap = "0.4"
gethostname = "0.2" gethostname = "0.2"
log = "0.4" log = "0.4"
rmp-serde = "0.14.3" rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] } serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_json = "1.0" serde_json = "1.0"
futures = "0.3" futures = "0.3"
futures-util = "0.3" futures-util = "0.3"
tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] } tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] }
tokio-stream = {version = "0.1", features = ["net"] } tokio-stream = { version = "0.1", features = ["net"] }
http = "0.2" http = "0.2"
hyper = { version = "0.14", features = ["full"] } hyper = { version = "0.14", features = ["full"] }

View file

@ -22,7 +22,6 @@ const PARTITION_MASK_U16: u16 = ((1 << PARTITION_BITS) - 1) << (16 - PARTITION_B
// (most deployments use a replication factor of 3, so...) // (most deployments use a replication factor of 3, so...)
pub const MAX_REPLICATION: usize = 3; pub const MAX_REPLICATION: usize = 3;
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
pub struct NetworkConfig { pub struct NetworkConfig {
pub members: HashMap<UUID, NetworkConfigEntry>, pub members: HashMap<UUID, NetworkConfigEntry>,

View file

@ -7,7 +7,6 @@ use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use arc_swap::ArcSwapOption; use arc_swap::ArcSwapOption;
use bytes::IntoBuf;
use futures::future::Future; use futures::future::Future;
use futures::stream::futures_unordered::FuturesUnordered; use futures::stream::futures_unordered::FuturesUnordered;
use futures::stream::StreamExt; use futures::stream::StreamExt;
@ -333,7 +332,7 @@ impl RpcHttpClient {
let body = hyper::body::to_bytes(resp.into_body()).await?; let body = hyper::body::to_bytes(resp.into_body()).await?;
drop(slot); drop(slot);
match rmp_serde::decode::from_read::<_, Result<M, String>>(body.into_buf())? { match rmp_serde::decode::from_read::<_, Result<M, String>>(&body[..])? {
Err(e) => Ok(Err(Error::RemoteError(e, status))), Err(e) => Ok(Err(Error::RemoteError(e, status))),
Ok(x) => Ok(Ok(x)), Ok(x) => Ok(Ok(x)),
} }

View file

@ -4,7 +4,6 @@ use std::pin::Pin;
use std::sync::Arc; use std::sync::Arc;
use std::time::Instant; use std::time::Instant;
use bytes::IntoBuf;
use futures::future::Future; use futures::future::Future;
use futures_util::future::*; use futures_util::future::*;
use futures_util::stream::*; use futures_util::stream::*;
@ -48,7 +47,7 @@ where
{ {
let begin_time = Instant::now(); let begin_time = Instant::now();
let whole_body = hyper::body::to_bytes(req.into_body()).await?; let whole_body = hyper::body::to_bytes(req.into_body()).await?;
let msg = rmp_serde::decode::from_read::<_, M>(whole_body.into_buf())?; let msg = rmp_serde::decode::from_read::<_, M>(&whole_body[..])?;
trace!( trace!(
"Request message: {}", "Request message: {}",

View file

@ -16,19 +16,17 @@ path = "lib.rs"
garage_util = { version = "0.1.1", path = "../util" } garage_util = { version = "0.1.1", path = "../util" }
garage_rpc = { version = "0.1.1", path = "../rpc" } garage_rpc = { version = "0.1.1", path = "../rpc" }
bytes = "0.4" bytes = "1.0"
rand = "0.7" rand = "0.8"
hex = "0.3"
log = "0.4" log = "0.4"
hexdump = "0.1" hexdump = "0.1"
sled = "0.34" sled = "0.34"
rmp-serde = "0.14.3" rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] } serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_bytes = "0.11" serde_bytes = "0.11"
async-trait = "0.1.30"
futures = "0.3" futures = "0.3"
futures-util = "0.3" futures-util = "0.3"
tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] } tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] }

View file

@ -20,7 +20,6 @@ use crate::data::*;
use crate::replication::*; use crate::replication::*;
use crate::schema::*; use crate::schema::*;
// This modules partitions the data in 2**16 partitions, based on the top // This modules partitions the data in 2**16 partitions, based on the top
// 16 bits (two bytes) of item's partition keys' hashes. // 16 bits (two bytes) of item's partition keys' hashes.
// It builds one Merkle tree for each of these 2**16 partitions. // It builds one Merkle tree for each of these 2**16 partitions.
@ -73,10 +72,7 @@ where
F: TableSchema + 'static, F: TableSchema + 'static,
R: TableReplication + 'static, R: TableReplication + 'static,
{ {
pub(crate) fn launch( pub(crate) fn launch(background: &BackgroundRunner, data: Arc<TableData<F, R>>) -> Arc<Self> {
background: &BackgroundRunner,
data: Arc<TableData<F, R>>,
) -> Arc<Self> {
let empty_node_hash = blake2sum(&rmp_to_vec_all_named(&MerkleNode::Empty).unwrap()[..]); let empty_node_hash = blake2sum(&rmp_to_vec_all_named(&MerkleNode::Empty).unwrap()[..]);
let ret = Arc::new(Self { let ret = Arc::new(Self {
@ -132,7 +128,10 @@ where
}; };
let key = MerkleNodeKey { let key = MerkleNodeKey {
partition: self.data.replication.partition_of(&Hash::try_from(&k[0..32]).unwrap()), partition: self
.data
.replication
.partition_of(&Hash::try_from(&k[0..32]).unwrap()),
prefix: vec![], prefix: vec![],
}; };
self.data self.data

View file

@ -244,11 +244,7 @@ where
))); )));
} }
} else { } else {
self.offload_partition( self.offload_partition(&partition.begin, &partition.end, must_exit)
&partition.begin,
&partition.end,
must_exit,
)
.await?; .await?;
} }
@ -399,9 +395,7 @@ where
); );
return Ok(()); return Ok(());
} }
SyncRPC::RootCkDifferent(true) => { SyncRPC::RootCkDifferent(true) => VecDeque::from(vec![root_ck_key]),
VecDeque::from(vec![root_ck_key])
}
x => { x => {
return Err(Error::Message(format!( return Err(Error::Message(format!(
"Invalid respone to RootCkHash RPC: {}", "Invalid respone to RootCkHash RPC: {}",
@ -550,7 +544,7 @@ impl SyncTodo {
let begin = partitions[i].1; let begin = partitions[i].1;
let end = if i + 1 < partitions.len() { let end = if i + 1 < partitions.len() {
partitions[i+1].1 partitions[i + 1].1
} else { } else {
[0xFFu8; 32].into() [0xFFu8; 32].into()
}; };
@ -579,7 +573,7 @@ impl SyncTodo {
return None; return None;
} }
let i = rand::thread_rng().gen_range::<usize, _, _>(0, self.todo.len()); let i = rand::thread_rng().gen_range(0..self.todo.len());
if i == self.todo.len() - 1 { if i == self.todo.len() - 1 {
self.todo.pop() self.todo.pop()
} else { } else {

View file

@ -13,31 +13,26 @@ path = "lib.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
rand = "0.7" rand = "0.8"
hex = "0.3" hex = "0.4"
sha2 = "0.8" sha2 = "0.9"
blake2 = "0.9" blake2 = "0.9"
err-derive = "0.2.3" err-derive = "0.3"
log = "0.4" log = "0.4"
fasthash = "0.4" fasthash = "0.4"
sled = "0.34" sled = "0.34"
toml = "0.5" toml = "0.5"
rmp-serde = "0.14.3" rmp-serde = "0.15"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] } serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_json = "1.0" serde_json = "1.0"
chrono = "0.4" chrono = "0.4"
arc-swap = "1.2"
futures = "0.3" futures = "0.3"
futures-util = "0.3"
tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] } tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] }
http = "0.2" http = "0.2"
hyper = "0.14" hyper = "0.14"
rustls = "0.19" rustls = "0.19"
webpki = "0.21" webpki = "0.21"
roxmltree = "0.11"

View file

@ -37,7 +37,7 @@ impl BackgroundRunner {
None => break, None => break,
} }
} }
_ = tokio::time::sleep(Duration::from_secs(10)).fuse() => { _ = tokio::time::sleep(Duration::from_secs(5)).fuse() => {
if *stop_signal_2.borrow() { if *stop_signal_2.borrow() {
break; break;
} else { } else {
@ -71,9 +71,9 @@ impl BackgroundRunner {
// because the sending side was dropped. Exit now. // because the sending side was dropped. Exit now.
None => break, None => break,
}, },
_ = tokio::time::sleep(Duration::from_secs(10)).fuse() => { _ = tokio::time::sleep(Duration::from_secs(5)).fuse() => {
if *stop_signal.borrow() { if *stop_signal.borrow() {
// Nothing has been going on for 10 secs, and we are shutting // Nothing has been going on for 5 secs, and we are shutting
// down. Exit now. // down. Exit now.
break; break;
} else { } else {

View file

@ -87,9 +87,9 @@ pub fn sha256sum(data: &[u8]) -> Hash {
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha256};
let mut hasher = Sha256::new(); let mut hasher = Sha256::new();
hasher.input(data); hasher.update(data);
let mut hash = [0u8; 32]; let mut hash = [0u8; 32];
hash.copy_from_slice(&hasher.result()[..]); hash.copy_from_slice(&hasher.finalize()[..]);
hash.into() hash.into()
} }

View file

@ -18,11 +18,10 @@ garage_table = { version = "0.1.1", path = "../table" }
garage_model = { version = "0.1.1", path = "../model" } garage_model = { version = "0.1.1", path = "../model" }
garage_api = { version = "0.1.1", path = "../api" } garage_api = { version = "0.1.1", path = "../api" }
err-derive = "0.2.3" err-derive = "0.3"
log = "0.4" log = "0.4"
futures = "0.3" futures = "0.3"
http = "0.2" http = "0.2"
hyper = "0.14" hyper = "0.14"
percent-encoding = "2.1.0" percent-encoding = "2.1.0"
roxmltree = "0.11"
idna = "0.2" idna = "0.2"