GetShardClientForKey returns the shard client that would handle the given key. This can be used to determine which shard a particular key/channel would be routed to.
(key string)
| 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. |
| 951 | func (c *Ring) GetShardClientForKey(key string) (*Client, error) { |
| 952 | shard, err := c.sharding.GetByKey(key) |
| 953 | if err != nil { |
| 954 | return nil, err |
| 955 | } |
| 956 | return shard.Client, nil |
| 957 | } |