From 143859e34596a8e80ee858b5842d503d86572249 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Wed, 16 Dec 2020 17:45:06 +0200 Subject: [PATCH] Rename --- cluster.go | 4 ++-- cluster_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cluster.go b/cluster.go index d2e78b2..3807265 100644 --- a/cluster.go +++ b/cluster.go @@ -1655,13 +1655,13 @@ func (c *ClusterClient) slotMasterNode(ctx context.Context, slot int) (*clusterN return state.slotMasterNode(slot) } -// ReplicaForKey gets a client for a replica node to run any command on it. +// SlaveForKey gets a client for a replica node to run any command on it. // This is especially useful if we want to run a particular lua script which has // only read only commands on the replica. // This is because other redis commands generally have a flag that points that // they are read only and automatically run on the replica nodes // if ClusterOptions.ReadOnly flag is set to true. -func (c *ClusterClient) ReplicaForKey(ctx context.Context, key string) (*Client, error) { +func (c *ClusterClient) SlaveForKey(ctx context.Context, key string) (*Client, error) { state, err := c.state.Get(ctx) if err != nil { return nil, err diff --git a/cluster_test.go b/cluster_test.go index 7977998..64acecf 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -865,7 +865,7 @@ var _ = Describe("ClusterClient", func() { }) It("should return correct replica for key", func() { - client, err := client.ReplicaForKey(ctx, "test") + client, err := client.SlaveForKey(ctx, "test") Expect(err).ToNot(HaveOccurred()) info := client.Info(ctx, "server") Expect(info.Val()).Should(ContainSubstring("tcp_port:8224"))