public static class IndexedStorage.IndexManager extends 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 IOException
fs
- file
- IOException
public void openIndexFile(org.apache.hadoop.fs.FileSystem fs) throws IOException
IOException
public void Close() throws IOException
IOException
public void WriteIndexHeader() throws IOException
indexOut
- - Stream to write toih
- - Index header to writeIOException
public void ReadIndexHeader() throws IOException
indexIn
- - Stream to read fromIOException
public void WriterIndexFooter() throws IOException
IOException
public void ReadIndexFooter() throws IOException
IOException
public void SeekToIndexFooter() throws IOException
IOException
public void WriteIndex() throws IOException
IOException
public Tuple getIndexKeyTuple(Tuple indexTuple) throws IOException
IOException
public long getIndexKeyTupleCount(Tuple indexTuple) throws IOException
IOException
public long getOffset(Tuple indexTuple) throws IOException
IOException
public Tuple ReadIndex() throws IOException
IOException
public Tuple ScanIndex(Tuple keys) throws IOException
IOException
Copyright © 2007-2012 The Apache Software Foundation