aboutsummaryrefslogtreecommitdiff
path: root/src/table/merkle.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-04-05 19:55:53 +0200
committerAlex Auvolat <alex@adnab.me>2021-04-27 16:37:08 +0200
commit9ced9f78dcc3894b3c2f13b8a95653f990278f03 (patch)
tree00b5180edcfab392eef203f594edb1332ccfce5d /src/table/merkle.rs
parent3a449badb125b4f5bf0497639745a583bc949da2 (diff)
downloadgarage-9ced9f78dcc3894b3c2f13b8a95653f990278f03.tar.gz
garage-9ced9f78dcc3894b3c2f13b8a95653f990278f03.zip
Improve bootstraping: do it regularly; persist peer list
Diffstat (limited to 'src/table/merkle.rs')
-rw-r--r--src/table/merkle.rs23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/table/merkle.rs b/src/table/merkle.rs
index 3001786f..39b87aa1 100644
--- a/src/table/merkle.rs
+++ b/src/table/merkle.rs
@@ -200,12 +200,13 @@ where
let subnode = self.read_node_txn(tx, &key_sub)?;
match subnode {
MerkleNode::Empty => {
- warn!("({}) Single subnode in tree is empty Merkle node", self.data.name);
+ warn!(
+ "({}) Single subnode in tree is empty Merkle node",
+ self.data.name
+ );
Some(MerkleNode::Empty)
}
- MerkleNode::Intermediate(_) => {
- Some(MerkleNode::Intermediate(children))
- }
+ MerkleNode::Intermediate(_) => Some(MerkleNode::Intermediate(children)),
x @ MerkleNode::Leaf(_, _) => {
tx.remove(key_sub.encode())?;
Some(x)
@@ -239,14 +240,24 @@ where
{
let exlf_subkey = key.next_key(&exlf_khash);
- let exlf_sub_hash = self.update_item_rec(tx, &exlf_k[..], &exlf_khash, &exlf_subkey, Some(exlf_vhash))?.unwrap();
+ let exlf_sub_hash = self
+ .update_item_rec(
+ tx,
+ &exlf_k[..],
+ &exlf_khash,
+ &exlf_subkey,
+ Some(exlf_vhash),
+ )?
+ .unwrap();
intermediate_set_child(&mut int, exlf_subkey.prefix[i], exlf_sub_hash);
assert_eq!(int.len(), 1);
}
{
let key2 = key.next_key(khash);
- let subhash = self.update_item_rec(tx, k, khash, &key2, new_vhash)?.unwrap();
+ let subhash = self
+ .update_item_rec(tx, k, khash, &key2, new_vhash)?
+ .unwrap();
intermediate_set_child(&mut int, key2.prefix[i], subhash);
if exlf_khash.as_slice()[i] == khash.as_slice()[i] {
assert_eq!(int.len(), 1);