Package com.illumon.iris.binarystore
Class DelegatingBinaryStoreV2BufferProcessor
java.lang.Object
com.illumon.iris.binarystore.DelegatingBinaryStoreV2BufferProcessor
- All Implemented Interfaces:
BinaryStoreBufferProcessor,BinaryStoreReader,TableReader
public final class DelegatingBinaryStoreV2BufferProcessor
extends Object
implements BinaryStoreBufferProcessor
Buffer processor for version 2 of the binary store protocol which delegates row buffer consumption to a
BinaryStoreV2RowBufferProcessor rather than support the legacy RowGetter approach.
This enables batch-oriented row processing for high-throughput ingestion.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRecord handler to use when a real one has not yet been set, and hence records are unexpected.Nested classes/interfaces inherited from interface com.illumon.iris.binarystore.BinaryStoreBufferProcessor
BinaryStoreBufferProcessor.ReadDataExceptionNested classes/interfaces inherited from interface com.illumon.iris.binarystore.TableReader
TableReader.MissingPropertyGetterException -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new delegating binary store V2 buffer processor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the input source for this TableReader.booleanCheck if this buffer processor delegates row buffer processing to aBinaryStoreV2RowBufferProcessor.intGet the application version associated with the file being read by this TableReader.String[]Get an array of all known column names.getColumnType(String columnName) Get the SupportedType of the named column.Retrieve the getter for the row flags.Return a raw RowGetter for the column with the given name.<T> RowGetter<T>Return a typed RowGetter for the column with the given name.Get information extracted from the last binary store header read.<T> RowGetter<T>getPropertyGetter(String property) Retrieve a getter for the specified internal property.Retrieve the getter for the RecordData.booleanisDirty()Does this buffer processor contain inconsistent state that should prevent checkpointing?booleanRead a record from the source, expecting that not all records will be Row records.voidreadHeader(ByteBuffer headerBuffer) Read a binary header from the given buffer.booleanreadRow()Deprecated.voidsetDataBuffer(ByteBuffer dataBuffer, long txTimestampMicros, long rxTimestampMicros) The BinaryStoreBufferProcessors do not read their own data, but rather receive it externally through this call.setRecordHandler(Runnable recordHandler) Set a record handler callback for this buffer processor.setRowBufferProcessor(BinaryStoreV2RowBufferProcessor rowBufferProcessor) Set theBinaryStoreV2RowBufferProcessorthat will be used to parse and process all row entries.setRowHandler(Runnable handler) Set a row handler callback for this buffer processor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.binarystore.TableReader
readAllEntries, readAllEntries
-
Constructor Details
-
DelegatingBinaryStoreV2BufferProcessor
public DelegatingBinaryStoreV2BufferProcessor()Construct a new delegating binary store V2 buffer processor.
-
-
Method Details
-
readHeader
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:
readHeaderin interfaceBinaryStoreReader- Parameters:
headerBuffer- 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.
-
getHeaderInfo
Description copied from interface:BinaryStoreBufferProcessorGet information extracted from the last binary store header read. Only supported for delegating buffer processors.- Specified by:
getHeaderInfoin interfaceBinaryStoreBufferProcessor- Returns:
- The header information
-
getColumnNames
Description copied from interface:TableReaderGet an array of all known column names. These can be used to determine valid column names for use inTableReader.getGetter(String).- Specified by:
getColumnNamesin interfaceTableReader- Returns:
- a new array of all known column names.
-
getColumnType
Description copied from interface:TableReaderGet the SupportedType of the named column.- Specified by:
getColumnTypein interfaceTableReader- Parameters:
columnName- the name of the column- Returns:
- the SupportedType value for the named column
-
getApplicationVersion
public int getApplicationVersion()Description copied from interface:TableReaderGet the application version associated with the file being read by this TableReader.- Specified by:
getApplicationVersionin interfaceTableReader- Returns:
- the file's application version
-
setDataBuffer
public void setDataBuffer(@NotNull ByteBuffer dataBuffer, long txTimestampMicros, long rxTimestampMicros) Description copied from interface:BinaryStoreBufferProcessorThe BinaryStoreBufferProcessors do not read their own data, but rather receive it externally through this call.- Specified by:
setDataBufferin interfaceBinaryStoreBufferProcessor- Parameters:
dataBuffer- The buffer that this BinaryStoreBufferProcessor should consume data from.txTimestampMicros- The time the buffer was produced, in microseconds from the epoch, orQueryConstants.NULL_LONGif unknown/unavailablerxTimestampMicros- The timestamp when the buffer was received, in microseconds from the epoch
-
readEntry
Description copied from interface:TableReaderRead a record from the source, expecting that not all records will be Row records.
Note: The default implementation delegates to the now-deprecatedTableReader.readRow(), which cannot handle record entries.- Specified by:
readEntryin interfaceTableReader- Returns:
- true if successful, false if EOF or an error is encountered.
- Throws:
IOException- if EOF is encountered mid-entry or any invalid data is encountered.
-
readRow
Deprecated.Description copied from interface:TableReaderRead a row from the source, expecting that all entries will be Rows. If a record entry is encountered, anIllegalStateExceptionwill be thrown.- Specified by:
readRowin interfaceTableReader- Returns:
- true if successful, false if EOF or an error is encountered.
- Throws:
IOException- if EOF is encountered mid-row or any invalid data is encountered.
-
setRowBufferProcessor
public BinaryStoreV2RowBufferProcessor setRowBufferProcessor(@NotNull BinaryStoreV2RowBufferProcessor rowBufferProcessor) Description copied from interface:BinaryStoreBufferProcessorSet theBinaryStoreV2RowBufferProcessorthat will be used to parse and process all row entries. Only supported for delegating buffer processors.- Specified by:
setRowBufferProcessorin interfaceBinaryStoreBufferProcessor- Parameters:
rowBufferProcessor- The newBinaryStoreV2RowBufferProcessor- Returns:
- The previous
BinaryStoreV2RowBufferProcessor, or null if none was set
-
isDirty
public boolean isDirty()Description copied from interface:BinaryStoreBufferProcessorDoes this buffer processor contain inconsistent state that should prevent checkpointing?- Specified by:
isDirtyin interfaceBinaryStoreBufferProcessor- Returns:
- Whether this buffer processor contains inconsistent state that should prevent checkpointing
-
getRecordDataGetter
Description copied from interface:TableReaderRetrieve the getter for the RecordData.- Specified by:
getRecordDataGetterin interfaceTableReader- Returns:
- a getter that returns the data for the currently read record.
-
setRecordHandler
Description copied from interface:BinaryStoreBufferProcessorSet a record handler callback for this buffer processor.- Specified by:
setRecordHandlerin interfaceBinaryStoreBufferProcessor- Parameters:
recordHandler- The replacement record handler- Returns:
- The previous record handler
-
close
public void close()Description copied from interface:TableReaderClose the input source for this TableReader.- Specified by:
closein interfaceTableReader
-
delegatesRowBufferProcessing
public boolean delegatesRowBufferProcessing()Description copied from interface:BinaryStoreBufferProcessorCheck if this buffer processor delegates row buffer processing to aBinaryStoreV2RowBufferProcessor.Delegating buffer processors do not support the following methods:
Delegating buffer processors are the only ones that support the following methods:- Specified by:
delegatesRowBufferProcessingin interfaceBinaryStoreBufferProcessor- Returns:
- True of this buffer processor delegates row buffer processing
-
setRowHandler
Description copied from interface:BinaryStoreBufferProcessorSet a row handler callback for this buffer processor. Not supported for delegating buffer processors.- Specified by:
setRowHandlerin interfaceBinaryStoreBufferProcessor- Parameters:
handler- The replacement row handler- Returns:
- The previous row handler
-
getGetter
Description copied from interface:TableReaderReturn a raw RowGetter for the column with the given name. RowGetter.get() will return Object.- Specified by:
getGetterin interfaceTableReader- Parameters:
name- the column name- Returns:
- a RowGetter
-
getGetter
Description copied from interface:TableReaderReturn a typed RowGetter for the column with the given name. RowGetter.get() will return type tClass.- Specified by:
getGetterin interfaceTableReader- Parameters:
name- the column name- Returns:
- a RowGetter of type tClass
-
getFlagGetter
Description copied from interface:TableReaderRetrieve the getter for the row flags.- Specified by:
getFlagGetterin interfaceTableReader- Returns:
- a getter that returns the flags for each row.
-
getPropertyGetter
Description copied from interface:TableReaderRetrieve a getter for the specified internal property.This method is intended for use with instrumentation.
- Specified by:
getPropertyGetterin interfaceTableReader- Parameters:
property- The property to get a getter for- Returns:
- A correctly typed getter for the property.
-