Esempio n. 1
0
func removeCmd(r ring.Ring, b *ring.Builder, args []string) error {
	if r != nil {
		return fmt.Errorf("cannot remove a node from a ring; use with a builder instead")
	}
	if len(args) != 1 || !strings.HasPrefix(args[0], "id=") {
		return fmt.Errorf("must specify node to remove with id=<value>")
	}
	id, err := strconv.ParseUint(args[0][3:], 16, 64)
	if err != nil {
		return fmt.Errorf("invalid id %#v", args[0][3:])
	}
	b.RemoveNode(id)
	return nil
}