Package com.illumon.iris.binarystore
Class BinaryStoreBufferProcessorV2
java.lang.Object
com.illumon.iris.binarystore.AbstractBinaryStoreReader
com.illumon.iris.binarystore.AbstractBinaryStoreReaderV2
com.illumon.iris.binarystore.BinaryStoreBufferProcessorV2
- All Implemented Interfaces:
BinaryStoreBufferProcessor
,BinaryStoreReader
,TableReader
public class BinaryStoreBufferProcessorV2 extends AbstractBinaryStoreReaderV2 implements BinaryStoreBufferProcessor
V2 Binary Store.
Enables processing buffers of binary data, without providing a source (other than the buffer).
All methods for reading more data from a source are disabled.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.iris.binarystore.AbstractBinaryStoreReaderV2
AbstractBinaryStoreReaderV2.BinaryStoreRowGetter<T>
Nested classes/interfaces inherited from class com.illumon.iris.binarystore.AbstractBinaryStoreReader
AbstractBinaryStoreReader.MissingGetterException
Nested classes/interfaces inherited from interface com.illumon.iris.binarystore.BinaryStoreBufferProcessor
BinaryStoreBufferProcessor.ReadDataException
Nested classes/interfaces inherited from interface com.illumon.iris.binarystore.TableReader
TableReader.MissingPropertyGetterException
-
Field Summary
Fields inherited from class com.illumon.iris.binarystore.AbstractBinaryStoreReader
columnNames, columnTypes, CONSUMER_BUFFER_SIZE, dataBuffer, mask, PRODUCER_BUFFER_SIZE, rowGetters, typeMetadata
-
Constructor Summary
Constructors Constructor Description BinaryStoreBufferProcessorV2()
-
Method Summary
Modifier and Type Method Description void
close()
Close the input source for this TableReader.<T> RowGetter<T>
getPropertyGetter(String property)
Retrieve a getter for the specified internal property.protected void
readData(int minAmount, ByteBuffer dataBuffer)
We never actually read any data in the BinaryStoreBufferProcessors, instead we have a buffer passed in by the caller.void
readHeader(ByteBuffer theBuffer)
This implementation callsAbstractBinaryStoreReader.readIntoByteBuffer(int, ByteBuffer)
andAbstractBinaryStoreReader.readData(int, ByteBuffer)
to add bytes to the given buffer.
The data buffer is required to be at the beginning (position==0).
Inherited doc: This implementation callsAbstractBinaryStoreReader.readIntoByteBuffer(int, ByteBuffer)
andAbstractBinaryStoreReader.readData(int, ByteBuffer)
to add bytes to the given buffer.
The data buffer is required to be at the beginning (position==0).
Inherited doc: Read a binary header from the given buffer.protected void
readIntoByteBuffer(int requiredSize, ByteBuffer theBuffer)
This method is called by the AbstractBinaryStoreReaderV2 when more data is needed (with the minimum size needed).void
setDataBuffer(ByteBuffer buffer, long sentTimestamp, long recvTimestamp)
The BinaryStoreBufferProcessors do not read their own data, but rather receive it externally through this call.Methods inherited from class com.illumon.iris.binarystore.AbstractBinaryStoreReaderV2
getApplicationVersion, getFlagGetter, getRecordDataGetter, parseRecord, parseRow, readEntry, readRow
Methods inherited from class com.illumon.iris.binarystore.AbstractBinaryStoreReader
getColumnNames, getColumnType, getGetter, getGetter, getTypeMetadataString, handleRecord, handleRow, readDataBuffer, readHeader, setRecordHandler, setRowHandler
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.binarystore.BinaryStoreBufferProcessor
delegatesRowBufferProcessing, getHeaderInfo, isDirty, setRecordHandler, setRowBufferProcessor, setRowHandler
Methods inherited from interface com.illumon.iris.binarystore.TableReader
getApplicationVersion, getColumnNames, getColumnType, getFlagGetter, getGetter, getGetter, getRecordDataGetter, readAllEntries, readAllEntries, readEntry, readRow
-
Constructor Details
-
BinaryStoreBufferProcessorV2
public BinaryStoreBufferProcessorV2()
-
-
Method Details
-
close
Description copied from interface:TableReader
Close the input source for this TableReader.- Specified by:
close
in interfaceTableReader
- Throws:
IOException
-
readData
We never actually read any data in the BinaryStoreBufferProcessors, instead we have a buffer passed in by the caller. If we end up needing to read data, we throw an exception, indicating that there is insufficient data to read the record; and the caller should pass in additional data.- Specified by:
readData
in classAbstractBinaryStoreReader
- Parameters:
minAmount
- caller wants this many additional bytesdataBuffer
- put the bytes in ths buffer. Must have minAmount additional capacity.- Throws:
IOException
-
readIntoByteBuffer
protected void readIntoByteBuffer(int requiredSize, ByteBuffer theBuffer) throws IOException, EofExceptionThis method is called by the AbstractBinaryStoreReaderV2 when more data is needed (with the minimum size needed). If our buffer has enough data, then we simply return. If there is not enough data, then we throw a ReadDataException, so that the caller is aware we have insufficient data to process the record, and setDataBuffer must be called with additional data before we can process the record.- Overrides:
readIntoByteBuffer
in classAbstractBinaryStoreReader
- Parameters:
requiredSize
- how many bytes of data are required to continue processingtheBuffer
- the data buffer to populate- Throws:
IOException
- if we encounter an EOF mid rowEofException
- if no data is available from the file
-
setDataBuffer
Description copied from interface:BinaryStoreBufferProcessor
The BinaryStoreBufferProcessors do not read their own data, but rather receive it externally through this call.- Specified by:
setDataBuffer
in interfaceBinaryStoreBufferProcessor
- Parameters:
buffer
- The buffer that this BinaryStoreBufferProcessor should consume data from.sentTimestamp
- The time the buffer was produced, in microseconds from the epoch, orQueryConstants.NULL_LONG
if unknown/unavailablerecvTimestamp
- The timestamp when the buffer was received, in microseconds from the epoch
-
readHeader
Description copied from class:AbstractBinaryStoreReaderV2
This implementation callsAbstractBinaryStoreReader.readIntoByteBuffer(int, ByteBuffer)
andAbstractBinaryStoreReader.readData(int, ByteBuffer)
to add bytes to the given buffer.
The data buffer is required to be at the beginning (position==0).
Inherited doc: Read a binary header from the given buffer. This interface does not dictate anything about the BinaryStore implementation in the buffer. Implementations might make implementation-dependent actions to fill the buffer if there isn't enough data. byteBuffer.position will be advanced by the size of the header.- Specified by:
readHeader
in interfaceBinaryStoreReader
- Overrides:
readHeader
in classAbstractBinaryStoreReaderV2
- Parameters:
theBuffer
- buffer containing the header, in reading mode- Throws:
IOException
- an exception derived from IOException may be thrown if there isn't enough data in the buffer.EofException
- may be thrown if an underlying channel (if any) ends.
-
getPropertyGetter
Description copied from interface:TableReader
Retrieve a getter for the specified internal property.- Specified by:
getPropertyGetter
in interfaceTableReader
- Overrides:
getPropertyGetter
in classAbstractBinaryStoreReaderV2
- Parameters:
property
- The property to get a getter for- Returns:
- A correctly typed getter for the property.
-