-
Notifications
You must be signed in to change notification settings - Fork 11
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
Streaming iterator spike #342
Conversation
There are several TODOs here, but the code works for the two test cases I created. Both of these avoid making extension nodes, which are going away, and this code may need some tweaks to support values inside branch nodes.
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 didn't really dive super far into this, but I would love to see some more test to prove or refute my suspicions before this gets merged.
Branches having paths will also complicate things.
Per review comments
Per review comments
Per review comments
Per review comments
IteratorState is any of: - Start at the beginning of the trie - Start at a specific key value of the trie - Continue after a saved node and parents See the inline comments for more details. TODO: - Implement StartAtBegininng (and tests) - If a key is provided that doesn't exist, start iterating at the next one (if we really need this) - If an error is returned, we should next return None, then start from the beginning. This makes the resumption after an error a little cleaner. We'd need another IteratorState for this. - Remove extension nodes (depends on other diffs)
This was an artifact from an earlier change. Reverted back to original.
Seems like we can just reference self and it works!
Removed unnecessary clone Added additional comments Added TODO for a few things: - possible to return a reference to the value instead of a copy - should handle case of branch nodes with values while traversing Adding a randomized key-value test after extension nodes are removed is also recommended.
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.
Mostly about the TODOs which some of them would be straightforward to fix in this PR, I'm good with tracking all non fixed TODOs in a issue as well, since they seem essential to have.
.map(|node| (node, u8::MAX)) | ||
.map_err(|e| api::Error::InternalError(e.into()))?; | ||
|
||
// TODO: If the branch has a value, then we shouldn't keep_going |
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.
Hmm, would it be better to fix this issue in this PR instead of leaving a TODO? It seems a straightforward fix.
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.
Fixed in #346
use node::tests::{extension, leaf}; | ||
use shale::{cached::DynamicMem, compact::CompactSpace, CachedStore}; | ||
use std::sync::Arc; | ||
use test_case::test_case; | ||
//use itertools::Itertools; |
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.
nit: Why not remove this line?
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.
Fixed in #346
key: Option<K>, | ||
root: DiskAddress, | ||
) -> Result<MerkleKeyValueStream<'_, S>, MerkleError> { | ||
// TODO: if DiskAddress::is_null() ... |
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.
Will all this TODOs be tracked in a issue so that we won't forget about it? All of them seem a must do.
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 was fixed in #346
Abandoning this in favor of #346, which contains all these commits |
This is ready for feedback.
There are still some unfinished parts, all annotated with TODO. Notably: