| 1 |
package redis |
| 2 |
|
| 3 |
import ( |
| 4 |
"time" |
| 5 |
|
| 6 |
"gopkg.in/redis.v5/internal/pool" |
| 7 |
) |
| 8 |
|
| 9 |
func (c *baseClient) Pool() pool.Pooler { |
| 10 |
return c.connPool |
| 11 |
} |
| 12 |
|
| 13 |
func (c *PubSub) Pool() pool.Pooler { |
| 14 |
return c.base.connPool |
| 15 |
} |
| 16 |
|
| 17 |
func (c *PubSub) ReceiveMessageTimeout(timeout time.Duration) (*Message, error) { |
| 18 |
return c.receiveMessage(timeout) |
| 19 |
} |
| 20 |
|
| 21 |
func (c *ClusterClient) SlotAddrs(slot int) []string { |
| 22 |
var addrs []string |
| 23 |
for _, n := range c.state().slotNodes(slot) { |
| 24 |
addrs = append(addrs, n.Client.getAddr()) |
| 25 |
} |
| 26 |
return addrs |
| 27 |
} |
| 28 |
|
| 29 |
// SwapSlot swaps a slot's master/slave address for testing MOVED redirects. |
| 30 |
func (c *ClusterClient) SwapSlotNodes(slot int) []string { |
| 31 |
nodes := c.state().slots[slot] |
| 32 |
nodes[0], nodes[1] = nodes[1], nodes[0] |
| 33 |
return c.SlotAddrs(slot) |
| 34 |
} |