Conversation
I'm adding the CommitOperationCollection which holds all the changes that need to be persisted when a commit request comes in.
|
Benchmark results for revision 1ed526f:
Full results
Compare the results above with those for the default branch. |
|
|
||
| impl CommitOperationCollection { | ||
| pub(crate) fn add_new_node_to_commit(&mut self, node: &Arc<MavlNode>) { | ||
| let node_hash: [u8; 32] = *hash(node).as_bytes(); |
There was a problem hiding this comment.
I guess this is a bit too expensive to calculate here. We should store the key rather.
| impl CommitOperationCollection { | ||
| pub(crate) fn add_new_node_to_commit(&mut self, node: &Arc<MavlNode>) { | ||
| let node_hash: [u8; 32] = *hash(node).as_bytes(); | ||
| let serialized_node = node.encode_to_vec(); |
There was a problem hiding this comment.
This is probably not needed at this stage.
| } | ||
|
|
||
| pub(crate) fn remove_node_from_commit(&mut self, node: &Arc<MavlNode>) { | ||
| let node_hash: [u8; 32] = *hash(node).as_bytes(); |
There was a problem hiding this comment.
We also should not hash here, but just store the key. But we should also take ownership of the data of the node, so here we probably want to serialise the data or just own the node by owning its Arc.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #549 +/- ##
=======================================
Coverage 90.72% 90.72%
=======================================
Files 110 110
Lines 20279 20279
Branches 20279 20279
=======================================
Hits 18399 18399
Misses 1552 1552
Partials 328 328 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Scraping this for now and going with a more simple version. The approach needs some refactoring because it uses a lot of copies at the moment. I have an idea for a more efficient approach. I will update the relevant Linear task. |
Relates to RV-825
What
I'm adding the CommitOperationCollection
which holds all the changes that need to be
persisted when a commit request comes in.
Why
We need to be able to persist the new nodes that become part of the Merkle Tree between two commits, and also delete the ones that we don't need any more.
How
We store a collection of nodes that either need to be deleted or inserted into RocksDB during a commit. During a commit operation, we iterate through the elements of this collection and act accordingly.
Manually Testing
Regressions
Tasks for the Author