func partitionCmd(r ring.Ring, b *ring.Builder, args []string) error { if b != nil { return fmt.Errorf("cannot use partition command with a builder; generate a ring and use it on that") } if len(args) != 1 { return fmt.Errorf("use the syntax: partition <value>") } p, err := strconv.Atoi(args[0]) if err != nil { return err } first := true for _, n := range r.ResponsibleNodes(uint32(p)) { if first { first = false } else { fmt.Println() } report := [][]string{ []string{"ID:", fmt.Sprintf("%016x", n.ID())}, []string{"Capacity:", fmt.Sprintf("%d", n.Capacity())}, []string{"Tiers:", strings.Join(n.Tiers(), "\n")}, []string{"Addresses:", strings.Join(n.Addresses(), "\n")}, []string{"Meta:", n.Meta()}, } fmt.Print(brimtext.Align(report, nil)) } return nil }