-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: support custom stages #18977
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
base: main
Are you sure you want to change the base?
feat: support custom stages #18977
Conversation
e208eff
to
4efc99a
Compare
f16a014
to
e4e3150
Compare
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.
makes sense
I think invoking the stages after saving blocks make sense, I guess we could also introduce another trait for this that extend stage so that we can directly provide the new blocks but for now this seems easier
/// Returns additional stages to be added to the pipeline. | ||
fn extra_stages( | ||
&self, | ||
) -> Vec<BoxedStage<<N::Provider as DatabaseProviderFactory>::ProviderRW>> { | ||
Vec::new() | ||
} |
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 makes sense here I believe
exex_manager_handle, | ||
)), | ||
)) | ||
.add_stages_before(extra_stages, StageId::Finish), |
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 think we're fine if these are put before finish stage
|
||
provider_rw.save_blocks(blocks)?; | ||
|
||
for stage in &mut self.custom_stages { |
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.
can we document here that we need invoke those after we save the blocks, because we want them to run last
Based on #18955
Allows defining custom stages on
NodeAddOns
. Those stages are added to pipeline and advanced inPersistenceService
.Open questions:
custom_stages
getter? MaybeNode
trait?PersistenceService
? This should work fine for most of the cases, especially for custom indexes. Another approach would be allowing to define custom hooks invoked when persisting but it feels like this might just lead to redundancy in custom stage impls