jrwest commented on code in PR #3733:
URL: https://github.com/apache/cassandra/pull/3733#discussion_r1886175424


##########
src/java/org/apache/cassandra/tools/nodetool/Status.java:
##########
@@ -24,38 +25,232 @@
 import java.io.PrintStream;
 import java.net.UnknownHostException;
 import java.text.DecimalFormat;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.SortedMap;
 
+import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.locator.EndpointSnitchInfoMBean;
+import org.apache.cassandra.locator.InetAddressAndPort;
 import org.apache.cassandra.tools.NodeProbe;
 import org.apache.cassandra.tools.NodeTool;
 import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
 import org.apache.cassandra.tools.nodetool.formatter.TableBuilder;
 
 import com.google.common.collect.ArrayListMultimap;
 
+import static java.util.stream.Collectors.toMap;
+
 @SuppressWarnings("UseOfSystemOutOrSystemErr")
 @Command(name = "status", description = "Print cluster information (state, 
load, IDs, ...)")
-public class Status extends NodeToolCmd
-{
+public class Status extends NodeToolCmd {
     @Arguments(usage = "[<keyspace>]", description = "The keyspace name")
     private String keyspace = null;
 
     @Option(title = "resolve_ip", name = {"-r", "--resolve-ip"}, description = 
"Show node domain names instead of IPs")
     private boolean resolveIp = false;
 
+    @Option(title = "sort",
+            name = {"-s", "--sort"},
+            description = "Sort by one of 'ip', 'load', 'owns', 'id', 'rack' 
or 'state', Defaults to 'none', Default Ordering is 'asc' for 'ip', 'id', 
'rack' and 'desc' for 'load', 'owns', 'state' ",
+            allowedValues = {"ip", "load", "owns", "id", "rack", "state", 
"none"})
+    private SortBy sortBy = SortBy.none;
+
+    @Option(title = "sort_order",
+            name = {"-o", "--order"},
+            description = "Sort order: 'asc' for ascending, 'desc' for 
descending",
+            allowedValues = {"asc", "desc"})
+    private SortOrder sortOrder = null;
+
     private boolean isTokenPerNode = true;
     private Collection<String> joiningNodes, leavingNodes, movingNodes, 
liveNodes, unreachableNodes;
     private Map<String, String> loadMap, hostIDMap;
     private EndpointSnitchInfoMBean epSnitchInfo;
 
+    public enum SortOrder {
+        asc,
+        desc
+    }
+
+    public enum SortBy

Review Comment:
   I just noticed there was some early discussion on this as well. I definitely 
like how its now split up per sort column but don't think we need the 
duplication of e.g. `data.entrySet().stream()` or in the `collect` call at the 
end either. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to