cmdSlotWithPos computes the cluster slot for cmd given a pre-resolved first key position. Separating pos resolution from slot computation lets callers that already know pos avoid a redundant Peek() call.
(cmd Cmder, pos int, prefferedSlot int)
| 2367 | // position. Separating pos resolution from slot computation lets callers that |
| 2368 | // already know pos avoid a redundant Peek() call. |
| 2369 | func (c *ClusterClient) cmdSlotWithPos(cmd Cmder, pos int, prefferedSlot int) int { |
| 2370 | args := cmd.Args() |
| 2371 | if args[0] == "cluster" && (args[1] == "getkeysinslot" || args[1] == "countkeysinslot") { |
| 2372 | return args[2].(int) |
| 2373 | } |
| 2374 | return cmdSlot(cmd, pos, prefferedSlot) |
| 2375 | } |
| 2376 | |
| 2377 | func cmdSlot(cmd Cmder, pos int, prefferedRandomSlot int) int { |
| 2378 | if pos == 0 { |
no test coverage detected