|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gillius.realdb.model.IndexBlock
public class IndexBlock
IndexBlock represents a single index data block within a stream's DataIndex. A large
sequence number (32 bit) is used so we can recognize that the active block written longest ago is
still recognized as being older than the newest block.
| Field Summary | |
|---|---|
static org.gillius.realdb.model.SequencedBlockLoader<IndexBlock> |
loader
A global static final thread-safe instance of a SequencedBlockLoader to load IndexBlocks. |
| Constructor Summary | |
|---|---|
IndexBlock(byte[] data)
Constructs a new IndexBlock by reading it from the given byte array. |
|
IndexBlock(int seqNum)
Creates an "empty" IndexBlock with no data blocks, and start and end times are 0. |
|
IndexBlock(int seqNum,
long startTime,
long endTime,
int[] dataBlocks)
Creates an IndexBlock with the given data blocks. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
|
int[] |
getDataBlocks()
|
long |
getEndTime()
|
static int |
getMaxDataBlocks(int blockSize)
Given a block size in bytes, returns the number of data block indicies that this IndexBlock can hold. |
static int |
getMinSize()
Returns the size, in bytes, of the smallest possible IndexBlock, the empty block. |
int |
getSeqNum()
|
static int |
getSize(int numBlocks)
Returns the size, in bytes, of the IndexBlock that holds 'numBlocks' data block indexes. |
long |
getStartTime()
Returns the timestamp of the first data point in the first data block |
int |
hashCode()
|
java.lang.String |
toString()
|
void |
write(java.io.DataOutput output)
Writes this object to the given DataOutput. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static org.gillius.realdb.model.SequencedBlockLoader<IndexBlock> loader
| Constructor Detail |
|---|
public IndexBlock(int seqNum)
seqNum - sequence number for the IndexBlock
public IndexBlock(int seqNum,
long startTime,
long endTime,
int[] dataBlocks)
seqNum - block's sequence numberstartTime - time of the first data point in the first data blockendTime - time of the last data point in the last data blockdataBlocks - array of 1 or more data blocks.
public IndexBlock(byte[] data)
throws BadFileException
data - non-null byte[]
BadFileException - if the data integrity of the block is not correct| Method Detail |
|---|
public static int getMinSize()
public static int getSize(int numBlocks)
public static int getMaxDataBlocks(int blockSize)
blockSize - a block size in bytes, greater than or equal to getMinSize().
public int getSeqNum()
public long getStartTime()
getStartTime in interface Rangepublic long getEndTime()
getEndTime in interface Rangepublic int[] getDataBlocks()
public void write(java.io.DataOutput output)
throws java.io.IOException
DataOutputWritable
output - non-null DataOutput
java.io.IOExceptionpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||