func doCommand(c *redisconn.Conn, cmd string, args ...interface{}) (*parser.Resp, error) { writeCommand(c, cmd, args...) if err := c.Flush(); err != nil { return nil, errors.Trace(err) } resp, err := parser.Parse(c.BufioReader()) if err != nil { return nil, errors.Trace(err) } return resp, nil }
func writeMigrateKeyCmd(c *redisconn.Conn, addr string, timeoutMs int, keys ...[]byte) error { hostPort := strings.Split(addr, ":") if len(hostPort) != 2 { return errors.Errorf("invalid address " + addr) } for _, key := range keys { err := writeCommand(c, "SLOTSMGRTTAGONE", hostPort[0], hostPort[1], int(timeoutMs), key) if err != nil { return errors.Trace(err) } } return errors.Trace(c.Flush()) }