refactor(queries): extract shared bucket-pagination helper for get_ca… - #717
Open
Nife-tanny wants to merge 1 commit into
Open
refactor(queries): extract shared bucket-pagination helper for get_ca…#717Nife-tanny wants to merge 1 commit into
Nife-tanny wants to merge 1 commit into
Conversation
…mpaigns_by_category and get_creator_campaigns (Iris-IV#663) Introduce a private helper that encapsulates the identical bucket-traversal algorithm previously duplicated in and . The helper is parameterised by: - total count (derived by each caller from its own domain counter) - bucket size (CATEGORY_CAMPAIGNS_BUCKET_SIZE / CREATOR_CAMPAIGNS_BUCKET_SIZE) - a bucket getter closure (each caller supplies its own storage lookup) Algorithm (unchanged): 1. Jump to the bucket containing the page offset. 2. Walk entries within that bucket starting at the requested position. 3. Collect up to campaigns (capped at LIST_MAX_LIMIT). 4. When the bucket is exhausted, advance position past the bucket boundary and repeat from step 1 with the next bucket. Behaviour preservation: - Public function signatures unchanged — backwards-compatible. - Only src/queries.rs modified. - All 400 workspace tests run; only 2 pre-existing failures remain (test_campaign_update — unrelated Soroban host vector unpacking). - 26 query/bucket/benchmark tests pass with zero regressions. - cargo fmt --check and cargo clippy --all-targets --features testutils both pass cleanly. Closes Iris-IV#663
|
@Nife-tanny Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…mpaigns_by_category and get_creator_campaigns (#663)
Introduce a private helper that encapsulates
the identical bucket-traversal algorithm previously duplicated in
and . The helper is
parameterised by:
Algorithm (unchanged):
Behaviour preservation:
Closes #663
📌 Description
Provide a clear and concise description of the changes in this PR.
🔗 Related Issues
Use GitHub's auto-close keywords with the
#prefix (one issue per line):Closes #123
Fixes #456
Resolves #789
Multiple issues can be closed by repeating the keyword on separate lines.
🧪 Changes Made
✅ Checklist
If this PR introduces breaking changes, describe them here.
📸 Screenshots (if applicable)
Add screenshots to help reviewers understand the changes.
🧩 Additional Notes
Anything else reviewers should know.
Closes #663