-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement in_mem_block_tree #1786
Conversation
@@ -0,0 +1,413 @@ | |||
// Copyright (c) 2021-2024 RBB S.r.l |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module needs its own tests (in particular for the ensure_node_in_subtree
calls).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this to its own crate in utils?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too generic for my taste, but I'm OK with it. But please move it to utils in its own crate... this doens't belong in primitives.
|
abcba13
to
9477764
Compare
9477764
to
834a082
Compare
I've abstracted
|
That's alright. |
/// This is the observer that only holds the item-id-to-node-id map in debug builds, to perform | ||
/// the corresponding runtime checks. | ||
pub struct DebugOnlyTrackingModificationObserver<T: DataItem> { | ||
#[cfg(debug_assertions)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just note that the overuse of cfg like this complicates testing. I wouldn't recommend doing this. I would prefer to have a run-time configurable flag. Up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just note that the overuse of cfg like this complicates testing. I wouldn't recommend doing this. I would prefer to have a run-time configurable flag. Up to you.
Since you don't insist, I'll leave it as is. IMO it won't complicate testing of the user code, because it basically adds some checks in debugs builds.
)] | ||
NotParentChild { | ||
child_item_id: String, | ||
childs_parent_item_id: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
children?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
children?
It's supposed to be read as child's
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the possessive 's', but not a big deal.
This is the generalized version of the "in-memory block tree" from #1768 . The corresponding
Trees
/Tree
/TreeRef
structs are intree_wrappers.rs
. However, I also had to wrap allindextree
's primitives (which are in theprimitives
module), so that they can be exposed to the user and still maintain the required guarantees (i.e. that a parent/child nodes will always correspond to parent/child blocks).