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

Feat/bucket stat #576

Merged
merged 3 commits into from
Jun 12, 2024
Merged

Feat/bucket stat #576

merged 3 commits into from
Jun 12, 2024

Conversation

ccamel
Copy link
Member

@ccamel ccamel commented Jun 11, 2024

Simple. Basic. Include bucket statistics in bucket information query as mentioned as described in issue #555.

Summary by CodeRabbit

  • New Features

    • Introduced BucketStat to provide detailed statistics for each bucket, such as size, compressed size, and object count.
  • Documentation

    • Updated documentation to include the new stat field in BucketResponse, detailing its subfields (compressed_size, object_count, size).

@ccamel ccamel self-assigned this Jun 11, 2024
Copy link

coderabbitai bot commented Jun 11, 2024

Walkthrough

The changes introduce a new BucketStat struct to hold detailed statistics about buckets, including size, compressed size, and object count. This struct is integrated into various modules, enhancing the representation and querying of bucket statistics. Tests and documentation are updated to reflect these additions.

Changes

File Change Summary
contracts/axone-objectarium/src/contract.rs Added stat field to Bucket struct in query module; updated imports and assertions in tests.
contracts/axone-objectarium/src/msg.rs Introduced BucketStat struct to hold bucket statistics; added stat field to BucketResponse.
contracts/axone-objectarium/src/state.rs Added conversion implementation for BucketStat to msg::BucketStat; reorganized BucketLimits.
docs/axone-objectarium.md Updated documentation to include new stat field in BucketResponse and details on BucketStat.

Poem

In the code where buckets dwell,
Stats now have a tale to tell,
Size and count, compressed so neat,
Buckets' secrets now complete.
Tests and docs in harmony,
A rabbit's joy, code's symphony!
🐇🎶✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jun 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
contracts/axone-objectarium/src/contract.rs 99.88% <100.00%> (+<0.01%) ⬆️
contracts/axone-objectarium/src/msg.rs 99.00% <100.00%> (+0.02%) ⬆️
contracts/axone-objectarium/src/state.rs 100.00% <100.00%> (ø)

@bot-anik
Copy link
Member

bot-anik commented Jun 11, 2024

size-limit report 📦

Path Size
target/wasm32-unknown-unknown/release/axone_objectarium.wasm 399.33 KB (+0.24% 🔺)
target/wasm32-unknown-unknown/release/axone_law_stone.wasm 542.22 KB (0%)
target/wasm32-unknown-unknown/release/axone_cognitarium.wasm 761.37 KB (0%)
target/wasm32-unknown-unknown/release/axone_dataverse.wasm 622.05 KB (0%)

@ccamel ccamel linked an issue Jun 11, 2024 that may be closed by this pull request
@ccamel ccamel marked this pull request as ready for review June 11, 2024 16:29
@ccamel ccamel requested review from amimart and bdeneux June 11, 2024 16:30
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
docs/axone-objectarium.md (1)

Line range hint 301-301: Remove the bare URL to comply with best Markdown practices.

- See [the LZMA wiki page](https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm) for more information.
+ See [the LZMA wiki page](https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm) for more information.
Tools
Markdownlint

276-276: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


279-279: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a9be78d and d58259d.

Files selected for processing (4)
  • contracts/axone-objectarium/src/contract.rs (4 hunks)
  • contracts/axone-objectarium/src/msg.rs (2 hunks)
  • contracts/axone-objectarium/src/state.rs (2 hunks)
  • docs/axone-objectarium.md (3 hunks)
Additional context used
Markdownlint
docs/axone-objectarium.md

301-301: null (MD034, no-bare-urls)
Bare URL used


148-148: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


175-175: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


177-177: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


178-178: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


186-186: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


187-187: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


195-195: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


196-196: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


204-204: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


205-205: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


217-217: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


225-225: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


226-226: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


234-234: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


245-245: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


246-246: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


254-254: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


257-257: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


267-267: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


270-270: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


275-275: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


276-276: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


279-279: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


290-290: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


291-291: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


292-292: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


293-293: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


294-294: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


295-295: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


313-313: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


314-314: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


324-324: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


325-325: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


369-369: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


370-370: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


371-371: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


425-425: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


426-426: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


427-427: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


428-428: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


429-429: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


430-430: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


438-438: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers


439-439: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers

Additional comments not posted (9)
contracts/axone-objectarium/src/state.rs (1)

214-221: The implementation of the conversion from BucketStat to msg::BucketStat is correct and idiomatic.

contracts/axone-objectarium/src/msg.rs (2)

150-151: The addition of the stat field in the BucketResponse struct aligns with the PR's objectives and is implemented correctly.


356-368: The BucketStat struct is well-defined and appropriately captures the necessary statistics for a bucket.

docs/axone-objectarium.md (1)

279-282: The addition of BucketStat to the BucketResponse is well-documented and aligns with the PR's objective to enhance bucket information queries.

Tools
Markdownlint

279-279: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers

contracts/axone-objectarium/src/contract.rs (5)

318-318: Ensure the BucketStat struct is properly integrated into the BucketResponse.

This change aligns with the PR's objective to include bucket statistics in the bucket information query, enhancing the functionality of the contract.


Line range hint 434-572: Review the test suite for proper initialization and configuration.

The tests are well-structured and cover various scenarios including initialization and configuration of buckets. It's good to see comprehensive tests that ensure the contract behaves as expected under different configurations.


Line range hint 17-33: Proper handling of contract instantiation.

The function correctly initializes a new bucket with the provided settings and ensures that the contract is non-payable. It also appropriately sets the contract version using environment variables, which is a best practice for maintainability.


Line range hint 35-50: Effective handling of execution messages.

The function correctly ensures that no funds are transferred with the transaction and routes different execution messages to their respective handling functions. This modular approach facilitates easier maintenance and scalability of the contract's functionality.


Line range hint 263-318: Efficient handling of query messages.

The function efficiently handles different types of query messages and correctly formats the responses as JSON binary. This ensures that the contract can effectively communicate with external clients or other contracts.

Copy link
Contributor

@bdeneux bdeneux left a comment

Choose a reason for hiding this comment

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

Seems good 👍

Copy link
Member

@amimart amimart 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 thx :)

@ccamel ccamel merged commit 1eb8c8c into main Jun 12, 2024
17 checks passed
@ccamel ccamel deleted the feat/bucket-stat branch June 12, 2024 06:23
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.

🛡️ Not All Storage Elements Are Exposed Through Queries
4 participants