Skip to content
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

Add provider function to return a list of all stages and their progress #9649

Closed
mattsse opened this issue Jul 19, 2024 · 1 comment · Fixed by #9650
Closed

Add provider function to return a list of all stages and their progress #9649

mattsse opened this issue Jul 19, 2024 · 1 comment · Fixed by #9650
Assignees
Labels
A-db Related to the database C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started

Comments

@mattsse
Copy link
Collaborator

mattsse commented Jul 19, 2024

Describe the feature

with alloy-rs/alloy#1079 we can now emit an list of stages and their processed blocks

which can be obtained from the

/// The trait for fetching stage checkpoint related data.
#[auto_impl::auto_impl(&, Arc)]
pub trait StageCheckpointReader: Send + Sync {
/// Fetch the checkpoint for the given stage.
fn get_stage_checkpoint(&self, id: StageId) -> ProviderResult<Option<StageCheckpoint>>;

we need a new function here that returns a list of all checkpoints in that table:

we need to iterate over this table and decode its keys to string and the checkpoint

fn get_stage_checkpoint(&self, id: StageId) -> ProviderResult<Option<StageCheckpoint>> {
Ok(self.tx.get::<tables::StageCheckpoints>(id.to_string())?)
}

TODO

  • add get_all_checkpoints function to trait

this can be done via

fn cursor_read<T: Table>(&self) -> Result<Self::Cursor<T>, DatabaseError>;

and then walk

fn walk(&mut self, start_key: Option<T::Key>) -> Result<Walker<'_, T, Self>, DatabaseError>

FYI @loocapro

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Jul 19, 2024
@mattsse mattsse added D-good-first-issue Nice and easy! A great choice to get started A-db Related to the database and removed S-needs-triage This issue needs to be labelled labels Jul 19, 2024
@loocapro
Copy link
Contributor

Happy to get it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-db Related to the database C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants