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

Go: Implement Bitfield and Bitfield ReadOnly commands #2999

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

niharikabhavaraju
Copy link
Collaborator

Go: Implement Bitfield and Bitfield ReadOnly commands

@niharikabhavaraju niharikabhavaraju requested a review from a team as a code owner January 23, 2025 18:41
@niharikabhavaraju niharikabhavaraju self-assigned this Jan 23, 2025
@niharikabhavaraju niharikabhavaraju added the go golang wrapper label Jan 23, 2025
go/api/options/bitfield_options.go Outdated Show resolved Hide resolved
go/api/options/bitfield_options.go Outdated Show resolved Hide resolved
go/api/base_client.go Outdated Show resolved Hide resolved
go/api/response_handlers.go Outdated Show resolved Hide resolved
}

// Subcommands for bitfieldReadOnly.
type BitFieldROCommands interface {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are 2 separate interfaces required?
Can we have only one interface named BitFieldCommands?

Copy link
Collaborator Author

@niharikabhavaraju niharikabhavaraju Jan 24, 2025

Choose a reason for hiding this comment

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

Hi @prateek-kumar-improving ,
There are 2 interfaces because one of the interfaces contains dummy()
The dummy() method in BitFieldROCommands helps to distinguish read-only operations from write operations. I followed the convention which is at please refer ZRange as mentioned by @Yury-Fridlyand here

Copy link
Collaborator

Choose a reason for hiding this comment

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

It allows us to implement for BitFieldGet struct two interfaces: BitFieldROCommands and BitFieldCommands and use it into 2 commands. Having that trick don't duplicate code and don't allow using BitFieldSet in BitFieldRO

go/api/base_client.go Outdated Show resolved Hide resolved
go/api/base_client.go Show resolved Hide resolved
go/api/base_client.go Outdated Show resolved Hide resolved
}

// Subcommands for bitfieldReadOnly.
type BitFieldROCommands interface {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It allows us to implement for BitFieldGet struct two interfaces: BitFieldROCommands and BitFieldCommands and use it into 2 commands. Having that trick don't duplicate code and don't allow using BitFieldSet in BitFieldRO

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

Successfully merging this pull request may close these issues.

4 participants