pika icon indicating copy to clipboard operation
pika copied to clipboard

feat: add new hash expire cmd to pika

Open bigdaronlee163 opened this issue 1 year ago • 1 comments

  1. pkhget pkhset
  2. pkhexpire pkhexpireat
  3. pkhexpiretime pkhpersist
  4. pkhttl

Summary by CodeRabbit

  • New Features

    • Added multiple command constants for PKHash operations, including PKHSet, PKHGet, and various expiration commands.
    • Implemented new command classes for managing PKHashes, enhancing functionality with expiration and persistence features.
    • Expanded Redis functionality with new methods for PKHash management, including TTL and key management commands.
  • Bug Fixes

    • Improved error handling for PKHash commands to ensure accurate responses based on metadata validity.
  • Documentation

    • Updated documentation to reflect the new methods and functionalities related to PKHashes.

bigdaronlee163 avatar Aug 27 '24 00:08 bigdaronlee163

Walkthrough

A new enumerator value PKHASH has been added to the AclCategory enum in include/acl.h. The changes also introduce a series of new command constants in include/pika_command.h and a comprehensive set of command classes in include/pika_pkhash.h for managing PKHash operations. Various methods related to these commands have been implemented across multiple files, including redis.cc, storage.cc, and new unit tests in pkhashes_test.cc. These modifications extend the functionality of the codebase and improve its structure and readability.

Changes

File Path Change Summary
include/acl.h Added enumerator PKHASH to AclCategory enum.
include/pika_command.h Introduced new command constants for PKHash operations and added kCmdFlagsPKHash to CmdFlags enum.
include/pika_pkhash.h Added multiple command classes for PKHash operations, including PKHExpireCmd, PKHGetCmd, PKHSetCmd, etc.
src/pika_client_conn.cc Minor formatting change; added a blank line after external variable declarations.
src/pika_command.cc Modified InitCmdTable to include new PKHash commands and improved formatting of existing command initializations.
src/pika_pkhash.cc Implemented command classes for managing hash operations, including methods for expiration, retrieval, and setting values.
src/storage/include/storage/storage.h Added FieldValueTTL struct and new methods for PKHash operations.
src/storage/include/storage/storage_define.h Added enum value kPKHashDataCF to ColumnFamilyIndex.
src/storage/src/base_filter.h Updated header inclusions and added class aliases for PKHashes.
src/storage/src/base_value_format.h Expanded DataType enum to include kPKHashes and updated related structures.
src/storage/src/pkhash_data_value_format.h Introduced classes PKHashDataValue and ParsedPKHashDataValue for encoding and parsing data formats.
src/storage/src/redis.cc Reformatted header inclusions, constructor, and added functionality for new column family.
src/storage/src/redis.h Added methods related to PKHash operations and updated existing method signatures for consistency.
src/storage/src/redis_hashes.cc Reformatted error message handling and updated header inclusions.
src/storage/src/redis_pkhashes.cc Implemented methods for managing PKHashes, including CRUD operations and expiration handling.
src/storage/src/redis_strings.cc Updated method signatures and error handling for consistency.
src/storage/src/storage.cc Added new methods for PKHash commands and adjusted method signatures for clarity.
src/storage/tests/hashes_test.cc Included necessary header files and made minor comment adjustments.
src/storage/tests/pkhashes_test.cc Added comprehensive unit tests for PKHash functionality using Google Test framework.

Possibly related PRs

  • #2849: This PR introduces a new method IsTooLargeKey in the Cmd class and related classes, which checks if a key exceeds a specified size limit. This is relevant as it directly relates to managing key sizes, which is a concern in the main PR's context of adding a new enumerator value PKHASH that may involve key management.
  • #2901: This PR enhances testing coverage for Redis commands, including those related to key management. It indirectly relates to the main PR by ensuring that commands handling the new PKHASH category are properly tested, which may involve key size considerations.
  • #2934: This PR addresses a compilation error related to the handling of compaction in Redis. While it does not directly relate to the changes in the main PR, it reflects ongoing improvements in the Redis codebase that may impact how new features, like the PKHASH enumerator, are integrated and managed.

Suggested labels

🧹 Updates, ☢️ Bug

Suggested reviewers

  • chejinge
  • AlexStocks
  • Mixficsol

Poem

In the burrow where data hops,
New commands and enums, oh how it pops!
PKHash is here, with functions galore,
Expire and retrieve, who could ask for more?
With tests all set, let the code run free,
Hopping through hashes, as happy as can be! 🐰✨


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

coderabbitai[bot] avatar Aug 27 '24 00:08 coderabbitai[bot]

补充一下TCL测试吧

Mixficsol avatar Oct 29 '24 03:10 Mixficsol

Bot detected the issue body's language is not English, translate it automatically.


Please add the TCL test

Issues-translate-bot avatar Oct 29 '24 03:10 Issues-translate-bot

补充一下TCL测试吧

好的,这周补充。

bigdaronlee163 avatar Nov 18 '24 06:11 bigdaronlee163

Bot detected the issue body's language is not English, translate it automatically.


Supplement the TCL test

Okay, more to add this week.

Issues-translate-bot avatar Nov 18 '24 06:11 Issues-translate-bot