(master string)
| 184 | } |
| 185 | |
| 186 | func (c *Client) SetMaster(master string) error { |
| 187 | host, port, err := net.SplitHostPort(master) |
| 188 | if err != nil { |
| 189 | return errors.Trace(err) |
| 190 | } |
| 191 | c.Send("MULTI") |
| 192 | c.Send("CONFIG", "SET", "masterauth", c.Auth) |
| 193 | c.Send("SLAVEOF", host, port) |
| 194 | c.Send("CONFIG", "REWRITE") |
| 195 | c.Send("CLIENT", "KILL", "TYPE", "normal") |
| 196 | values, err := redigo.Values(c.Do("EXEC")) |
| 197 | if err != nil { |
| 198 | return errors.Trace(err) |
| 199 | } |
| 200 | for _, r := range values { |
| 201 | if err, ok := r.(redigo.Error); ok { |
| 202 | return errors.Trace(err) |
| 203 | } |
| 204 | } |
| 205 | return nil |
| 206 | } |
| 207 | |
| 208 | func (c *Client) MigrateSlot(slot int, target string) (int, error) { |
| 209 | host, port, err := net.SplitHostPort(target) |
no test coverage detected