Beispiel #1
0
func WriteMigrateKeyCmd(w io.Writer, addr string, timeoutMs int, key []byte) error {
	hostPort := strings.Split(addr, ":")
	if len(hostPort) != 2 {
		return errors.Errorf("invalid address " + addr)
	}
	respW := respcoding.NewRESPWriter(w)
	err := respW.WriteCommand("slotsmgrttagone", hostPort[0], hostPort[1],
		strconv.Itoa(int(timeoutMs)), string(key))
	return errors.Trace(err)
}
Beispiel #2
0
func ledisWriteMigrateKeyCmd(w io.Writer, addr string, timeoutMs int, group string, key []byte, slotIndex int) error {
	hostPort := strings.Split(addr, ":")
	if len(hostPort) != 2 {
		return errors.Errorf("invalid address " + addr)
	}
	respW := respcoding.NewRESPWriter(w)
	err := respW.WriteCommand("xmigrate", hostPort[0], hostPort[1],
		group, string(key), strconv.Itoa(slotIndex), strconv.Itoa(int(timeoutMs)))
	return errors.Trace(err)
}