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

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

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.


Method Summary
static org.apache.hadoop.io.RawComparator<byte[]> createComparator(String comparatorClassName)
           
 void expectAtLeastVersion(int lowerBound)
           
 void expectVersion(int expected)
           
 Compression.Algorithm getCompressionCodec()
           
 int getDataIndexCount()
           
 long getEntryCount()
           
 long getFileInfoOffset()
           
 long getFirstDataBlockOffset()
           
 long getLastDataBlockOffset()
           
 long getLoadOnOpenDataOffset()
           
 int getMetaIndexCount()
           
 int getNumDataIndexLevels()
           
 long getTotalUncompressedBytes()
           
 int getTrailerSize()
           
 long getUncompressedDataIndexSize()
           
 int getVersion()
           
static FixedFileTrailer readFromStream(org.apache.hadoop.fs.FSDataInputStream istream, long fileSize)
          Reads a file trailer from the given file.
 void setComparatorClass(Class<? extends org.apache.hadoop.io.RawComparator> klass)
           
 void setCompressionCodec(Compression.Algorithm compressionCodec)
           
 void setDataIndexCount(int dataIndexCount)
           
 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

expectVersion

public void expectVersion(int expected)

expectAtLeastVersion

public void expectAtLeastVersion(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)

getVersion

public int getVersion()

setComparatorClass

public void setComparatorClass(Class<? extends org.apache.hadoop.io.RawComparator> klass)

createComparator

public static org.apache.hadoop.io.RawComparator<byte[]> createComparator(String comparatorClassName)
                                                                   throws IOException
Throws:
IOException

getUncompressedDataIndexSize

public long getUncompressedDataIndexSize()

setUncompressedDataIndexSize

public void setUncompressedDataIndexSize(long uncompressedDataIndexSize)


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.