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

Immutable For Each on ShardStore Checkpoints #112

Merged
merged 3 commits into from
Sep 12, 2024

Conversation

ec2
Copy link
Contributor

@ec2 ec2 commented Sep 10, 2024

The only ways to iterate over Checkpoints in the ShardStore is

  1. Use the with_checkpoints method. The problem with this is that it require a mut reference to the store which isn't always available (e.g. in serialization).
  2. Get the min_checkpoint_id and the max_checkpoint_id and then casting that to some primitive type if CheckpointId is From/To <numeric> then calling get_checkpoint over the range of that (very not ergonomic!!!).

This PR introduces for_each_checkpoint which is literally the same as with_checkpoints but takes an immutable reference to the store.

I actually wanted to rename with_checkpoints to for_each_checkpoint_mut and call this for_each_checkpoint OR call them with_checkpoints and with_checkpoints_mut but I didn't want to make a breaking API change!

Copy link
Contributor

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 16eff25 for functionality, this can be merged once a CHANGELOG entry has been added.

@ec2
Copy link
Contributor Author

ec2 commented Sep 12, 2024

utACK 16eff25 for functionality, this can be merged once a CHANGELOG entry has been added.

CHANGELOG entry added

@ec2 ec2 requested a review from nuttycom September 12, 2024 15:50
Copy link
Contributor

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@nuttycom nuttycom merged commit 8aa12e4 into zcash:main Sep 12, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants