Determines the command requested of the user can calls the appropriate method. @param tsdb The TSDB to use for communication @param use_data_table Whether or not lookups should be done on the full data table @param args Arguments to parse @return An exit code
(final TSDB tsdb,
final boolean use_data_table,
final String[] args)
| 95 | * @return An exit code |
| 96 | */ |
| 97 | private static int runCommand(final TSDB tsdb, |
| 98 | final boolean use_data_table, |
| 99 | final String[] args) throws Exception { |
| 100 | final int nargs = args.length; |
| 101 | if (args[0].equals("lookup")) { |
| 102 | if (nargs < 2) { // need a query |
| 103 | usage(null, "Not enough arguments"); |
| 104 | return 2; |
| 105 | } |
| 106 | return lookup(tsdb, use_data_table, args); |
| 107 | } else { |
| 108 | usage(null, "Unknown sub command: " + args[0]); |
| 109 | return 2; |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Performs a time series lookup given a query like "metric tagk=tagv" where |