MCPcopy
hub / github.com/redis/go-redis / Nodes

Method Nodes

export_test.go:40–52  ·  view source on GitHub ↗
(ctx context.Context, key string)

Source from the content-addressed store, hash-verified

38}
39
40func (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
54func (c *ClusterClient) SwapNodes(ctx context.Context, key string) error {
55 nodes, err := c.Nodes(ctx, key)

Callers 2

SwapNodesMethod · 0.95
osscluster_test.goFile · 0.80

Calls 3

SlotFunction · 0.92
ReloadMethod · 0.80
slotNodesMethod · 0.80

Tested by

no test coverage detected