diff options
author | Alex <alex@adnab.me> | 2021-04-05 23:50:33 +0200 |
---|---|---|
committer | Alex <alex@adnab.me> | 2021-04-05 23:50:33 +0200 |
commit | 8225fa2e4b85349709f840df45b3ecc3bcfb8284 (patch) | |
tree | b300d7e3df823a878686d71cf7e728aeca7e56cc /src/table/merkle.rs | |
parent | 7d772737a58b3c8dce147e4704152e2e6471bd90 (diff) | |
parent | ab67bd88decc4f27876aaf7a1448070875c90258 (diff) | |
download | garage-8225fa2e4b85349709f840df45b3ecc3bcfb8284.tar.gz garage-8225fa2e4b85349709f840df45b3ecc3bcfb8284.zip |
Merge pull request 'Improved bootstraping procedure' (#56) from better_bootstrap into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/56
Diffstat (limited to 'src/table/merkle.rs')
-rw-r--r-- | src/table/merkle.rs | 23 |
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); |