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, seekToDataBlock
private 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.BlockIndexReader
public boolean isEmpty()
isEmpty
in class HFileBlockIndex.BlockIndexReader
public Cell getRootBlockKey(int i)
i
- from 0 to - 1
public BlockWithScanInfo loadDataBlockWithScanInfo(Cell key, HFileBlock currentBlock, boolean cacheBlocks, boolean pread, boolean isCompaction, DataBlockEncoding expectedDataBlockEncoding) throws IOException
HFileBlockIndex.BlockIndexReader
loadDataBlockWithScanInfo
in class HFileBlockIndex.BlockIndexReader
key
- 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.IOException
public Cell midkey() throws IOException
HFileBlockIndex.BlockIndexReader
HFile
'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.BlockIndexReader
IOException
protected void initialize(int numEntries)
initialize
in class HFileBlockIndex.BlockIndexReader
protected void add(byte[] key, long offset, int dataSize)
add
in class HFileBlockIndex.BlockIndexReader
key
- 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.BlockIndexReader
rootBlockContainingKey
in class HFileBlockIndex.BlockIndexReader
key
- 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.BlockIndexReader
rootBlockContainingKey
in class HFileBlockIndex.BlockIndexReader
key
- Key to findCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.