diff options
author | Alex Auvolat <alex@adnab.me> | 2021-03-15 19:51:16 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-03-15 19:51:16 +0100 |
commit | 667e4e72a8e64a094d57ceeb6442cef08f1ef0e1 (patch) | |
tree | 670dfb3eb220ad5d90cc62782cb9fc9a7cc3a648 /src/table/merkle.rs | |
parent | 642bed601f9b5f8a0cf3e99223235e6b3eb33c0a (diff) | |
download | garage-667e4e72a8e64a094d57ceeb6442cef08f1ef0e1.tar.gz garage-667e4e72a8e64a094d57ceeb6442cef08f1ef0e1.zip |
Small fixes
Diffstat (limited to 'src/table/merkle.rs')
-rw-r--r-- | src/table/merkle.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/table/merkle.rs b/src/table/merkle.rs index f60be8a8..aefb5169 100644 --- a/src/table/merkle.rs +++ b/src/table/merkle.rs @@ -40,13 +40,13 @@ pub struct MerkleUpdater { // - key = the key of an item in the main table, ie hash(partition_key)+sort_key // - value = the hash of the full serialized item, if present, // or an empty vec if item is absent (deleted) - pub todo: sled::Tree, + pub(crate) todo: sled::Tree, pub(crate) todo_notify: Notify, // Content of the merkle tree: items where // - key = .bytes() for MerkleNodeKey // - value = serialization of a MerkleNode, assumed to be MerkleNode::empty if not found - pub merkle_tree: sled::Tree, + pub(crate) merkle_tree: sled::Tree, empty_node_hash: Hash, } @@ -311,6 +311,14 @@ impl MerkleUpdater { Some(v) => Ok(rmp_serde::decode::from_read_ref::<_, MerkleNode>(&v[..])?), } } + + pub fn merkle_tree_len(&self) -> usize { + self.merkle_tree.len() + } + + pub fn todo_len(&self) -> usize { + self.todo.len() + } } impl MerkleNodeKey { |