コード例 #1
0
 @Override
 public synchronized DynamicPartitionMapImpl getMap() {
   ClosableIterator<RowResult<Value>> iterator =
       storage.getRange(PARTITION_MAP_TABLE, RangeRequest.all(), 1L);
   Map<Cell, byte[]> cells = Maps.newHashMap();
   while (iterator.hasNext()) {
     RowResult<Value> row = iterator.next();
     for (Entry<Cell, Value> entry : row.getCells()) {
       assert !cells.containsKey(entry.getKey());
       cells.put(entry.getKey(), entry.getValue().getContents());
     }
   }
   iterator.close();
   return DynamicPartitionMapImpl.fromTable(cells);
 }
コード例 #2
0
 private boolean isLatestValueEmpty(Cell cell, PeekingIterator<RowResult<Value>> values) {
   while (values.hasNext()) {
     RowResult<Value> result = values.peek();
     int comparison =
         UnsignedBytes.lexicographicalComparator().compare(cell.getRowName(), result.getRowName());
     if (comparison == 0) {
       Value matchingValue = result.getColumns().get(cell.getColumnName());
       return matchingValue != null && matchingValue.getContents().length == 0;
     } else if (comparison < 0) {
       return false;
     } else {
       values.next();
     }
   }
   return false;
 }