(cmd Cmder)
| 775 | } |
| 776 | |
| 777 | func (c *Ring) cmdShard(cmd Cmder) (*ringShard, error) { |
| 778 | // TODO: populate cmdsInfoCache lazily (via cmdsInfoCache.Get) so that |
| 779 | // the warm-cache branch in cmdFirstKeyPosWithInfo is reachable for Ring, |
| 780 | // mirroring how ClusterClient.cmdInfo works. For now pass nil |
| 781 | pos := cmdFirstKeyPosWithInfo(cmd, nil) |
| 782 | if pos == 0 { |
| 783 | return c.sharding.Random() |
| 784 | } |
| 785 | firstKey := cmd.stringArg(pos) |
| 786 | return c.sharding.GetByKey(firstKey) |
| 787 | } |
| 788 | |
| 789 | func (c *Ring) process(ctx context.Context, cmd Cmder) error { |
| 790 | var lastErr error |
no test coverage detected