public static Map getRootCount()

in stresso/src/main/java/stresso/trie/Diff.java [37:68]


  public static Map<String, Long> getRootCount(FluoClient client, Snapshot snap, int level,
      int stopLevel, int nodeSize) throws Exception {

    HashMap<String, Long> counts = new HashMap<>();

    RowScanner rows = snap.scanner().over(Span.prefix(String.format("%02d:", level)))
        .fetch(Constants.COUNT_SEEN_COL, Constants.COUNT_WAIT_COL).byRow().build();

    for (ColumnScanner columns : rows) {
      String row = columns.getsRow();
      Node node = new Node(row);

      while (node.getLevel() > stopLevel) {
        node = node.getParent();
      }

      String stopRow = node.getRowId();
      long count = counts.getOrDefault(stopRow, 0L);

      if (node.getNodeSize() == nodeSize) {
        for (ColumnValue colVal : columns) {
          count += Long.parseLong(colVal.getsValue());
        }
      } else {
        throw new RuntimeException("TODO");
      }

      counts.put(stopRow, count);
    }

    return counts;
  }