org.gillius.realdb.model
Interface DataStreamIndex

All Superinterfaces:
DBIterable<java.lang.Integer>
All Known Implementing Classes:
DataIndex

public interface DataStreamIndex
extends DBIterable<java.lang.Integer>

DataStreamIndex is an interface to a stream's data index to support reading. A DataStreamIndex is Iterable over the data block indices stored in the index.

Author:
Jason Winnebeck

Method Summary
 long getEndTime()
          Returns the timestamp of the last data point in the last data block in this index -- the maximum time for all data in the stream.
 int getFirstBlock()
          Returns the number of the first data block for this data stream, or -1 if there are no blocks in this index.
 int getLastBlock()
          Returns the last data block index for this data stream, or -1 if there are no blocks in this index.
 int getSecondBlock()
          Return the second data block index for this data stream, or -1 if there is not a second block.
 long getStartTime()
          Returns the timestamp of the first data point in the first data block in this index -- the minimum time for all data in the stream.
 DBIterator<java.lang.Integer> iterator()
          Returns an iterator over all of the data blocks in this DataIndex.
 DBIterator<java.lang.Integer> iterator(DataBlockSummaryReader summaryReader, long startTime, long endTime)
          Returns an iterator over a range of data blocks that contain at least one record within the given time bounds.
 

Method Detail

getStartTime

long getStartTime()
Returns the timestamp of the first data point in the first data block in this index -- the minimum time for all data in the stream. If there are no data points, -1 is returned.


getEndTime

long getEndTime()
Returns the timestamp of the last data point in the last data block in this index -- the maximum time for all data in the stream. If there are no data points, -1 is returned.


getFirstBlock

int getFirstBlock()
Returns the number of the first data block for this data stream, or -1 if there are no blocks in this index.


getSecondBlock

int getSecondBlock()
                   throws java.io.IOException,
                          BadFileException
Return the second data block index for this data stream, or -1 if there is not a second block.

Throws:
java.io.IOException
BadFileException

getLastBlock

int getLastBlock()
Returns the last data block index for this data stream, or -1 if there are no blocks in this index.


iterator

DBIterator<java.lang.Integer> iterator(DataBlockSummaryReader summaryReader,
                                       long startTime,
                                       long endTime)
                                       throws java.io.IOException,
                                              BadFileException
Returns an iterator over a range of data blocks that contain at least one record within the given time bounds. The first index returned will be at a DataBlock that contains at least one record >= startTime, and the last index returned is either the last DataBlock in the index, or the last DataBlock containing a record <= endTime.

Parameters:
summaryReader - non-null reader to get data block summaries (their time ranges)
startTime - start time, inclusive, or 0 for unbounded start
endTime - end time, inclusive, or Long.MAX_VALUE for unbounded end
Throws:
java.io.IOException
BadFileException

iterator

DBIterator<java.lang.Integer> iterator()
Returns an iterator over all of the data blocks in this DataIndex. Any modification of this index invalidates all iterators returned from this method. The returned iterator is not fail-fast -- it won't throw ConcurrentModificationException if there has been a modification. The returned iterator also does not support the remove operation.

Specified by:
iterator in interface DBIterable<java.lang.Integer>


Copyright © 2008-2010 Jason Winnebeck. All Rights Reserved.