mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-07 05:13:12 +00:00
Update dependencies
This commit is contained in:
+8
-9
@@ -17,17 +17,16 @@ garage_util = { version = "0.1.1", path = "../util" }
|
||||
garage_table = { version = "0.1.1", path = "../table" }
|
||||
garage_model = { version = "0.1.1", path = "../model" }
|
||||
|
||||
err-derive = "0.2.3"
|
||||
bytes = "0.4"
|
||||
hex = "0.3"
|
||||
err-derive = "0.3"
|
||||
bytes = "1.0"
|
||||
hex = "0.4"
|
||||
base64 = "0.13"
|
||||
log = "0.4"
|
||||
chrono = "0.4"
|
||||
md-5 = "0.9.1"
|
||||
sha2 = "0.8"
|
||||
hmac = "0.7"
|
||||
crypto-mac = "0.7"
|
||||
rand = "0.7"
|
||||
md-5 = "0.9"
|
||||
sha2 = "0.9"
|
||||
hmac = "0.10"
|
||||
crypto-mac = "0.10"
|
||||
|
||||
futures = "0.3"
|
||||
futures-util = "0.3"
|
||||
@@ -38,5 +37,5 @@ hyper = "0.14"
|
||||
url = "2.1"
|
||||
httpdate = "0.3"
|
||||
percent-encoding = "2.1.0"
|
||||
roxmltree = "0.11"
|
||||
roxmltree = "0.14"
|
||||
http-range = "0.1"
|
||||
|
||||
+7
-1
@@ -33,7 +33,7 @@ pub enum Error {
|
||||
InvalidBase64(#[error(source)] base64::DecodeError),
|
||||
|
||||
#[error(display = "Invalid XML: {}", _0)]
|
||||
InvalidXML(#[error(source)] roxmltree::Error),
|
||||
InvalidXML(String),
|
||||
|
||||
#[error(display = "Invalid header value: {}", _0)]
|
||||
InvalidHeader(#[error(source)] hyper::header::ToStrError),
|
||||
@@ -45,6 +45,12 @@ pub enum Error {
|
||||
BadRequest(String),
|
||||
}
|
||||
|
||||
impl From<roxmltree::Error> for Error {
|
||||
fn from(err: roxmltree::Error) -> Self {
|
||||
Self::InvalidXML(format!("{}", err))
|
||||
}
|
||||
}
|
||||
|
||||
impl Error {
|
||||
pub fn http_status_code(&self) -> StatusCode {
|
||||
match self {
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@ use std::sync::Arc;
|
||||
use futures::stream::*;
|
||||
use hyper::{Body, Request, Response};
|
||||
use md5::{digest::generic_array::*, Digest as Md5Digest, Md5};
|
||||
use sha2::{Digest as Sha256Digest, Sha256};
|
||||
use sha2::Sha256;
|
||||
|
||||
use garage_table::*;
|
||||
use garage_util::data::*;
|
||||
@@ -188,7 +188,7 @@ async fn read_and_put_blocks(
|
||||
let mut md5hasher = Md5::new();
|
||||
let mut sha256hasher = Sha256::new();
|
||||
md5hasher.update(&first_block[..]);
|
||||
sha256hasher.input(&first_block[..]);
|
||||
sha256hasher.update(&first_block[..]);
|
||||
|
||||
let mut next_offset = first_block.len();
|
||||
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())?;
|
||||
if let Some(block) = next_block {
|
||||
md5hasher.update(&block[..]);
|
||||
sha256hasher.input(&block[..]);
|
||||
sha256hasher.update(&block[..]);
|
||||
let block_hash = blake2sum(&block[..]);
|
||||
let block_len = block.len();
|
||||
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 data_md5sum = md5hasher.finalize();
|
||||
|
||||
let data_sha256sum = sha256hasher.result();
|
||||
let data_sha256sum = sha256hasher.finalize();
|
||||
let data_sha256sum = Hash::try_from(&data_sha256sum[..]).unwrap();
|
||||
|
||||
Ok((total_size, data_md5sum, data_sha256sum))
|
||||
|
||||
+13
-13
@@ -1,7 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use chrono::{DateTime, Duration, NaiveDateTime, Utc};
|
||||
use hmac::{Hmac, Mac};
|
||||
use hmac::{Hmac, Mac, NewMac};
|
||||
use hyper::{Body, Method, Request};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
@@ -91,8 +91,8 @@ pub async fn check_signature(
|
||||
"s3",
|
||||
)
|
||||
.ok_or_internal_error("Unable to build signing HMAC")?;
|
||||
hmac.input(string_to_sign.as_bytes());
|
||||
let signature = hex::encode(hmac.result().code());
|
||||
hmac.update(string_to_sign.as_bytes());
|
||||
let signature = hex::encode(hmac.finalize().into_bytes());
|
||||
|
||||
if authorization.signature != signature {
|
||||
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 {
|
||||
let mut hasher = Sha256::default();
|
||||
hasher.input(canonical_req.as_bytes());
|
||||
hasher.update(canonical_req.as_bytes());
|
||||
[
|
||||
"AWS4-HMAC-SHA256",
|
||||
&datetime.format(LONG_DATETIME).to_string(),
|
||||
scope_string,
|
||||
&hex::encode(hasher.result().as_slice()),
|
||||
&hex::encode(hasher.finalize().as_slice()),
|
||||
]
|
||||
.join("\n")
|
||||
}
|
||||
@@ -236,14 +236,14 @@ fn signing_hmac(
|
||||
) -> Result<HmacSha256, crypto_mac::InvalidKeyLength> {
|
||||
let secret = String::from("AWS4") + secret_key;
|
||||
let mut date_hmac = HmacSha256::new_varkey(secret.as_bytes())?;
|
||||
date_hmac.input(datetime.format(SHORT_DATE).to_string().as_bytes());
|
||||
let mut region_hmac = HmacSha256::new_varkey(&date_hmac.result().code())?;
|
||||
region_hmac.input(region.as_bytes());
|
||||
let mut service_hmac = HmacSha256::new_varkey(®ion_hmac.result().code())?;
|
||||
service_hmac.input(service.as_bytes());
|
||||
let mut signing_hmac = HmacSha256::new_varkey(&service_hmac.result().code())?;
|
||||
signing_hmac.input(b"aws4_request");
|
||||
let hmac = HmacSha256::new_varkey(&signing_hmac.result().code())?;
|
||||
date_hmac.update(datetime.format(SHORT_DATE).to_string().as_bytes());
|
||||
let mut region_hmac = HmacSha256::new_varkey(&date_hmac.finalize().into_bytes())?;
|
||||
region_hmac.update(region.as_bytes());
|
||||
let mut service_hmac = HmacSha256::new_varkey(®ion_hmac.finalize().into_bytes())?;
|
||||
service_hmac.update(service.as_bytes());
|
||||
let mut signing_hmac = HmacSha256::new_varkey(&service_hmac.finalize().into_bytes())?;
|
||||
signing_hmac.update(b"aws4_request");
|
||||
let hmac = HmacSha256::new_varkey(&signing_hmac.finalize().into_bytes())?;
|
||||
Ok(hmac)
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,9 @@ garage_model = { version = "0.1.1", path = "../model" }
|
||||
garage_api = { version = "0.1.1", path = "../api" }
|
||||
garage_web = { version = "0.1.1", path = "../web" }
|
||||
|
||||
bytes = "0.4"
|
||||
rand = "0.7"
|
||||
hex = "0.3"
|
||||
sha2 = "0.8"
|
||||
bytes = "1.0"
|
||||
rand = "0.8"
|
||||
hex = "0.4"
|
||||
log = "0.4"
|
||||
pretty_env_logger = "0.4"
|
||||
git-version = "0.3.4"
|
||||
@@ -33,7 +32,7 @@ sled = "0.34"
|
||||
|
||||
structopt = { version = "0.3", default-features = false }
|
||||
toml = "0.5"
|
||||
rmp-serde = "0.14.3"
|
||||
rmp-serde = "0.15"
|
||||
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
|
||||
|
||||
futures = "0.3"
|
||||
|
||||
@@ -17,20 +17,17 @@ garage_util = { version = "0.1.1", path = "../util" }
|
||||
garage_rpc = { version = "0.1.1", path = "../rpc" }
|
||||
garage_table = { version = "0.1.1", path = "../table" }
|
||||
|
||||
bytes = "0.4"
|
||||
rand = "0.7"
|
||||
hex = "0.3"
|
||||
sha2 = "0.8"
|
||||
arc-swap = "0.4"
|
||||
rand = "0.8"
|
||||
hex = "0.4"
|
||||
arc-swap = "1.0"
|
||||
log = "0.4"
|
||||
|
||||
sled = "0.34"
|
||||
|
||||
rmp-serde = "0.14.3"
|
||||
rmp-serde = "0.15"
|
||||
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
|
||||
serde_bytes = "0.11"
|
||||
|
||||
async-trait = "0.1.30"
|
||||
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"] }
|
||||
|
||||
+5
-7
@@ -15,22 +15,20 @@ path = "lib.rs"
|
||||
[dependencies]
|
||||
garage_util = { version = "0.1.1", path = "../util" }
|
||||
|
||||
bytes = "0.4"
|
||||
rand = "0.7"
|
||||
hex = "0.3"
|
||||
sha2 = "0.8"
|
||||
arc-swap = "0.4"
|
||||
bytes = "1.0"
|
||||
hex = "0.4"
|
||||
arc-swap = "1.0"
|
||||
gethostname = "0.2"
|
||||
log = "0.4"
|
||||
|
||||
rmp-serde = "0.14.3"
|
||||
rmp-serde = "0.15"
|
||||
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
|
||||
serde_json = "1.0"
|
||||
|
||||
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-stream = {version = "0.1", features = ["net"] }
|
||||
tokio-stream = { version = "0.1", features = ["net"] }
|
||||
|
||||
http = "0.2"
|
||||
hyper = { version = "0.14", features = ["full"] }
|
||||
|
||||
@@ -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...)
|
||||
pub const MAX_REPLICATION: usize = 3;
|
||||
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct NetworkConfig {
|
||||
pub members: HashMap<UUID, NetworkConfigEntry>,
|
||||
|
||||
@@ -7,7 +7,6 @@ use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use arc_swap::ArcSwapOption;
|
||||
use bytes::IntoBuf;
|
||||
use futures::future::Future;
|
||||
use futures::stream::futures_unordered::FuturesUnordered;
|
||||
use futures::stream::StreamExt;
|
||||
@@ -333,7 +332,7 @@ impl RpcHttpClient {
|
||||
let body = hyper::body::to_bytes(resp.into_body()).await?;
|
||||
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))),
|
||||
Ok(x) => Ok(Ok(x)),
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
|
||||
use bytes::IntoBuf;
|
||||
use futures::future::Future;
|
||||
use futures_util::future::*;
|
||||
use futures_util::stream::*;
|
||||
@@ -48,7 +47,7 @@ where
|
||||
{
|
||||
let begin_time = Instant::now();
|
||||
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!(
|
||||
"Request message: {}",
|
||||
|
||||
@@ -16,19 +16,17 @@ path = "lib.rs"
|
||||
garage_util = { version = "0.1.1", path = "../util" }
|
||||
garage_rpc = { version = "0.1.1", path = "../rpc" }
|
||||
|
||||
bytes = "0.4"
|
||||
rand = "0.7"
|
||||
hex = "0.3"
|
||||
bytes = "1.0"
|
||||
rand = "0.8"
|
||||
log = "0.4"
|
||||
hexdump = "0.1"
|
||||
|
||||
sled = "0.34"
|
||||
|
||||
rmp-serde = "0.14.3"
|
||||
rmp-serde = "0.15"
|
||||
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
|
||||
serde_bytes = "0.11"
|
||||
|
||||
async-trait = "0.1.30"
|
||||
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"] }
|
||||
|
||||
+5
-6
@@ -20,7 +20,6 @@ use crate::data::*;
|
||||
use crate::replication::*;
|
||||
use crate::schema::*;
|
||||
|
||||
|
||||
// This modules partitions the data in 2**16 partitions, based on the top
|
||||
// 16 bits (two bytes) of item's partition keys' hashes.
|
||||
// It builds one Merkle tree for each of these 2**16 partitions.
|
||||
@@ -73,10 +72,7 @@ where
|
||||
F: TableSchema + 'static,
|
||||
R: TableReplication + 'static,
|
||||
{
|
||||
pub(crate) fn launch(
|
||||
background: &BackgroundRunner,
|
||||
data: Arc<TableData<F, R>>,
|
||||
) -> Arc<Self> {
|
||||
pub(crate) fn launch(background: &BackgroundRunner, data: Arc<TableData<F, R>>) -> Arc<Self> {
|
||||
let empty_node_hash = blake2sum(&rmp_to_vec_all_named(&MerkleNode::Empty).unwrap()[..]);
|
||||
|
||||
let ret = Arc::new(Self {
|
||||
@@ -132,7 +128,10 @@ where
|
||||
};
|
||||
|
||||
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![],
|
||||
};
|
||||
self.data
|
||||
|
||||
+5
-11
@@ -244,12 +244,8 @@ where
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
self.offload_partition(
|
||||
&partition.begin,
|
||||
&partition.end,
|
||||
must_exit,
|
||||
)
|
||||
.await?;
|
||||
self.offload_partition(&partition.begin, &partition.end, must_exit)
|
||||
.await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -399,9 +395,7 @@ where
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
SyncRPC::RootCkDifferent(true) => {
|
||||
VecDeque::from(vec![root_ck_key])
|
||||
}
|
||||
SyncRPC::RootCkDifferent(true) => VecDeque::from(vec![root_ck_key]),
|
||||
x => {
|
||||
return Err(Error::Message(format!(
|
||||
"Invalid respone to RootCkHash RPC: {}",
|
||||
@@ -550,7 +544,7 @@ impl SyncTodo {
|
||||
let begin = partitions[i].1;
|
||||
|
||||
let end = if i + 1 < partitions.len() {
|
||||
partitions[i+1].1
|
||||
partitions[i + 1].1
|
||||
} else {
|
||||
[0xFFu8; 32].into()
|
||||
};
|
||||
@@ -579,7 +573,7 @@ impl SyncTodo {
|
||||
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 {
|
||||
self.todo.pop()
|
||||
} else {
|
||||
|
||||
+5
-10
@@ -13,31 +13,26 @@ path = "lib.rs"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
rand = "0.7"
|
||||
hex = "0.3"
|
||||
sha2 = "0.8"
|
||||
rand = "0.8"
|
||||
hex = "0.4"
|
||||
sha2 = "0.9"
|
||||
blake2 = "0.9"
|
||||
err-derive = "0.2.3"
|
||||
err-derive = "0.3"
|
||||
log = "0.4"
|
||||
fasthash = "0.4"
|
||||
|
||||
sled = "0.34"
|
||||
|
||||
toml = "0.5"
|
||||
rmp-serde = "0.14.3"
|
||||
rmp-serde = "0.15"
|
||||
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
|
||||
serde_json = "1.0"
|
||||
chrono = "0.4"
|
||||
arc-swap = "1.2"
|
||||
|
||||
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"] }
|
||||
|
||||
http = "0.2"
|
||||
hyper = "0.14"
|
||||
rustls = "0.19"
|
||||
webpki = "0.21"
|
||||
|
||||
roxmltree = "0.11"
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ impl BackgroundRunner {
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
_ = tokio::time::sleep(Duration::from_secs(10)).fuse() => {
|
||||
_ = tokio::time::sleep(Duration::from_secs(5)).fuse() => {
|
||||
if *stop_signal_2.borrow() {
|
||||
break;
|
||||
} else {
|
||||
@@ -71,9 +71,9 @@ impl BackgroundRunner {
|
||||
// because the sending side was dropped. Exit now.
|
||||
None => break,
|
||||
},
|
||||
_ = tokio::time::sleep(Duration::from_secs(10)).fuse() => {
|
||||
_ = tokio::time::sleep(Duration::from_secs(5)).fuse() => {
|
||||
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.
|
||||
break;
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -87,9 +87,9 @@ pub fn sha256sum(data: &[u8]) -> Hash {
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.input(data);
|
||||
hasher.update(data);
|
||||
let mut hash = [0u8; 32];
|
||||
hash.copy_from_slice(&hasher.result()[..]);
|
||||
hash.copy_from_slice(&hasher.finalize()[..]);
|
||||
hash.into()
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -18,11 +18,10 @@ garage_table = { version = "0.1.1", path = "../table" }
|
||||
garage_model = { version = "0.1.1", path = "../model" }
|
||||
garage_api = { version = "0.1.1", path = "../api" }
|
||||
|
||||
err-derive = "0.2.3"
|
||||
err-derive = "0.3"
|
||||
log = "0.4"
|
||||
futures = "0.3"
|
||||
http = "0.2"
|
||||
hyper = "0.14"
|
||||
percent-encoding = "2.1.0"
|
||||
roxmltree = "0.11"
|
||||
idna = "0.2"
|
||||
|
||||
Reference in New Issue
Block a user