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 Config Rewrite #3156

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EdricCua
Copy link
Collaborator

Issue link

This Pull Request is linked to issue (URL): [REPLACE ME]

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
  • Create merge commit if merging release branch into main, squash otherwise.

Signed-off-by: EdricCua <[email protected]>
@EdricCua EdricCua requested a review from a team as a code owner February 13, 2025 00:27
//
// "OK" when the configuration was rewritten properly, otherwise an error is thrown.
//
// Example:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Examples should not exist in the document block and instead should be placed in the relevant test file. See the Go Developer Guide for Valkey-Glide.

//
// "OK" when the configuration was rewritten properly, otherwise an error is thrown.
//
// Example:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Examples should not exist in the document block and instead should be placed in the relevant test file. See the Go Developer Guide for Valkey-Glide.

@Yury-Fridlyand Yury-Fridlyand added the go golang wrapper label Feb 15, 2025
Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

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

  1. Need to move examples to the corresponding file(s).
  2. Need to add a changelog entry as of now.
  3. RouteOption was reworked in 1.3 branch.

Please wait for backporting all changes from release-1.3 branch. You can merge/rebase you branch after that and implement required fixes.

// fmt.Println(response) // Output: OK
//
// [valkey.io]: https://valkey.io/commands/config-rewrite/
func (client *GlideClusterClient) ConfigRewriteWithOptions(opts options.RouteOption) (string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need an implementation without route. Route is mandatory there.

@@ -372,3 +372,34 @@ func (client *GlideClusterClient) EchoWithOptions(echoOptions options.ClusterEch
}
return createClusterSingleValue[string](data), nil
}

// Rewrites the configuration file with the current configuration.
// The command will be routed a random node, unless `Route` in `routeOptions` is provided.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line should be in the API which has no route argument:

// The command will be routed a random node.

@@ -298,3 +298,21 @@ func (suite *GlideTestSuite) TestEchoCluster() {
assert.Contains(t, strings.ToLower(messages), strings.ToLower("hello"))
}
}

func (suite *GlideTestSuite) TestConfigRewriteWithOptions() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need a test for standalone client too.

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