1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

feat: ring.SetAddrs to add and remove shards by the ring client and reuse old connections

test: ring scale-in and scale-out

rewrite as suggested by @AlexanderYastrebov
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
This commit is contained in:
Sandor Szücs
2022-05-23 22:14:49 +02:00
parent ce016ed85f
commit 6f7f800107
3 changed files with 156 additions and 15 deletions

View File

@ -93,3 +93,11 @@ func GetSlavesAddrByName(ctx context.Context, c *SentinelClient, name string) []
}
return parseReplicaAddrs(addrs, false)
}
func (c *Ring) GetAddr(addr string) *ringShard {
return c.shards.GetAddr(addr)
}
func (c *ringShards) GetAddr(addr string) *ringShard {
return c.shards[addr]
}