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

Java: Add BITFIELD and BITFIELD_RO commands #1510

Merged
merged 8 commits into from
Jun 4, 2024

Conversation

GumpacG
Copy link
Collaborator

@GumpacG GumpacG commented May 31, 2024

Issue #, if available:
N/A

Description of changes:
Implements BITFIELD and BITFILED_RO commands in the java client.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@GumpacG GumpacG requested a review from a team as a code owner May 31, 2024 18:39
@GumpacG GumpacG force-pushed the java/integ_guiang_bitfield_ro branch from d0ab6dc to 1f7080e Compare May 31, 2024 18:55
@Yury-Fridlyand Yury-Fridlyand added the java issues and fixes related to the java client label May 31, 2024
@@ -199,6 +199,8 @@ enum RequestType {
XDel = 166;
LMove = 168;
BLMove = 169;
BitField = 170;
BitFieldReadOnly = 171;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should just keep it identical to the command

Suggested change
BitFieldReadOnly = 171;
BitField_Ro = 171;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure I agree with this, it doesn't seem java like to have camel case and underscore and ignore the acronym. Jedis names it similar for example https://javadoc.io/doc/redis.clients/jedis/4.2.3/redis/clients/jedis/commands/StringCommands.html#bitfieldReadonly-java.lang.String-java.lang.String...-.

Thoughts?

@@ -169,6 +169,8 @@ pub enum RequestType {
XDel = 166,
LMove = 168,
BLMove = 169,
BitField = 170,
BitFieldReadOnly = 171,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
BitFieldReadOnly = 171,
BitField_Ro = 171,

@@ -341,6 +343,8 @@ impl From<::protobuf::EnumOrUnknown<ProtobufRequestType>> for RequestType {
ProtobufRequestType::XDel => RequestType::XDel,
ProtobufRequestType::LMove => RequestType::LMove,
ProtobufRequestType::BLMove => RequestType::BLMove,
ProtobufRequestType::BitField => RequestType::BitField,
ProtobufRequestType::BitFieldReadOnly => RequestType::BitFieldReadOnly,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ProtobufRequestType::BitFieldReadOnly => RequestType::BitFieldReadOnly,
ProtobufRequestType:: BitField_Ro => RequestType:: BitField_Ro,

Copy link
Collaborator

Choose a reason for hiding this comment

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

@acarbonetto, why?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The command is: bitfield_ro
We don't replace letters, for example: XDel. Not XDelete or StreamDelete.
What's different about the _ro?

@@ -509,6 +513,8 @@ impl RequestType {
RequestType::XDel => Some(cmd("XDEL")),
RequestType::LMove => Some(cmd("LMOVE")),
RequestType::BLMove => Some(cmd("BLMOVE")),
RequestType::BitField => Some(cmd("BITFIELD")),
RequestType::BitFieldReadOnly => Some(cmd("BITFIELD_RO")),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
RequestType::BitFieldReadOnly => Some(cmd("BITFIELD_RO")),
RequestType:: BitField_Ro => Some(cmd("BITFIELD_RO")),

java/integTest/src/test/java/glide/SharedCommandTests.java Outdated Show resolved Hide resolved
java/integTest/src/test/java/glide/SharedCommandTests.java Outdated Show resolved Hide resolved
java/integTest/src/test/java/glide/SharedCommandTests.java Outdated Show resolved Hide resolved
java/integTest/src/test/java/glide/SharedCommandTests.java Outdated Show resolved Hide resolved
@GumpacG GumpacG force-pushed the java/integ_guiang_bitfield_ro branch from 9d35be0 to bc28f83 Compare June 3, 2024 18:17
@GumpacG GumpacG force-pushed the java/integ_guiang_bitfield_ro branch from cf246aa to a579cbf Compare June 3, 2024 21:53
@@ -341,6 +343,8 @@ impl From<::protobuf::EnumOrUnknown<ProtobufRequestType>> for RequestType {
ProtobufRequestType::XDel => RequestType::XDel,
ProtobufRequestType::LMove => RequestType::LMove,
ProtobufRequestType::BLMove => RequestType::BLMove,
ProtobufRequestType::BitField => RequestType::BitField,
ProtobufRequestType::BitFieldReadOnly => RequestType::BitFieldReadOnly,
Copy link
Collaborator

Choose a reason for hiding this comment

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

@acarbonetto, why?

Copy link
Collaborator

Choose a reason for hiding this comment

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

TLDR
I trust you covered all possible and impossible cases

* Initial implementation for early review

* Added javadocs and tests

* Addressed comments

* Fixed javadocs

* Fixed link

* Fixed javadocs

* Addressed comments
@GumpacG GumpacG force-pushed the java/integ_guiang_bitfield_ro branch from e2b0135 to 3733e22 Compare June 4, 2024 18:36
@acarbonetto acarbonetto merged commit b80ad92 into valkey-io:main Jun 4, 2024
46 checks passed
@acarbonetto acarbonetto deleted the java/integ_guiang_bitfield_ro branch June 4, 2024 19:04
cyip10 pushed a commit to Bit-Quill/valkey-glide that referenced this pull request Jun 24, 2024
* Java: Add `BITFIELD` and `BITFIELD_RO` command (#314)

* Initial implementation for early review

* Added javadocs and tests

* Addressed comments

* Fixed javadocs

* Fixed link

* Fixed javadocs

* Addressed comments

* Resolved conflicts

* Addressed PR comments

* Missed PR comment

* Resolved conflicts

* Addressed PR comments

* Rebased

* Improved import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java issues and fixes related to the java client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants