当前位置: 首页>>代码示例>>Java>>正文


Java Cell.getValueOffset方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.Cell.getValueOffset方法的典型用法代码示例。如果您正苦于以下问题:Java Cell.getValueOffset方法的具体用法?Java Cell.getValueOffset怎么用?Java Cell.getValueOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.Cell的用法示例。


在下文中一共展示了Cell.getValueOffset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: preWALWrite

import org.apache.hadoop.hbase.Cell; //导入方法依赖的package包/类
@Override
public boolean preWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> env,
    HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
  boolean bypass = false;
  // check table name matches or not.
  if (!Bytes.equals(info.getTableName(), this.tableName)) {
    return bypass;
  }
  preWALWriteCalled = true;
  // here we're going to remove one keyvalue from the WALEdit, and add
  // another one to it.
  List<Cell> cells = logEdit.getCells();
  Cell deletedCell = null;
  for (Cell cell : cells) {
    // assume only one kv from the WALEdit matches.
    byte[] family = cell.getFamily();
    byte[] qulifier = cell.getQualifier();

    if (Arrays.equals(family, ignoredFamily) &&
        Arrays.equals(qulifier, ignoredQualifier)) {
      LOG.debug("Found the KeyValue from WALEdit which should be ignored.");
      deletedCell = cell;
    }
    if (Arrays.equals(family, changedFamily) &&
        Arrays.equals(qulifier, changedQualifier)) {
      LOG.debug("Found the KeyValue from WALEdit which should be changed.");
      cell.getValueArray()[cell.getValueOffset()] += 1;
    }
  }
  if (null != row) {
    cells.add(new KeyValue(row, addedFamily, addedQualifier));
  }
  if (deletedCell != null) {
    LOG.debug("About to delete a KeyValue from WALEdit.");
    cells.remove(deletedCell);
  }
  return bypass;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:39,代码来源:SampleRegionWALObserver.java

示例2: getKeyValue

import org.apache.hadoop.hbase.Cell; //导入方法依赖的package包/类
/**
 * currently must do deep copy into new array
 */
@Override
public Cell getKeyValue() {
  Cell cell = ptSearcher.current();
  if (cell == null) {
    return null;
  }
  return new ClonedPrefixTreeCell(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(),
      cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength(),
      cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength(),
      cell.getValueArray(), cell.getValueOffset(), cell.getValueLength(), cell.getTagsArray(),
      cell.getTagsOffset(), cell.getTagsLength(), cell.getTimestamp(), cell.getTypeByte(),
      cell.getSequenceId());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:PrefixTreeSeeker.java

示例3: append

import org.apache.hadoop.hbase.Cell; //导入方法依赖的package包/类
/**
 * Add key/value to file. Keys must be added in an order that agrees with the
 * Comparator passed on construction.
 *
 * @param cell Cell to add. Cannot be empty nor null.
 * @throws IOException
 */
@Override
public void append(final Cell cell) throws IOException {
  byte[] value = cell.getValueArray();
  int voffset = cell.getValueOffset();
  int vlength = cell.getValueLength();
  // checkKey uses comparator to check we are writing in order.
  boolean dupKey = checkKey(cell);
  checkValue(value, voffset, vlength);
  if (!dupKey) {
    checkBlockBoundary();
  }

  if (!fsBlockWriter.isWriting()) {
    newBlock();
  }

  synchronized (HFileWriterV2.class) {
    if (WARN_CELL_WITH_TAGS && getFileContext().isIncludesTags()) {
      LOG.warn("A minimum HFile version of " + HFile.MIN_FORMAT_VERSION_WITH_TAGS
        + " is required to support cell attributes/tags. Consider setting "
        + HFile.FORMAT_VERSION_KEY + " accordingly.");
      WARN_CELL_WITH_TAGS = false;
    }
  }

  fsBlockWriter.write(cell);

  totalKeyLength += CellUtil.estimatedSerializedSizeOfKey(cell);
  totalValueLength += vlength;

  // Are we the first key in this block?
  if (firstCellInBlock == null) {
    // If cell is big, block will be closed and this firstCellInBlock reference will only last
    // a short while.
    firstCellInBlock = cell;
  }

  // TODO: What if cell is 10MB and we write infrequently?  We'll hold on to the cell here
  // indefinetly?
  lastCell = cell;
  entryCount++;
  this.maxMemstoreTS = Math.max(this.maxMemstoreTS, cell.getSequenceId());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:51,代码来源:HFileWriterV2.java


注:本文中的org.apache.hadoop.hbase.Cell.getValueOffset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。