com.timeindexing.io
Class ShadowIndexIO

java.lang.Object
  extended bycom.timeindexing.io.AbstractIndexIO
      extended bycom.timeindexing.io.AbstractFileIO
          extended bycom.timeindexing.io.ExternalIndexIO
              extended bycom.timeindexing.io.ShadowIndexIO
All Implemented Interfaces:
IndexFileInteractor, IndexFileReader, IndexFileWriter, IndexInteractor, java.lang.Runnable

public class ShadowIndexIO
extends ExternalIndexIO
implements IndexFileInteractor

This does I/O for a shadow Index with external data.


Constructor Summary
ShadowIndexIO(StoredIndex indexMgr)
          Construct a shadow Index.
 
Method Summary
 long create(IndexProperties indexProperties)
          Operation on creation.
 long flush()
          Operation on flush.
protected  long open()
          Open an index to read it.
 long open(IndexProperties indexProperties)
          Open an index file to read it.
protected  long processData(java.nio.ByteBuffer buffer)
          Processing of the data.
 long readDataHeader(byte headerType)
          Read an index header from the header stream.
 long readMetaData()
          Read all the meta data.
 long writeDataHeader(byte headerType)
          Write the data file header.
 
Methods inherited from class com.timeindexing.io.ExternalIndexIO
alignForData, bufferedDataWrite, bufferedIndexWrite, calculateAppendPosition, close, convertDataReference, getItem, gotoAppendPosition, gotoFirstPosition, memoryMapData, processIndexItem, readDataIntoBuffer, seekToData, seekToIndex, setAppendPosition
 
Methods inherited from class com.timeindexing.io.AbstractFileIO
addItem, alignForIndexItem, awaitWork, bufferedWrite, drainWriteQueue, flushBuffer, getAppendPosition, getItem, getWriteLock, isWriteLocked, loadIndex, readData, readData, readData, readHeader, readIndexItem, readIndexItem, readItem, readItem, readNormalData, readReferenceData, releaseWriteLock, requestReadWork, requestWriteWork, run, seekToData, seekToIndex, setItemSize, skipData, timeOut, writeFromWorkQueue, writeHeader, writeItem, writeNormal, writeReference
 
Methods inherited from class com.timeindexing.io.AbstractIndexIO
getIndex, getThread, initThread, startThread, stopThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.timeindexing.io.IndexInteractor
addItem, getIndex, getItem
 
Methods inherited from interface com.timeindexing.io.IndexFileReader
close, convertDataReference, getItem, gotoAppendPosition, gotoFirstPosition, loadIndex, readData, readData, readData, readHeader, readItem, readItem, setAppendPosition
 
Methods inherited from interface com.timeindexing.io.IndexFileWriter
close, getAppendPosition, getWriteLock, gotoAppendPosition, isWriteLocked, releaseWriteLock, writeHeader, writeItem
 

Constructor Detail

ShadowIndexIO

public ShadowIndexIO(StoredIndex indexMgr)
Construct a shadow Index.

Method Detail

create

public long create(IndexProperties indexProperties)
            throws java.io.IOException,
                   IndexCreateException
Operation on creation.

Specified by:
create in interface IndexFileWriter
Overrides:
create in class ExternalIndexIO
Throws:
java.io.IOException
IndexCreateException

open

public long open(IndexProperties indexProperties)
          throws java.io.IOException,
                 IndexOpenException
Open an index file to read it.

Specified by:
open in interface IndexFileReader
Overrides:
open in class ExternalIndexIO
Throws:
java.io.IOException
IndexOpenException

open

protected long open()
             throws java.io.IOException,
                    IndexOpenException
Open an index to read it.

Overrides:
open in class ExternalIndexIO
Throws:
java.io.IOException
IndexOpenException

readMetaData

public long readMetaData()
                  throws java.io.IOException,
                         IndexOpenException
Read all the meta data.

Specified by:
readMetaData in interface IndexFileReader
Overrides:
readMetaData in class ExternalIndexIO
Throws:
java.io.IOException
IndexOpenException

processData

protected long processData(java.nio.ByteBuffer buffer)
                    throws java.io.IOException
Processing of the data.

Overrides:
processData in class ExternalIndexIO
Throws:
java.io.IOException

flush

public long flush()
           throws java.io.IOException
Operation on flush. Returns how many bytes were written.

Specified by:
flush in interface IndexFileWriter
Overrides:
flush in class ExternalIndexIO
Throws:
java.io.IOException

readDataHeader

public long readDataHeader(byte headerType)
                    throws java.io.IOException
Read an index header from the header stream. Nothing to do as there is no header.

Overrides:
readDataHeader in class ExternalIndexIO
Throws:
java.io.IOException

writeDataHeader

public long writeDataHeader(byte headerType)
                     throws java.io.IOException
Write the data file header. Nothing to do as there is no header.

Overrides:
writeDataHeader in class ExternalIndexIO
Throws:
java.io.IOException