-
Notifications
You must be signed in to change notification settings - Fork 180
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
[Chunk Data Pack Pruner] Add Block Iterator #6858
base: leo/db-ops-dbstore
Are you sure you want to change the base?
Conversation
} | ||
|
||
// BlockIterator is an interface for iterating over blocks | ||
type BlockIterator interface { |
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.
The BlockIterator interface can be implemented into height based iterator and view based iterator.
The block iterator not long can be used by chunk data pack pruner, but alsoin future to implement protocol state pruner.
The height based iterator is easy to implement, however, it can't guarantee to prune all data, since it doesn't iterate unfinalized blocks. The view based iterator can guarantee all blocks are pruned, but it's more complicated to implement.
In this PR, I first implement the height based iterator, for chunk data pack, it's OK that we only prune by height, however, for protocol state, it's better that we can prune by view and ensure a more throughout pruning.
jobCreator IteratorJobCreator | ||
} | ||
|
||
func NewIteratorFactory( |
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.
Once the interfaces in the arguments are implemented, then the logic to create the BlockIterator can be reused. That's why, I put this function here along with the interface definitions, so that it's clear to see how the interfaces will be used for creating the block iterator.
77fb95b
to
5b15c09
Compare
This PR adds a height based block iterator that iterates blocks by height, without iterating siblings of finalized blocks, which will be done later by implementing view based block iterator.