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 ClusterLinks to rueidiscompat #752

Open
rueian opened this issue Feb 11, 2025 · 1 comment
Open

Add ClusterLinks to rueidiscompat #752

rueian opened this issue Feb 11, 2025 · 1 comment
Assignees
Labels
feature good first issue Good for newcomers

Comments

@rueian
Copy link
Collaborator

rueian commented Feb 11, 2025

The rueidiscompat sub-module aims to provide the same interface as go-redis as closely as possible while utilizing rueidis under the hood.

go-redis has the following interface:

https://github.com/redis/go-redis/blob/40e049e67a4cce574f7972b53b1a8172bbe45d5e/cluster_commands.go#L9
type ClusterCmdable interface {
	...
	ClusterLinks(ctx context.Context) *ClusterLinksCmd
	...
}

while in rueidiscompat, it is currently not implemented:

// TODO ClusterLinks(ctx context.Context) *ClusterLinksCmd

Therefore, we should catch up go-redis by implementing the function to the rueidiscompat.Compat and the rueidiscompat.Pipeline struct.

Take the below ACLDryRun as an example to implement the new function in rueidiscompat that provides the same interface as go-redis:

func (c *Compat) ACLDryRun(ctx context.Context, username string, command ...any) *StringCmd {
cmd := c.client.B().AclDryrun().Username(username).Command(command[0].(string)).Arg(argsToSlice(command[1:])...).Build()
resp := c.client.Do(ctx, cmd)
return newStringCmd(resp)
}

func (c *Pipeline) ACLDryRun(ctx context.Context, username string, command ...any) *StringCmd {
ret := c.comp.ACLDryRun(ctx, username, command...)
c.rets = append(c.rets, ret)
return ret
}

@rueian rueian added feature good first issue Good for newcomers labels Feb 11, 2025
@SoulPancake
Copy link
Contributor

Can you assign this to me? @rueian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants