Package org.apache.hadoop.hbase.io.hfile
Class HFileBlockIndex.ByteArrayKeyBlockIndexReader
java.lang.Object
org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexReader
org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.ByteArrayKeyBlockIndexReader
- All Implemented Interfaces:
- HeapSize
- Enclosing class:
- HFileBlockIndex
An implementation of the BlockIndexReader that deals with block keys which are plain byte[]
 like MetaBlock or the Bloom Block for ROW bloom. Does not need a comparator. It can work on
 Bytes.BYTES_RAWCOMPARATOR
- 
Field SummaryFieldsFields inherited from class org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexReaderblockDataSizes, blockOffsets, midKeyEntry, midLeafBlockOffset, midLeafBlockOnDiskSize, rootCount, searchTreeLevel
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidadd(byte[] key, long offset, int dataSize) protected longcalculateHeapSizeForBlockKeys(long heapSize) byte[]getRootBlockKey(int i) from 0 to- 1protected voidinitialize(int numEntries) booleanisEmpty()Returns true if the block index is empty.loadDataBlockWithScanInfo(ExtendedCell key, HFileBlock currentBlock, boolean cacheBlocks, boolean pread, boolean isCompaction, DataBlockEncoding expectedDataBlockEncoding, HFile.CachingBlockReader cachingBlockReader) Return the BlockWithScanInfo, a data structure which contains the Data HFileBlock with other scan info such as the key that starts the next HFileBlock.midkey(HFile.CachingBlockReader cachingBlockReader) An approximation to theHFile's mid-key.introotBlockContainingKey(byte[] key, int offset, int length, CellComparator comp) Finds the root-level index block containing the given key.intFinds the root-level index block containing the given key.toString()Methods inherited from class org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexReaderbinarySearchNonRootIndex, ensureNonEmpty, getNonRootIndexedKey, getRootBlockCount, getRootBlockDataSize, getRootBlockOffset, heapSize, locateNonRootIndexEntry, readMultiLevelIndexRoot, readRootIndex, readRootIndex, rootBlockContainingKey, seekToDataBlock
- 
Field Details- 
blockKeys
 
- 
- 
Constructor Details- 
ByteArrayKeyBlockIndexReader
 
- 
- 
Method Details- 
calculateHeapSizeForBlockKeys- Specified by:
- calculateHeapSizeForBlockKeysin class- HFileBlockIndex.BlockIndexReader
 
- 
isEmptyDescription copied from class:HFileBlockIndex.BlockIndexReaderReturns true if the block index is empty.- Specified by:
- isEmptyin class- HFileBlockIndex.BlockIndexReader
 
- 
getRootBlockKeyfrom 0 to- 1
- 
loadDataBlockWithScanInfopublic BlockWithScanInfo loadDataBlockWithScanInfo(ExtendedCell key, HFileBlock currentBlock, boolean cacheBlocks, boolean pread, boolean isCompaction, DataBlockEncoding expectedDataBlockEncoding, HFile.CachingBlockReader cachingBlockReader) throws IOException Description copied from class:HFileBlockIndex.BlockIndexReaderReturn the BlockWithScanInfo, a data structure which contains the Data HFileBlock with other scan info such as the key that starts the next HFileBlock. This function will only be called when the HFile version is larger than 1.- Specified by:
- loadDataBlockWithScanInfoin class- HFileBlockIndex.BlockIndexReader
- Parameters:
- key- the key we are looking for
- currentBlock- the current block, to avoid re-reading the same block
- expectedDataBlockEncoding- 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.
- Returns:
- the BlockWithScanInfo which contains the DataBlock with other scan info such as nextIndexedKey.
- Throws:
- IOException
 
- 
midkeyDescription copied from class:HFileBlockIndex.BlockIndexReaderAn approximation to theHFile'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.- Specified by:
- midkeyin class- HFileBlockIndex.BlockIndexReader
- Returns:
- the first key of the middle block
- Throws:
- IOException
 
- 
initialize- Specified by:
- initializein class- HFileBlockIndex.BlockIndexReader
 
- 
add- Specified by:
- addin class- HFileBlockIndex.BlockIndexReader
 
- 
rootBlockContainingKeyDescription copied from class:HFileBlockIndex.BlockIndexReaderFinds the root-level index block containing the given key. Key to find the comparator to be used- Specified by:
- rootBlockContainingKeyin class- HFileBlockIndex.BlockIndexReader
- Returns:
- Offset of block containing key(between 0 and the number of blocks - 1) or -1 if this file does not contain the request.
 
- 
rootBlockContainingKeyDescription copied from class:HFileBlockIndex.BlockIndexReaderFinds the root-level index block containing the given key. Key to find- Specified by:
- rootBlockContainingKeyin class- HFileBlockIndex.BlockIndexReader
 
- 
toString
 
-