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

Add Very Big Enum with all commands to protobuf #220

Conversation

Yury-Fridlyand
Copy link

@Yury-Fridlyand Yury-Fridlyand commented Apr 15, 2024

there are 4 changes:

  1. added more enum vars
  2. renames like Hvals to HVals
  3. renames like HashDel to HDel
  4. renames of the corresponding functions

All renames (except HashSet) were done with Ctrl+Shift+F magic

AclWhoami = 1112;
BgRewriteAof = 1113;
BgSave = 1114;
Command_ = 1115; // TODO renaming to `Command` causes protobuf error
Copy link
Author

Choose a reason for hiding this comment

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

If I rename this to Command, protobuf returns

  protobuf/redis_request.proto:268:5: "Command" is already defined in "redis_request".
  protobuf/redis_request.proto:268:5: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "Command" must be unique within "redis_request", not just within "RequestType".

It conflicts with Command on line 590. Which one to rename?

Choose a reason for hiding this comment

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

It would probably impact less code to rename the Command here instead of the one on line 590. However, I think the "right" way to do this is to rename the one at line 590 in a separate PR.

Comment on lines +419 to +422
PSetEx = 1518; // deprecated in 2.6.12
SetString = 1519; // Set
SetEx = 1520; // deprecated in 2.6.12
SetNx = 1521; // deprecated in 2.6.12
Copy link
Author

Choose a reason for hiding this comment

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

keep it there to avoid blanks

SetRange = 107;
ZRemRangeByLex = 108;
ZLexCount = 109;
GetString = 1504; // Get
Copy link
Author

Choose a reason for hiding this comment

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

Will rename to Get and Set if no objections

Choose a reason for hiding this comment

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

I like the idea. It keeps things more consistent IMO.

LatencyHistory = 1135,
LatencyLatest = 1136,
LatencyReset = 1137,
Lolwut = 1138,

Choose a reason for hiding this comment

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

I can't believe this is actually real... https://redis.io/docs/latest/commands/lolwut/

Copy link
Author

Choose a reason for hiding this comment

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

I tested it with custom command and looking forward adding implementation of that!

Echo = 320;
Hello = 321;
Ping = 322;
Quit = 323; // deprecated in 7.2.0

Choose a reason for hiding this comment

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

Do we really need to add the deprecated variants? I guess it doesn't hurt, but I wonder what the AWS side will want.

SetRange = 107;
ZRemRangeByLex = 108;
ZLexCount = 109;
GetString = 1504; // Get

Choose a reason for hiding this comment

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

I like the idea. It keeps things more consistent IMO.

AclWhoami = 1112;
BgRewriteAof = 1113;
BgSave = 1114;
Command_ = 1115; // TODO renaming to `Command` causes protobuf error

Choose a reason for hiding this comment

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

It would probably impact less code to rename the Command here instead of the one on line 590. However, I think the "right" way to do this is to rename the one at line 590 in a separate PR.

Append = 1501,
Decr = 1502,
DecrBy = 1503,
/// Type of a get string request.

Choose a reason for hiding this comment

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

This comment feels kind of random and out of place.

ProtobufRequestType::HashGet => RequestType::HashGet,
ProtobufRequestType::HashDel => RequestType::HashDel,
ProtobufRequestType::HashExists => RequestType::HashExists,
ProtobufRequestType::HSet => RequestType::HSet,

Choose a reason for hiding this comment

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

I like these changes but we might need to split them into a separate PR due to how large this PR already is. Not a strong opinion though, and not a blocker.

RequestType::ZMScore => Some(cmd("ZMSCORE")),
RequestType::ZDiff => Some(cmd("ZDIFF")),
RequestType::ZDiffStore => Some(cmd("ZDIFFSTORE")),
RequestType::SetRange => Some(cmd("SETRANGE")),
RequestType::ZRemRangeByLex => Some(cmd("ZREMRANGEBYLEX")),
RequestType::ZLexCount => Some(cmd("ZLEXCOUNT")),
_ => todo!(),

Choose a reason for hiding this comment

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

Are there actually more commands we're missing here? Or is this just a catch-all case for future added commands?

@@ -130,7 +130,7 @@ public static Expiry UnixMilliseconds(Long unixMilliseconds) {
/** Types of value expiration configuration. */
@RequiredArgsConstructor
protected enum ExpiryType {
KEEP_EXISTING("KEEPTTL"),
KEEP_EXISTING("KEEPTtl"),

Choose a reason for hiding this comment

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

This looks a bit weird and inconsistent with the other entries here now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants