export_test.go 742 B

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