GetShardClients returns a list of all shard clients in the ring. This can be used to create dedicated connections (e.g., PubSub) for each shard.
()
| 936 | // GetShardClients returns a list of all shard clients in the ring. |
| 937 | // This can be used to create dedicated connections (e.g., PubSub) for each shard. |
| 938 | func (c *Ring) GetShardClients() []*Client { |
| 939 | shards := c.sharding.List() |
| 940 | clients := make([]*Client, 0, len(shards)) |
| 941 | for _, shard := range shards { |
| 942 | if shard.IsUp() { |
| 943 | clients = append(clients, shard.Client) |
| 944 | } |
| 945 | } |
| 946 | return clients |
| 947 | } |
| 948 | |
| 949 | // GetShardClientForKey returns the shard client that would handle the given key. |
| 950 | // This can be used to determine which shard a particular key/channel would be routed to. |
no test coverage detected