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 class
Record 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.ReadDataException
Nested 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 TypeMethodDescriptionvoid
close()
Close the input source for this TableReader.boolean
Check if this buffer processor delegates row buffer processing to aBinaryStoreV2RowBufferProcessor
.int
Get 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.boolean
isDirty()
Does this buffer processor contain inconsistent state that should prevent checkpointing?boolean
Read a record from the source, expecting that not all records will be Row records.void
readHeader
(ByteBuffer headerBuffer) Read a binary header from the given buffer.boolean
readRow()
Deprecated.void
setDataBuffer
(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 theBinaryStoreV2RowBufferProcessor
that 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, wait
Methods 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:
readHeader
in 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:BinaryStoreBufferProcessor
Get information extracted from the last binary store header read. Only supported for delegating buffer processors.- Specified by:
getHeaderInfo
in interfaceBinaryStoreBufferProcessor
- Returns:
- The header information
-
getColumnNames
Description copied from interface:TableReader
Get an array of all known column names. These can be used to determine valid column names for use inTableReader.getGetter(String)
.- Specified by:
getColumnNames
in interfaceTableReader
- Returns:
- a new array of all known column names.
-
getColumnType
Description copied from interface:TableReader
Get the SupportedType of the named column.- Specified by:
getColumnType
in interfaceTableReader
- Parameters:
columnName
- the name of the column- Returns:
- the SupportedType value for the named column
-
getApplicationVersion
public int getApplicationVersion()Description copied from interface:TableReader
Get the application version associated with the file being read by this TableReader.- Specified by:
getApplicationVersion
in interfaceTableReader
- Returns:
- the file's application version
-
setDataBuffer
public void setDataBuffer(@NotNull ByteBuffer dataBuffer, long txTimestampMicros, long rxTimestampMicros) 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:
dataBuffer
- The buffer that this BinaryStoreBufferProcessor should consume data from.txTimestampMicros
- The time the buffer was produced, in microseconds from the epoch, orQueryConstants.NULL_LONG
if unknown/unavailablerxTimestampMicros
- The timestamp when the buffer was received, in microseconds from the epoch
-
readEntry
Description copied from interface:TableReader
Read 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:
readEntry
in 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:TableReader
Read a row from the source, expecting that all entries will be Rows. If a record entry is encountered, anIllegalStateException
will be thrown.- Specified by:
readRow
in 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:BinaryStoreBufferProcessor
Set theBinaryStoreV2RowBufferProcessor
that will be used to parse and process all row entries. Only supported for delegating buffer processors.- Specified by:
setRowBufferProcessor
in interfaceBinaryStoreBufferProcessor
- Parameters:
rowBufferProcessor
- The newBinaryStoreV2RowBufferProcessor
- Returns:
- The previous
BinaryStoreV2RowBufferProcessor
, or null if none was set
-
isDirty
public boolean isDirty()Description copied from interface:BinaryStoreBufferProcessor
Does this buffer processor contain inconsistent state that should prevent checkpointing?- Specified by:
isDirty
in interfaceBinaryStoreBufferProcessor
- Returns:
- Whether this buffer processor contains inconsistent state that should prevent checkpointing
-
getRecordDataGetter
Description copied from interface:TableReader
Retrieve the getter for the RecordData.- Specified by:
getRecordDataGetter
in interfaceTableReader
- Returns:
- a getter that returns the data for the currently read record.
-
setRecordHandler
Description copied from interface:BinaryStoreBufferProcessor
Set a record handler callback for this buffer processor.- Specified by:
setRecordHandler
in interfaceBinaryStoreBufferProcessor
- Parameters:
recordHandler
- The replacement record handler- Returns:
- The previous record handler
-
close
public void close()Description copied from interface:TableReader
Close the input source for this TableReader.- Specified by:
close
in interfaceTableReader
-
delegatesRowBufferProcessing
public boolean delegatesRowBufferProcessing()Description copied from interface:BinaryStoreBufferProcessor
Check 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:
delegatesRowBufferProcessing
in interfaceBinaryStoreBufferProcessor
- Returns:
- True of this buffer processor delegates row buffer processing
-
setRowHandler
Description copied from interface:BinaryStoreBufferProcessor
Set a row handler callback for this buffer processor. Not supported for delegating buffer processors.- Specified by:
setRowHandler
in interfaceBinaryStoreBufferProcessor
- Parameters:
handler
- The replacement row handler- Returns:
- The previous row handler
-
getGetter
Description copied from interface:TableReader
Return a raw RowGetter for the column with the given name. RowGetter.get() will return Object.- Specified by:
getGetter
in interfaceTableReader
- Parameters:
name
- the column name- Returns:
- a RowGetter
-
getGetter
Description copied from interface:TableReader
Return a typed RowGetter for the column with the given name. RowGetter.get() will return type tClass.- Specified by:
getGetter
in interfaceTableReader
- Parameters:
name
- the column name- Returns:
- a RowGetter of type tClass
-
getFlagGetter
Description copied from interface:TableReader
Retrieve the getter for the row flags.- Specified by:
getFlagGetter
in interfaceTableReader
- Returns:
- a getter that returns the flags for each row.
-
getPropertyGetter
Description copied from interface:TableReader
Retrieve a getter for the specified internal property.This method is intended for use with instrumentation.
- Specified by:
getPropertyGetter
in interfaceTableReader
- Parameters:
property
- The property to get a getter for- Returns:
- A correctly typed getter for the property.
-