當前位置: 首頁>>代碼示例>>Java>>正文


Java CellUtil.estimatedSerializedSizeOf方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.CellUtil.estimatedSerializedSizeOf方法的典型用法代碼示例。如果您正苦於以下問題:Java CellUtil.estimatedSerializedSizeOf方法的具體用法?Java CellUtil.estimatedSerializedSizeOf怎麽用?Java CellUtil.estimatedSerializedSizeOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.CellUtil的用法示例。


在下文中一共展示了CellUtil.estimatedSerializedSizeOf方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: append

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
@Override
public long append(HTableDescriptor htd, HRegionInfo info, WALKey key, WALEdit edits,
                   boolean inMemstore) {
  if (!this.listeners.isEmpty()) {
    final long start = System.nanoTime();
    long len = 0;
    for (Cell cell : edits.getCells()) {
      len += CellUtil.estimatedSerializedSizeOf(cell);
    }
    final long elapsed = (System.nanoTime() - start)/1000000l;
    for (WALActionsListener listener : this.listeners) {
      listener.postAppend(len, elapsed);
    }
  }
  return -1;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:17,代碼來源:DisabledWALProvider.java

示例2: next

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
@Override
public Result next() throws IOException {
  values.clear();
  scanner.nextRaw(values);
  if (values.isEmpty()) {
    //we are done
    return null;
  }

  Result result = Result.create(values);
  if (this.scanMetrics != null) {
    long resultSize = 0;
    for (Cell cell : values) {
      resultSize += CellUtil.estimatedSerializedSizeOf(cell);
    }
    this.scanMetrics.countOfBytesInResults.addAndGet(resultSize);
  }

  return result;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:21,代碼來源:ClientSideRegionScanner.java

示例3: getSizedCellScanner

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
static CellScanner getSizedCellScanner(final Cell [] cells) {
  int size = -1;
  for (Cell cell: cells) {
    size += CellUtil.estimatedSerializedSizeOf(cell);
  }
  final int totalSize = ClassSize.align(size);
  final CellScanner cellScanner = CellUtil.createCellScanner(cells);
  return new SizedCellScanner() {
    @Override
    public long heapSize() {
      return totalSize;
    }

    @Override
    public Cell current() {
      return cellScanner.current();
    }

    @Override
    public boolean advance() throws IOException {
      return cellScanner.advance();
    }
  };
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:25,代碼來源:TestIPCUtil.java

示例4: postAppend

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
private long postAppend(final Entry e, final long elapsedTime) {
  long len = 0;
  if (!listeners.isEmpty()) {
    for (Cell cell : e.getEdit().getCells()) {
      len += CellUtil.estimatedSerializedSizeOf(cell);
    }
    for (WALActionsListener listener : listeners) {
      listener.postAppend(len, elapsedTime);
    }
  }
  return len;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:13,代碼來源:FSHLog.java

示例5: updateResultsMetrics

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
protected void updateResultsMetrics(Result[] rrs) {
  if (this.scanMetrics == null || rrs == null || rrs.length == 0) {
    return;
  }
  long resultSize = 0;
  for (Result rr : rrs) {
    for (Cell cell : rr.rawCells()) {
      resultSize += CellUtil.estimatedSerializedSizeOf(cell);
    }
  }
  this.scanMetrics.countOfBytesInResults.addAndGet(resultSize);
  if (isRegionServerRemote) {
    this.scanMetrics.countOfBytesInRemoteResults.addAndGet(resultSize);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:ScannerCallable.java

示例6: buildReplicateWALEntryRequest

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
/**
 * Create a new ReplicateWALEntryRequest from a list of HLog entries
 *
 * @param entries the HLog entries to be replicated
 * @param encodedRegionName alternative region name to use if not null
 * @return a pair of ReplicateWALEntryRequest and a CellScanner over all the WALEdit values
 * found.
 */
public static Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner>
    buildReplicateWALEntryRequest(final Entry[] entries, byte[] encodedRegionName) {
  // Accumulate all the KVs seen in here.
  List<List<? extends Cell>> allCells = new ArrayList<List<? extends Cell>>(entries.length);
  int size = 0;
  WALProtos.FamilyScope.Builder scopeBuilder = WALProtos.FamilyScope.newBuilder();
  AdminProtos.WALEntry.Builder entryBuilder = AdminProtos.WALEntry.newBuilder();
  AdminProtos.ReplicateWALEntryRequest.Builder builder =
    AdminProtos.ReplicateWALEntryRequest.newBuilder();
  HBaseProtos.UUID.Builder uuidBuilder = HBaseProtos.UUID.newBuilder();
  for (Entry entry: entries) {
    entryBuilder.clear();
    // TODO: this duplicates a lot in WALKey#getBuilder
    WALProtos.WALKey.Builder keyBuilder = entryBuilder.getKeyBuilder();
    WALKey key = entry.getKey();
    keyBuilder.setEncodedRegionName(
      ByteStringer.wrap(encodedRegionName == null
          ? key.getEncodedRegionName()
          : encodedRegionName));
    keyBuilder.setTableName(ByteStringer.wrap(key.getTablename().getName()));
    keyBuilder.setLogSequenceNumber(key.getLogSeqNum());
    keyBuilder.setWriteTime(key.getWriteTime());
    if (key.getNonce() != HConstants.NO_NONCE) {
      keyBuilder.setNonce(key.getNonce());
    }
    if (key.getNonceGroup() != HConstants.NO_NONCE) {
      keyBuilder.setNonceGroup(key.getNonceGroup());
    }
    for(UUID clusterId : key.getClusterIds()) {
      uuidBuilder.setLeastSigBits(clusterId.getLeastSignificantBits());
      uuidBuilder.setMostSigBits(clusterId.getMostSignificantBits());
      keyBuilder.addClusterIds(uuidBuilder.build());
    }
    if(key.getOrigLogSeqNum() > 0) {
      keyBuilder.setOrigSequenceNumber(key.getOrigLogSeqNum());
    }
    WALEdit edit = entry.getEdit();
    NavigableMap<byte[], Integer> scopes = key.getScopes();
    if (scopes != null && !scopes.isEmpty()) {
      for (Map.Entry<byte[], Integer> scope: scopes.entrySet()) {
        scopeBuilder.setFamily(ByteStringer.wrap(scope.getKey()));
        WALProtos.ScopeType scopeType =
            WALProtos.ScopeType.valueOf(scope.getValue().intValue());
        scopeBuilder.setScopeType(scopeType);
        keyBuilder.addScopes(scopeBuilder.build());
      }
    }
    List<Cell> cells = edit.getCells();
    // Add up the size.  It is used later serializing out the cells.
    for (Cell cell: cells) {
      size += CellUtil.estimatedSerializedSizeOf(cell);
    }
    // Collect up the cells
    allCells.add(cells);
    // Write out how many cells associated with this entry.
    entryBuilder.setAssociatedCellCount(cells.size());
    builder.addEntry(entryBuilder.build());
  }
  return new Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner>(builder.build(),
    getCellScanner(allCells, size));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:70,代碼來源:ReplicationProtbufUtil.java


注:本文中的org.apache.hadoop.hbase.CellUtil.estimatedSerializedSizeOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。