Interface HFile.CachingBlockReader

All Known Subinterfaces:
HFile.Reader
All Known Implementing Classes:
HFilePreadReader, HFileReaderImpl, HFileStreamReader
Enclosing class:
HFile

public static interface HFile.CachingBlockReader
An abstraction used by the block index. Implementations will check cache for any asked-for block and return cached block if found. Otherwise, after reading from fs, will try and put block into cache before returning.
  • Method Summary

    Modifier and Type
    Method
    Description
    readBlock(long offset, long onDiskBlockSize, boolean cacheBlock, boolean pread, boolean isCompaction, boolean updateCacheMetrics, BlockType expectedBlockType, DataBlockEncoding expectedDataBlockEncoding)
    Read in a file block.
    readBlock(long offset, long onDiskBlockSize, boolean cacheBlock, boolean pread, boolean isCompaction, boolean updateCacheMetrics, BlockType expectedBlockType, DataBlockEncoding expectedDataBlockEncoding, boolean cacheOnly)
     
  • Method Details

    • readBlock

      HFileBlock readBlock(long offset, long onDiskBlockSize, boolean cacheBlock, boolean pread, boolean isCompaction, boolean updateCacheMetrics, BlockType expectedBlockType, DataBlockEncoding expectedDataBlockEncoding) throws IOException
      Read in a file block.
      Parameters:
      offset - offset to read.
      onDiskBlockSize - size of the block
      isCompaction - is this block being read as part of a compaction
      expectedBlockType - the block type we are expecting to read with this read operation, or null to read whatever block type is available and avoid checking (that might reduce caching efficiency of encoded data blocks)
      expectedDataBlockEncoding - the data block encoding the caller is expecting data blocks to be in, or null to not perform this check and return the block irrespective of the encoding. This check only applies to data blocks and can be set to null when the caller is expecting to read a non-data block and has set expectedBlockType accordingly.
      Returns:
      Block wrapped in a ByteBuffer.
      Throws:
      IOException
    • readBlock

      HFileBlock readBlock(long offset, long onDiskBlockSize, boolean cacheBlock, boolean pread, boolean isCompaction, boolean updateCacheMetrics, BlockType expectedBlockType, DataBlockEncoding expectedDataBlockEncoding, boolean cacheOnly) throws IOException
      Throws:
      IOException