Modularize beacon processor scheduler #6448
Open
+3,563
−1,457
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Addressed
Partially #6291
Proposed Changes
This PR aims to "modularize" the beacon processor scheduler. The goal is to set up the scheduler in such a way that new scheduling algorithms can be implemented/swapped in.
For now we've decided on exposing an interface that implements the following trait
We then define a
SchedulerType
enumEach variant is a beacon processor scheduling implementation with its own unique scheduling algorithm. Swapping between the variants can be done either at the config level, or with a small code change.
Additional Info
PriorityScheduler
variant. Other scheduling algorithms might not use all these different queues to schedule the differentWorkEvent
s and so these queues aren't exposed outside of thePriorityScheduler
impl.BeaconProcessorSend
channel. I've introduced a newWork::Reprocess
type which we then use to schedule jobs for reprocess. The reprocess logic itself is very specific to thePriorityScheduler
so it seems to make more sense to give other implementations maximum flexibility.