org.apache.hadoop.hbase.io
Class HalfMapFileReader

java.lang.Object
  extended by org.apache.hadoop.hbase.io.MapFile.Reader
      extended by org.apache.hadoop.hbase.io.HBaseMapFile.HBaseReader
          extended by org.apache.hadoop.hbase.io.BloomFilterMapFile.Reader
              extended by org.apache.hadoop.hbase.io.HalfMapFileReader
All Implemented Interfaces:
Closeable

public class HalfMapFileReader
extends BloomFilterMapFile.Reader

A facade for a MapFile.Reader that serves up either the top or bottom half of a MapFile where 'bottom' is the first half of the file containing the keys that sort lowest and 'top' is the second half of the file with keys that sort greater than those of the bottom half. The top includes the split files midkey, of the key that follows if it does not exist in the file.

This type works in tandem with the Reference type. This class is used reading while Reference is used writing.

This file is not splitable. Calls to midKey() return null.


Constructor Summary
HalfMapFileReader(org.apache.hadoop.fs.FileSystem fs, String dirName, org.apache.hadoop.conf.Configuration conf, Reference.Range r, org.apache.hadoop.io.WritableComparable<HStoreKey> mk, boolean filter, boolean blockCacheEnabled, HRegionInfo hri)
           
HalfMapFileReader(org.apache.hadoop.fs.FileSystem fs, String dirName, org.apache.hadoop.conf.Configuration conf, Reference.Range r, org.apache.hadoop.io.WritableComparable<HStoreKey> mk, HRegionInfo hri)
           
 
Method Summary
 void finalKey(org.apache.hadoop.io.WritableComparable key)
          Reads the final key from the file.
 org.apache.hadoop.io.Writable get(org.apache.hadoop.io.WritableComparable key, org.apache.hadoop.io.Writable val)
          Return the value for the named key, or null if none exists.
 org.apache.hadoop.io.WritableComparable getClosest(org.apache.hadoop.io.WritableComparable key, org.apache.hadoop.io.Writable val)
          Finds the record that is the closest match to the specified key.
 org.apache.hadoop.io.WritableComparable midKey()
          Get the key at approximately the middle of the file.
 boolean next(org.apache.hadoop.io.WritableComparable key, org.apache.hadoop.io.Writable val)
          Read the next key/value pair in the map into key and val.
 void reset()
          Re-positions the reader before its first key.
 boolean seek(org.apache.hadoop.io.WritableComparable key)
          Positions the reader at the named key, or if none such exists, at the first entry after the named key.
 
Methods inherited from class org.apache.hadoop.hbase.io.BloomFilterMapFile.Reader
getBloomFilterSize
 
Methods inherited from class org.apache.hadoop.hbase.io.HBaseMapFile.HBaseReader
createDataFileReader
 
Methods inherited from class org.apache.hadoop.hbase.io.MapFile.Reader
close, getClosest, getKeyClass, getValueClass, open
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HalfMapFileReader

public HalfMapFileReader(org.apache.hadoop.fs.FileSystem fs,
                         String dirName,
                         org.apache.hadoop.conf.Configuration conf,
                         Reference.Range r,
                         org.apache.hadoop.io.WritableComparable<HStoreKey> mk,
                         HRegionInfo hri)
                  throws IOException
Parameters:
fs -
dirName -
conf -
r -
mk -
hri -
Throws:
IOException

HalfMapFileReader

public HalfMapFileReader(org.apache.hadoop.fs.FileSystem fs,
                         String dirName,
                         org.apache.hadoop.conf.Configuration conf,
                         Reference.Range r,
                         org.apache.hadoop.io.WritableComparable<HStoreKey> mk,
                         boolean filter,
                         boolean blockCacheEnabled,
                         HRegionInfo hri)
                  throws IOException
Parameters:
fs -
dirName -
conf -
r -
mk -
filter -
blockCacheEnabled -
hri -
Throws:
IOException
Method Detail

finalKey

public void finalKey(org.apache.hadoop.io.WritableComparable key)
              throws IOException
Description copied from class: MapFile.Reader
Reads the final key from the file.

Overrides:
finalKey in class MapFile.Reader
Parameters:
key - key to read into
Throws:
IOException

get

public org.apache.hadoop.io.Writable get(org.apache.hadoop.io.WritableComparable key,
                                         org.apache.hadoop.io.Writable val)
                                  throws IOException
Description copied from class: MapFile.Reader
Return the value for the named key, or null if none exists.

Overrides:
get in class BloomFilterMapFile.Reader
Throws:
IOException

getClosest

public org.apache.hadoop.io.WritableComparable getClosest(org.apache.hadoop.io.WritableComparable key,
                                                          org.apache.hadoop.io.Writable val)
                                                   throws IOException
Description copied from class: MapFile.Reader
Finds the record that is the closest match to the specified key. Returns key or if it does not exist, at the first entry after the named key. - * @param key - key that we're trying to find - * @param val - data value if key is found - * @return - the key that was the closest match or null if eof.

Overrides:
getClosest in class BloomFilterMapFile.Reader
Throws:
IOException

midKey

public org.apache.hadoop.io.WritableComparable midKey()
                                               throws IOException
Description copied from class: MapFile.Reader
Get the key at approximately the middle of the file. Or null if the file is empty.

Overrides:
midKey in class MapFile.Reader
Throws:
IOException

next

public boolean next(org.apache.hadoop.io.WritableComparable key,
                    org.apache.hadoop.io.Writable val)
             throws IOException
Description copied from class: MapFile.Reader
Read the next key/value pair in the map into key and val. Returns true if such a pair exists and false when at the end of the map

Overrides:
next in class MapFile.Reader
Throws:
IOException

reset

public void reset()
           throws IOException
Description copied from class: MapFile.Reader
Re-positions the reader before its first key.

Overrides:
reset in class MapFile.Reader
Throws:
IOException

seek

public boolean seek(org.apache.hadoop.io.WritableComparable key)
             throws IOException
Description copied from class: MapFile.Reader
Positions the reader at the named key, or if none such exists, at the first entry after the named key. Returns true iff the named key exists in this map.

Overrides:
seek in class MapFile.Reader
Throws:
IOException


Copyright © 2008 The Apache Software Foundation