(ctx context.Context, key string)
| 38 | } |
| 39 | |
| 40 | func (c *ClusterClient) Nodes(ctx context.Context, key string) ([]*clusterNode, error) { |
| 41 | state, err := c.state.Reload(ctx) |
| 42 | if err != nil { |
| 43 | return nil, err |
| 44 | } |
| 45 | |
| 46 | slot := hashtag.Slot(key) |
| 47 | nodes := state.slotNodes(slot) |
| 48 | if len(nodes) != 2 { |
| 49 | return nil, fmt.Errorf("slot=%d does not have enough nodes: %v", slot, nodes) |
| 50 | } |
| 51 | return nodes, nil |
| 52 | } |
| 53 | |
| 54 | func (c *ClusterClient) SwapNodes(ctx context.Context, key string) error { |
| 55 | nodes, err := c.Nodes(ctx, key) |
no test coverage detected