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

Method executeOnAllNodes

osscluster_router.go:82–94  ·  view source on GitHub ↗

executeOnAllNodes executes command on all nodes (masters and replicas)

(ctx context.Context, cmd Cmder, policy *routing.CommandPolicy)

Source from the content-addressed store, hash-verified

80
81// executeOnAllNodes executes command on all nodes (masters and replicas)
82func (c *ClusterClient) executeOnAllNodes(ctx context.Context, cmd Cmder, policy *routing.CommandPolicy) error {
83 state, err := c.state.Get(ctx)
84 if err != nil {
85 return err
86 }
87
88 nodes := append(state.Masters, state.Slaves...)
89 if len(nodes) == 0 {
90 return errClusterNoNodes
91 }
92
93 return c.executeParallel(ctx, cmd, nodes, policy)
94}
95
96// executeOnAllShards executes command on all master shards
97func (c *ClusterClient) executeOnAllShards(ctx context.Context, cmd Cmder, policy *routing.CommandPolicy) error {

Callers 1

routeAndRunMethod · 0.95

Calls 2

executeParallelMethod · 0.95
GetMethod · 0.65

Tested by

no test coverage detected