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

Method cmdsMoved

osscluster.go:2088–2115  ·  view source on GitHub ↗
(
	ctx context.Context, cmds []Cmder,
	moved, ask bool,
	addr string,
	failedCmds *cmdsMap,
)

Source from the content-addressed store, hash-verified

2086}
2087
2088func (c *ClusterClient) cmdsMoved(
2089 ctx context.Context, cmds []Cmder,
2090 moved, ask bool,
2091 addr string,
2092 failedCmds *cmdsMap,
2093) error {
2094 node, err := c.nodes.GetOrCreate(addr)
2095 if err != nil {
2096 return err
2097 }
2098
2099 if moved {
2100 c.state.LazyReload()
2101 for _, cmd := range cmds {
2102 failedCmds.Add(node, cmd)
2103 }
2104 return nil
2105 }
2106
2107 if ask {
2108 for _, cmd := range cmds {
2109 failedCmds.Add(node, NewCmd(ctx, "asking"), cmd)
2110 }
2111 return nil
2112 }
2113
2114 return nil
2115}
2116
2117func (c *ClusterClient) Watch(ctx context.Context, fn func(*Tx) error, keys ...string) error {
2118 if len(keys) == 0 {

Callers 1

Calls 4

NewCmdFunction · 0.85
GetOrCreateMethod · 0.80
LazyReloadMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected