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: INFO. #2988

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

Go: INFO. #2988

wants to merge 5 commits into from

Conversation

Yury-Fridlyand
Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand commented Jan 22, 2025

  • INFO commmand
  • Update for ClusterValue with doc fix
  • Replace custom command with info in tests

Issue link

This Pull Request is linked to issue (URL): #2876

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Commits will be squashed upon merging.

Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
@@ -46,7 +46,7 @@ func (client *glideClient) CustomCommand(args []string) (interface{}, error) {
func (client *glideClient) ConfigSet(parameters map[string]string) (string, error) {
result, err := client.executeCommand(C.ConfigSet, utils.MapToString(parameters))
if err != nil {
return "", err
return defaultStringResponse, err
Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome job on fixing little code quality issues. We should all be looking for opportunities to do this as part of our PRs when we are already making changes to existing code.

go/api/request_routing_config.go Outdated Show resolved Hide resolved
// // `response` stores the command output from a cluster node
type ClusterValue[T any] struct {
valueType ValueType
value Result[T]
value Result[any]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you clarify why this change is needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In case when user runs INFO with multi-node route, response is a map (map[string]string), but we return ClusterValue[string]. So we have to store that map there.

return createClusterMultiValue[string](data), nil

Maybe we should follow java approach and have 2 fields inside ClusterValue:

type ClusterValue[T any] struct {
	valueType    ValueType
	singleValue  Result[T]
	multiValue   map[string]T
}

WDYT?

Copy link
Collaborator

@yipin-chen yipin-chen left a comment

Choose a reason for hiding this comment

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

Overall LGTM

Signed-off-by: Yury-Fridlyand <[email protected]>
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.

3 participants