Search in sources :

Example 1 with PartitionInfo

use of org.onosproject.store.service.PartitionInfo in project onos by opennetworkinglab.

the class PartitionsListCommand method displayPartitions.

/**
 * Displays partition info as text.
 *
 * @param partitionInfo partition descriptions
 */
private void displayPartitions(List<PartitionInfo> partitionInfo) {
    if (partitionInfo.isEmpty()) {
        return;
    }
    print("----------------------------------------------------------");
    print(SERVER_FMT, "Name", "Term", "Members", "");
    print("----------------------------------------------------------");
    for (PartitionInfo info : partitionInfo) {
        boolean first = true;
        for (String member : Ordering.natural().sortedCopy(info.members())) {
            if (first) {
                print(SERVER_FMT, info.id(), info.term(), member, member.equals(info.leader()) ? "*" : "");
                first = false;
            } else {
                print(SERVER_FMT, "", "", member, member.equals(info.leader()) ? "*" : "");
            }
        }
        if (!first) {
            print("----------------------------------------------------------");
        }
    }
}
Also used : PartitionInfo(org.onosproject.store.service.PartitionInfo)

Aggregations

PartitionInfo (org.onosproject.store.service.PartitionInfo)1