static class HFileBlockIndex.CellBasedKeyBlockIndexReader extends HFileBlockIndex.BlockIndexReader
| Modifier and Type | Field and Description |
|---|---|
private Cell[] |
blockKeys |
private CellComparator |
comparator
Needed doing lookup on blocks.
|
private AtomicReference<Cell> |
midKey
Pre-computed mid-key
|
blockDataSizes, blockOffsets, cachingBlockReader, midKeyEntry, midLeafBlockOffset, midLeafBlockOnDiskSize, rootCount, searchTreeLevel| Constructor and Description |
|---|
CellBasedKeyBlockIndexReader(CellComparator c,
int treeLevel) |
CellBasedKeyBlockIndexReader(CellComparator c,
int treeLevel,
HFile.CachingBlockReader cachingBlockReader) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(byte[] key,
long offset,
int dataSize)
Adds a new entry in the root block index.
|
protected long |
calculateHeapSizeForBlockKeys(long heapSize) |
Cell |
getRootBlockKey(int i) |
protected void |
initialize(int numEntries) |
boolean |
isEmpty() |
BlockWithScanInfo |
loadDataBlockWithScanInfo(Cell key,
HFileBlock currentBlock,
boolean cacheBlocks,
boolean pread,
boolean isCompaction,
DataBlockEncoding expectedDataBlockEncoding)
Return the BlockWithScanInfo, a data structure which contains the Data HFileBlock with
other scan info such as the key that starts the next HFileBlock.
|
Cell |
midkey()
An approximation to the
HFile's mid-key. |
int |
rootBlockContainingKey(byte[] key,
int offset,
int length,
CellComparator comp)
Finds the root-level index block containing the given key.
|
int |
rootBlockContainingKey(Cell key)
Finds the root-level index block containing the given key.
|
String |
toString() |
binarySearchNonRootIndex, ensureNonEmpty, getNonRootIndexedKey, getRootBlockCount, getRootBlockDataSize, getRootBlockOffset, heapSize, locateNonRootIndexEntry, readMultiLevelIndexRoot, readRootIndex, readRootIndex, rootBlockContainingKey, seekToDataBlockprivate AtomicReference<Cell> midKey
private CellComparator comparator
public CellBasedKeyBlockIndexReader(CellComparator c, int treeLevel, HFile.CachingBlockReader cachingBlockReader)
public CellBasedKeyBlockIndexReader(CellComparator c, int treeLevel)
protected long calculateHeapSizeForBlockKeys(long heapSize)
calculateHeapSizeForBlockKeys in class HFileBlockIndex.BlockIndexReaderpublic boolean isEmpty()
isEmpty in class HFileBlockIndex.BlockIndexReaderpublic Cell getRootBlockKey(int i)
i - from 0 to - 1public BlockWithScanInfo loadDataBlockWithScanInfo(Cell key, HFileBlock currentBlock, boolean cacheBlocks, boolean pread, boolean isCompaction, DataBlockEncoding expectedDataBlockEncoding) throws IOException
HFileBlockIndex.BlockIndexReaderloadDataBlockWithScanInfo in class HFileBlockIndex.BlockIndexReaderkey - the key we are looking forcurrentBlock - the current block, to avoid re-reading the same blockexpectedDataBlockEncoding - the data block encoding the caller is
expecting the data block to be in, or null to not perform this
check and return the block irrespective of the encoding.IOExceptionpublic Cell midkey() throws IOException
HFileBlockIndex.BlockIndexReaderHFile's mid-key. Operates on block
boundaries, and does not go inside blocks. In other words, returns the
first key of the middle block of the file.midkey in class HFileBlockIndex.BlockIndexReaderIOExceptionprotected void initialize(int numEntries)
initialize in class HFileBlockIndex.BlockIndexReaderprotected void add(byte[] key, long offset, int dataSize)
add in class HFileBlockIndex.BlockIndexReaderkey - Last key in the blockoffset - file offset where the block is storeddataSize - the uncompressed data sizepublic int rootBlockContainingKey(byte[] key, int offset, int length, CellComparator comp)
HFileBlockIndex.BlockIndexReaderrootBlockContainingKey in class HFileBlockIndex.BlockIndexReaderkey - Key to findcomp - the comparator to be usedkey (between 0 and the
number of blocks - 1) or -1 if this file does not contain the
request.public int rootBlockContainingKey(Cell key)
HFileBlockIndex.BlockIndexReaderrootBlockContainingKey in class HFileBlockIndex.BlockIndexReaderkey - Key to findCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.