org.apache.hadoop.hbase.regionserver
Class StoreFile.Writer

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.StoreFile.Writer
Enclosing class:
StoreFile

public static class StoreFile.Writer
extends Object

A StoreFile writer. Use this to read/write HBase Store Files. It is package local because it is an implementation detail of the HBase regionserver.


Field Summary
protected  HFile.Writer writer
           
 
Constructor Summary
StoreFile.Writer(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, int blocksize, Compression.Algorithm compress, org.apache.hadoop.conf.Configuration conf, KeyValue.KVComparator comparator, StoreFile.BloomType bloomType, int maxKeys)
          Creates an HFile.Writer that also write helpful meta data.
 
Method Summary
 void append(byte[] key, byte[] value)
           
 void append(KeyValue kv)
           
 void appendFileInfo(byte[] key, byte[] value)
           
 void appendMetadata(long maxSequenceId, boolean majorCompaction)
          Writes meta data.
 void appendTimeRangeMetadata()
          Add TimestampRange to Metadata
 void close()
           
 org.apache.hadoop.fs.Path getPath()
           
 void includeInTimeRangeTracker(byte[] key)
          If the timeRangeTracker is not set, update TimeRangeTracker to include the timestamp of this key
 void includeInTimeRangeTracker(KeyValue kv)
          If the timeRangeTracker is not set, update TimeRangeTracker to include the timestamp of this key
 void setTimeRangeTracker(TimeRangeTracker trt)
          Set TimeRangeTracker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

protected HFile.Writer writer
Constructor Detail

StoreFile.Writer

public StoreFile.Writer(org.apache.hadoop.fs.FileSystem fs,
                        org.apache.hadoop.fs.Path path,
                        int blocksize,
                        Compression.Algorithm compress,
                        org.apache.hadoop.conf.Configuration conf,
                        KeyValue.KVComparator comparator,
                        StoreFile.BloomType bloomType,
                        int maxKeys)
                 throws IOException
Creates an HFile.Writer that also write helpful meta data.

Parameters:
fs - file system to write to
path - file name to create
blocksize - HDFS block size
compress - HDFS block compression
conf - user configuration
comparator - key comparator
bloomType - bloom filter setting
maxKeys - maximum amount of keys to add (for blooms)
Throws:
IOException - problem writing to FS
Method Detail

appendMetadata

public void appendMetadata(long maxSequenceId,
                           boolean majorCompaction)
                    throws IOException
Writes meta data. Call before close() since its written as meta data to this file.

Parameters:
maxSequenceId - Maximum sequence id.
majorCompaction - True if this file is product of a major compaction
Throws:
IOException - problem writing to FS

appendTimeRangeMetadata

public void appendTimeRangeMetadata()
                             throws IOException
Add TimestampRange to Metadata

Throws:
IOException

setTimeRangeTracker

public void setTimeRangeTracker(TimeRangeTracker trt)
Set TimeRangeTracker

Parameters:
trt -

includeInTimeRangeTracker

public void includeInTimeRangeTracker(KeyValue kv)
If the timeRangeTracker is not set, update TimeRangeTracker to include the timestamp of this key

Parameters:
kv -
Throws:
IOException

includeInTimeRangeTracker

public void includeInTimeRangeTracker(byte[] key)
If the timeRangeTracker is not set, update TimeRangeTracker to include the timestamp of this key

Parameters:
key -
Throws:
IOException

append

public void append(KeyValue kv)
            throws IOException
Throws:
IOException

getPath

public org.apache.hadoop.fs.Path getPath()

append

public void append(byte[] key,
                   byte[] value)
            throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException

appendFileInfo

public void appendFileInfo(byte[] key,
                           byte[] value)
                    throws IOException
Throws:
IOException


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