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


Java HFileBlockIndex类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.io.hfile.HFileBlockIndex的典型用法代码示例。如果您正苦于以下问题:Java HFileBlockIndex类的具体用法?Java HFileBlockIndex怎么用?Java HFileBlockIndex使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CompoundBloomFilter

import org.apache.hadoop.hbase.io.hfile.HFileBlockIndex; //导入依赖的package包/类
/**
 * De-serialization for compound Bloom filter metadata. Must be consistent
 * with what {@link CompoundBloomFilterWriter} does.
 *
 * @param meta serialized Bloom filter metadata without any magic blocks
 * @throws IOException
 */
public CompoundBloomFilter(DataInput meta, HFile.Reader reader)
    throws IOException {
  this.reader = reader;

  totalByteSize = meta.readLong();
  hashCount = meta.readInt();
  hashType = meta.readInt();
  totalKeyCount = meta.readLong();
  totalMaxKeys = meta.readLong();
  numChunks = meta.readInt();
  comparator = FixedFileTrailer.createComparator(
      Bytes.toString(Bytes.readByteArray(meta)));

  hash = Hash.getInstance(hashType);
  if (hash == null) {
    throw new IllegalArgumentException("Invalid hash type: " + hashType);
  }

  index = new HFileBlockIndex.BlockIndexReader(comparator, 1);
  index.readRootIndex(meta, numChunks);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:CompoundBloomFilter.java

示例2: finishInit

import org.apache.hadoop.hbase.io.hfile.HFileBlockIndex; //导入依赖的package包/类
@Override
protected void finishInit(final Configuration conf) {
  if (null != fsBlockWriter)
    throw new IllegalStateException("finishInit called twice");

  fsBlockWriter = new PFileBlockWriter(blockEncoder, hFileContext);

  boolean cacheIndexesOnWrite = cacheConf.shouldCacheIndexesOnWrite();
  dataBlockIndexWriter = new HFileBlockIndex.BlockIndexWriter(fsBlockWriter,
      cacheIndexesOnWrite ? cacheConf.getBlockCache(): null,
      cacheIndexesOnWrite ? name : null);
  dataBlockIndexWriter.setMaxChunkSize(
      HFileBlockIndex.getMaxChunkSize(conf));
  inlineBlockWriters.add(dataBlockIndexWriter);

  // Meta data block index writer
  metaBlockIndexWriter = new HFileBlockIndex.BlockIndexWriter();
  if (LOG.isTraceEnabled()) LOG.trace("Initialized with " + cacheConf);
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:20,代码来源:PFileWriter.java

示例3: addStoreFileCutpoints

import org.apache.hadoop.hbase.io.hfile.HFileBlockIndex; //导入依赖的package包/类
private static int addStoreFileCutpoints(List<byte[]> cutpoints, HFile.Reader fileReader, long storeFileInBytes, int carry, Pair<byte[], byte[]> range, int splitBlockSize) throws IOException {
    HFileBlockIndex.BlockIndexReader indexReader = fileReader.getDataBlockIndexReader();
    int size = indexReader.getRootBlockCount();
    int levels = fileReader.getTrailer().getNumDataIndexLevels();
    if (levels == 1) {
        int incrementalSize = (int) (size > 0 ? storeFileInBytes / (float) size : storeFileInBytes);
        int sizeCounter = 0;
        for (int i = 0; i < size; ++i) {
            if (sizeCounter >= splitBlockSize) {
                sizeCounter = 0;
                KeyValue tentative = KeyValue.createKeyValueFromKey(indexReader.getRootBlockKey(i));
                if (CellUtils.isKeyValueInRange(tentative, range)) {
                    cutpoints.add(tentative.getRow());
                }
            }
            sizeCounter += incrementalSize;
        }
     return sizeCounter;
    } else {
        for (int i = 0; i < size; ++i) {
            HFileBlock block = fileReader.readBlock(
                    indexReader.getRootBlockOffset(i),
                    indexReader.getRootBlockDataSize(i),
                    true, true, false, true,
                    levels == 2 ? BlockType.LEAF_INDEX : BlockType.INTERMEDIATE_INDEX,
                    fileReader.getDataBlockEncoding());
            carry = addIndexCutpoints(fileReader, block.getBufferWithoutHeader(), levels - 1,  cutpoints, storeFileInBytes / size, carry, range, splitBlockSize);
        }
     return carry;
    }
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:32,代码来源:HRegionUtil.java


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