org.apache.hadoop.hbase.io.hfile
Class FixedFileTrailer

java.lang.Object
  extended by org.apache.hadoop.hbase.io.hfile.FixedFileTrailer

@InterfaceAudience.Private
public class FixedFileTrailer
extends Object

The HFile has a fixed trailer which contains offsets to other variable parts of the file. Also includes basic metadata on this file. The trailer size is fixed within a given HFile format version only, but we always store the version number as the last four-byte integer of the file. The version number itself is split into two portions, a major version and a minor version. The last three bytes of a file are the major version and a single preceding byte is the minor number. The major version determines which readers/writers to use to read/write a hfile while a minor version determines smaller changes in hfile format that do not need a new reader/writer type.


Method Summary
static KeyValue.KVComparator createComparator(String comparatorClassName)
           
 void expectAtLeastMajorVersion(int lowerBound)
           
 void expectMajorVersion(int expected)
           
 void expectMinorVersion(int expected)
           
 String getComparatorClassName()
           
 Compression.Algorithm getCompressionCodec()
           
 int getDataIndexCount()
           
 byte[] getEncryptionKey()
           
 long getEntryCount()
           
 long getFileInfoOffset()
           
 long getFirstDataBlockOffset()
           
 long getLastDataBlockOffset()
           
 long getLoadOnOpenDataOffset()
           
 int getMajorVersion()
          Returns the major version of this HFile format
 int getMetaIndexCount()
           
 int getMinorVersion()
          Returns the minor version of this HFile format
 int getNumDataIndexLevels()
           
 long getTotalUncompressedBytes()
           
 int getTrailerSize()
           
 long getUncompressedDataIndexSize()
           
static FixedFileTrailer readFromStream(org.apache.hadoop.fs.FSDataInputStream istream, long fileSize)
          Reads a file trailer from the given file.
 void setComparatorClass(Class<? extends KeyValue.KVComparator> klass)
           
 void setCompressionCodec(Compression.Algorithm compressionCodec)
           
 void setDataIndexCount(int dataIndexCount)
           
 void setEncryptionKey(byte[] keyBytes)
           
 void setEntryCount(long newEntryCount)
           
 void setFileInfoOffset(long fileInfoOffset)
           
 void setFirstDataBlockOffset(long firstDataBlockOffset)
           
 void setLastDataBlockOffset(long lastDataBlockOffset)
           
 void setLoadOnOpenOffset(long loadOnOpenDataOffset)
           
 void setMetaIndexCount(int metaIndexCount)
           
 void setNumDataIndexLevels(int numDataIndexLevels)
           
 void setTotalUncompressedBytes(long totalUncompressedBytes)
           
 void setUncompressedDataIndexSize(long uncompressedDataIndexSize)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getTrailerSize

public int getTrailerSize()

toString

public String toString()
Overrides:
toString in class Object

readFromStream

public static FixedFileTrailer readFromStream(org.apache.hadoop.fs.FSDataInputStream istream,
                                              long fileSize)
                                       throws IOException
Reads a file trailer from the given file.

Parameters:
istream - the input stream with the ability to seek. Does not have to be buffered, as only one read operation is made.
fileSize - the file size. Can be obtained using FileSystem.getFileStatus( org.apache.hadoop.fs.Path).
Returns:
the fixed file trailer read
Throws:
IOException - if failed to read from the underlying stream, or the trailer is corrupted, or the version of the trailer is unsupported

expectMajorVersion

public void expectMajorVersion(int expected)

expectMinorVersion

public void expectMinorVersion(int expected)

expectAtLeastMajorVersion

public void expectAtLeastMajorVersion(int lowerBound)

getFileInfoOffset

public long getFileInfoOffset()

setFileInfoOffset

public void setFileInfoOffset(long fileInfoOffset)

getLoadOnOpenDataOffset

public long getLoadOnOpenDataOffset()

setLoadOnOpenOffset

public void setLoadOnOpenOffset(long loadOnOpenDataOffset)

getDataIndexCount

public int getDataIndexCount()

setDataIndexCount

public void setDataIndexCount(int dataIndexCount)

getMetaIndexCount

public int getMetaIndexCount()

setMetaIndexCount

public void setMetaIndexCount(int metaIndexCount)

getTotalUncompressedBytes

public long getTotalUncompressedBytes()

setTotalUncompressedBytes

public void setTotalUncompressedBytes(long totalUncompressedBytes)

getEntryCount

public long getEntryCount()

setEntryCount

public void setEntryCount(long newEntryCount)

getCompressionCodec

public Compression.Algorithm getCompressionCodec()

setCompressionCodec

public void setCompressionCodec(Compression.Algorithm compressionCodec)

getNumDataIndexLevels

public int getNumDataIndexLevels()

setNumDataIndexLevels

public void setNumDataIndexLevels(int numDataIndexLevels)

getLastDataBlockOffset

public long getLastDataBlockOffset()

setLastDataBlockOffset

public void setLastDataBlockOffset(long lastDataBlockOffset)

getFirstDataBlockOffset

public long getFirstDataBlockOffset()

setFirstDataBlockOffset

public void setFirstDataBlockOffset(long firstDataBlockOffset)

getComparatorClassName

public String getComparatorClassName()

getMajorVersion

public int getMajorVersion()
Returns the major version of this HFile format


getMinorVersion

public int getMinorVersion()
Returns the minor version of this HFile format


setComparatorClass

public void setComparatorClass(Class<? extends KeyValue.KVComparator> klass)

createComparator

public static KeyValue.KVComparator createComparator(String comparatorClassName)
                                              throws IOException
Throws:
IOException

getUncompressedDataIndexSize

public long getUncompressedDataIndexSize()

setUncompressedDataIndexSize

public void setUncompressedDataIndexSize(long uncompressedDataIndexSize)

getEncryptionKey

public byte[] getEncryptionKey()

setEncryptionKey

public void setEncryptionKey(byte[] keyBytes)


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.