aboutsummaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
Diffstat (limited to 'src/table')
-rw-r--r--src/table/Cargo.toml8
-rw-r--r--src/table/merkle.rs11
-rw-r--r--src/table/sync.rs16
3 files changed, 13 insertions, 22 deletions
diff --git a/src/table/Cargo.toml b/src/table/Cargo.toml
index 8f73470e..f9d98dec 100644
--- a/src/table/Cargo.toml
+++ b/src/table/Cargo.toml
@@ -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"] }
diff --git a/src/table/merkle.rs b/src/table/merkle.rs
index db05cca4..8a8eb342 100644
--- a/src/table/merkle.rs
+++ b/src/table/merkle.rs
@@ -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
diff --git a/src/table/sync.rs b/src/table/sync.rs
index f5c2ef33..3130abe8 100644
--- a/src/table/sync.rs
+++ b/src/table/sync.rs
@@ -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 {