Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Feb 8, 2025
1 parent 4c91379 commit fa1dfcf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion engine/execution/pruner/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ func makeBlockIteratorCreator(
headers storage.Headers,
chunkDataPacksDB storage.DB,
config PruningConfig,
) (module.IteratorCreator, func() (nextToPrune uint64, latestToPrune uint64, err error), error) {
) (
module.IteratorCreator,
// this is for logging purpose, so that after each round of pruning,
// we can log and report metrics about the next and latest to prune
func() (nextToPrune uint64, latestToPrune uint64, err error),
error, // any error are exception
) {
root := state.Params().SealedRoot()
sealedAndExecuted := latest.NewLatestSealedAndExecuted(
root,
Expand Down
4 changes: 4 additions & 0 deletions module/block_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ type BlockIterator interface {
// if there is no block to iterate, hasNext is false
// any error returned are exception
type IteratorCreator interface {
// Create return the next block iterator
Create() (fromSavedIndexToLatest BlockIterator, hasNext bool, exception error)

// IteratorState returns the iterate state, useful to know the progress of the iterator
// after each round of iteration
IteratorState() IteratorStateReader
}

0 comments on commit fa1dfcf

Please sign in to comment.