public static class IndexedStorage.IndexManager
extends java.lang.Object
IndexManager manages the index file (both writing and reading)
It keeps track of the last index read during reading.| Constructor and Description |
|---|
IndexedStorage.IndexManager(org.apache.hadoop.fs.FileStatus ifile)
Constructor (called during reading)
|
IndexedStorage.IndexManager(int[] offsetsToIndexKeys)
Constructor (called during writing)
|
| Modifier and Type | Method and Description |
|---|---|
void |
Close()
Close the index file
|
void |
createIndexFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path file)
Open the index file for writing for given data file
|
Tuple |
getIndexKeyTuple(Tuple indexTuple)
Extracts the index key from the index tuple
|
long |
getIndexKeyTupleCount(Tuple indexTuple)
Extracts the number of records that share the current key from the index tuple.
|
long |
getOffset(Tuple indexTuple)
Extracts the offset into the data file from the index tuple.
|
void |
openIndexFile(org.apache.hadoop.fs.FileSystem fs)
Opens the index file.
|
Tuple |
ReadIndex()
Reads the next index from the index file (or null if EOF) and extracts
the index fields.
|
void |
ReadIndexFooter()
Reads the index footer
|
void |
ReadIndexHeader()
Read index header
|
Tuple |
ScanIndex(Tuple keys)
Scans the index looking for a given key.
|
void |
SeekToIndexFooter()
Seeks to the index footer
|
void |
WriteIndex()
Writes the current index.
|
void |
WriteIndexHeader()
Write index header
|
void |
WriterIndexFooter()
Writes the index footer
|
public IndexedStorage.IndexManager(org.apache.hadoop.fs.FileStatus ifile)
ifile - index file to readpublic IndexedStorage.IndexManager(int[] offsetsToIndexKeys)
offsetsToIndexKeys - public void createIndexFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path file)
throws java.io.IOException
fs - file - java.io.IOExceptionpublic void openIndexFile(org.apache.hadoop.fs.FileSystem fs)
throws java.io.IOException
java.io.IOExceptionpublic void Close()
throws java.io.IOException
java.io.IOExceptionpublic void WriteIndexHeader()
throws java.io.IOException
indexOut - - Stream to write toih - - Index header to writejava.io.IOExceptionpublic void ReadIndexHeader()
throws java.io.IOException
indexIn - - Stream to read fromjava.io.IOExceptionpublic void WriterIndexFooter()
throws java.io.IOException
java.io.IOExceptionpublic void ReadIndexFooter()
throws java.io.IOException
java.io.IOExceptionpublic void SeekToIndexFooter()
throws java.io.IOException
java.io.IOExceptionpublic void WriteIndex()
throws java.io.IOException
java.io.IOExceptionpublic Tuple getIndexKeyTuple(Tuple indexTuple) throws java.io.IOException
java.io.IOExceptionpublic long getIndexKeyTupleCount(Tuple indexTuple) throws java.io.IOException
java.io.IOExceptionpublic long getOffset(Tuple indexTuple) throws java.io.IOException
java.io.IOExceptionpublic Tuple ReadIndex() throws java.io.IOException
java.io.IOExceptionCopyright © 2007-2012 The Apache Software Foundation