-
Notifications
You must be signed in to change notification settings - Fork 86
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
[CAD-3383] Stop processing when snapshot created #3400
[CAD-3383] Stop processing when snapshot created #3400
Conversation
1b847d1
to
98d6c6c
Compare
I wonder if we could leave -- | Process all blocks with the given callback until either:
--
-- - The termination condition evaluates to True
-- - There are no more blocks left.
--
processAllUntil ::
forall blk b st. HasHeader blk
=> Either (ImmutableDB IO blk) (ChainDB IO blk)
-> ResourceRegistry IO
-> BlockComponent blk b
-> st
-> (st -> b -> IO st)
-- ^ State transforming function (callback).
-> (st -> b -> st -> Bool)
-- ^ Early-termination condition.
--
-- The first parameter is the termination condition is the state prior to
-- applying the given state transforming function. The second parameter is
-- the block to which this state transforming function is applied, and the
-- third parameter is its result.
-> IO st
processAll db rr blockComponent st callback =
processAllUntil db rr blockComponent st callback (const . const . const False) In this way:
I also wonder, should the termination condition be an IO action as it is now, or do we want to keep it pure? |
…d processAll_ processAll_ is build on processAll processAll is build on processAllUntil
@dnadales I've went with different approach. Introduced |
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.
One last UX suggestion (which we chatted about before). Otherwise LGTM. Approved.
9981b94
to
583d4e0
Compare
bors merge |
Build succeeded: |
Improvement to the
--store-ledger
functionality. It stops the blockchain processing once the snapshot is created.