Small fixes

This commit is contained in:
Alex Auvolat
2021-03-15 19:51:16 +01:00
parent 642bed601f
commit 667e4e72a8
5 changed files with 37 additions and 16 deletions
+5 -1
View File
@@ -18,7 +18,7 @@ pub struct TableData<F: TableSchema> {
pub instance: F,
pub store: sled::Tree,
pub gc_todo: sled::Tree,
pub(crate) gc_todo: sled::Tree,
pub merkle_updater: Arc<MerkleUpdater>,
}
@@ -239,4 +239,8 @@ where
},
}
}
pub fn gc_todo_len(&self) -> usize {
self.gc_todo.len()
}
}
+10 -2
View File
@@ -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 {