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

[typed store] enable iterator methods for in_memory_db and tidehunter #21709

Merged
merged 1 commit into from
Apr 7, 2025

Conversation

phoenix-o
Copy link
Contributor

Description

PR enables iterator methods for in_memory_db and tidehunter


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • gRPC:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

Copy link

vercel bot commented Apr 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2025 7:21pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Apr 7, 2025 7:21pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Apr 7, 2025 7:21pm

@phoenix-o phoenix-o temporarily deployed to sui-typescript-aws-kms-test-env April 3, 2025 14:38 — with GitHub Actions Inactive
@phoenix-o phoenix-o marked this pull request as ready for review April 3, 2025 17:40
@phoenix-o phoenix-o requested a review from andll April 3, 2025 17:40
@phoenix-o phoenix-o temporarily deployed to sui-typescript-aws-kms-test-env April 3, 2025 17:40 — with GitHub Actions Inactive
Copy link
Contributor

@andll andll left a comment

Choose a reason for hiding this comment

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

Looks good, I added some suggestions

@@ -544,8 +544,7 @@ impl ObjectStore for AuthorityPerpetualTables {
}

pub struct LiveSetIter<'a> {
iter:
<DBMap<ObjectKey, StoreObjectWrapper> as Map<'a, ObjectKey, StoreObjectWrapper>>::SafeIterator,
iter: Box<dyn Iterator<Item = Result<(ObjectKey, StoreObjectWrapper), TypedStoreError>> + 'a>,
Copy link
Contributor

Choose a reason for hiding this comment

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

You can make a type alias in typed-store crate for this iterator since it seem to repeat very often.
Something like
type DbIterator<T> = Box<dyn Iterator<Item = Result<T, TypedStoreError>>>

use typed_store_error::TypedStoreError;

#[inline]
pub fn be_fix_int_ser<S>(t: &S) -> Result<Vec<u8>, TypedStoreError>
Copy link
Contributor

Choose a reason for hiding this comment

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

Seeing that in all call sites of this function we just call expect on the results, perhaps it makes sense to just call expect inside of this function and not return Result?

@phoenix-o phoenix-o temporarily deployed to sui-typescript-aws-kms-test-env April 7, 2025 19:15 — with GitHub Actions Inactive
@phoenix-o phoenix-o merged commit c232615 into MystenLabs:main Apr 7, 2025
43 of 44 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