Class BinaryStoreAggregatorWriterStandard
java.lang.Object
com.illumon.iris.binarystore.AbstractBinaryStoreWriter<BinaryRowV2>
com.illumon.iris.binarystore.BinaryStoreWriterV2
com.illumon.iris.db.v2.logaggregator.BinaryStoreAggregatorWriterStandard
- All Implemented Interfaces:
ChannelManager
,ChannelManagerStandard
,Entry
,Record
,Row
,TableWriter<BinaryRowV2>
public class BinaryStoreAggregatorWriterStandard extends BinaryStoreWriterV2 implements ChannelManagerStandard
Write binary rows to a log aggregation service. This implementation is for column partition values that are not
determined by row-level data. They may still change, for example based on the current date.
After construction, this will contain an authenticated and accepted connection to the LAS for the given identifiers. If the channel connection is broken, attempts will be made to reconnect. Once either the client or server requests/indicates termination, or the client initiates a terminating command, the connection will be permanently closed.
This object is expected to be used by a single thread. Synchronization is to ensure that multiple commands don't occur at the same time, and to ensure that we don't close and check connections at the same time.
After construction, this will contain an authenticated and accepted connection to the LAS for the given identifiers. If the channel connection is broken, attempts will be made to reconnect. Once either the client or server requests/indicates termination, or the client initiates a terminating command, the connection will be permanently closed.
This object is expected to be used by a single thread. Synchronization is to ensure that multiple commands don't occur at the same time, and to ensure that we don't close and check connections at the same time.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.iris.binarystore.BinaryStoreWriterV2
BinaryStoreWriterV2.DeferrableRowPartition
Nested classes/interfaces inherited from interface com.illumon.iris.binarystore.Record
Record.RecordSetter<T extends RecordData>
-
Field Summary
Fields inherited from class com.illumon.iris.binarystore.BinaryStoreWriterV2
log, primaryRecordWriter, primaryRowWriter
-
Method Summary
Modifier and Type Method Description void
close()
Send CLIENT_FINISHED message, poll for an ACK and close the channel.protected com.illumon.iris.db.v2.logaggregator.BinaryStoreAggregatorWriterStandard.LogAggregatorRecordWriter
createBinaryRecord()
Make sure all the record writers for this class prepend a LAS message header.protected com.illumon.iris.db.v2.logaggregator.BinaryStoreAggregatorWriterStandard.LogAggregatorRowWriter
createBinaryRow(String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata)
Make sure all the row writers for this class prepend a LAS message header.void
flush()
Flushes data out.void
flushDeferredRows(BinaryStoreWriterV2.DeferrableRowPartition part)
Flush all of the deferred rows in the input collection to the underlying stream.GatheringByteChannel
getChannel()
Open a channel to the Log Aggregator Service and initialize it with table identifiers and binary header.com.illumon.iris.db.v2.logaggregator.BinaryStoreAggregatorWriterStandard.LogAggregatorRecordWriter
getRecordWriter()
Get new writer for Record entries.void
init()
protected ExpirationManager<String>
makeColumnPartitionFactory(String columnPartition, ZoneId zoneid)
Injection point for testing.void
sendDeletePartition()
Send a command message to the Log Aggregator, requesting that the current partition be deleted.Methods inherited from class com.illumon.iris.binarystore.BinaryStoreWriterV2
computeHeaderBuffer, flushDeferredRows, getColumnNames, getColumnPartitionValue, getColumnTypes, getRecordSetter, getRecordSetter, getRowWriter, getSetter, makeCurrentDatePartitionedBinaryStoreWriter, makeMultiPartitionFileManagerBinaryStoreWriter, makeSpecifiedPartitionBinaryStoreWriter, setColumnPartitionValue, setFlags, setRecordData, writeDeferredRow, writeMulti, writeRecord, writeRow
Methods inherited from class com.illumon.iris.binarystore.AbstractBinaryStoreWriter
setChannelManager, supportAllTypes
-
Method Details
-
createBinaryRow
protected com.illumon.iris.db.v2.logaggregator.BinaryStoreAggregatorWriterStandard.LogAggregatorRowWriter createBinaryRow(String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata)Make sure all the row writers for this class prepend a LAS message header.- Overrides:
createBinaryRow
in classBinaryStoreWriterV2
-
createBinaryRecord
protected com.illumon.iris.db.v2.logaggregator.BinaryStoreAggregatorWriterStandard.LogAggregatorRecordWriter createBinaryRecord()Make sure all the record writers for this class prepend a LAS message header.- Overrides:
createBinaryRecord
in classBinaryStoreWriterV2
- Returns:
- a new BinaryRecordV2 record writer
-
getRecordWriter
public com.illumon.iris.db.v2.logaggregator.BinaryStoreAggregatorWriterStandard.LogAggregatorRecordWriter getRecordWriter()Description copied from interface:TableWriter
Get new writer for Record entries. This is likely to be newly created, so callers should cache this value. In practice, implementers generally cache the result of the first call to this method as a primary writer.- Specified by:
getRecordWriter
in interfaceTableWriter<BinaryRowV2>
- Overrides:
getRecordWriter
in classBinaryStoreWriterV2
- Returns:
- a Record, likely newly created
-
init
- Overrides:
init
in classBinaryStoreWriterV2
- Throws:
IOException
-
getChannel
Open a channel to the Log Aggregator Service and initialize it with table identifiers and binary header. This getChannel implementation only works for standard-column-partition-determination instances.- Specified by:
getChannel
in interfaceChannelManagerStandard
- Returns:
- non-null, open channel to the server, else an exception
- Throws:
IOException
- if the call encounters an error
-
close
Send CLIENT_FINISHED message, poll for an ACK and close the channel.- Specified by:
close
in interfaceChannelManager
- Specified by:
close
in interfaceTableWriter<BinaryRowV2>
- Overrides:
close
in classAbstractBinaryStoreWriter<BinaryRowV2>
- Throws:
IOException
- problem closing the writer.
-
flush
Description copied from interface:TableWriter
Flushes data out.- Specified by:
flush
in interfaceChannelManager
- Specified by:
flush
in interfaceTableWriter<BinaryRowV2>
- Overrides:
flush
in classAbstractBinaryStoreWriter<BinaryRowV2>
- Throws:
IOException
- problem flushing data out.
-
sendDeletePartition
Send a command message to the Log Aggregator, requesting that the current partition be deleted. The connection will be closed by the server, no further data or commands are allowed.- Throws:
IOException
-
makeColumnPartitionFactory
protected ExpirationManager<String> makeColumnPartitionFactory(String columnPartition, ZoneId zoneid)Injection point for testing.- Parameters:
columnPartition
- the column partition passed into the caller, or null if the partition should be determined by the datezoneid
- the ZoneId needed to create a DailyExpiration- Returns:
- an ExpirationManager appropriate to the member variables
-
flushDeferredRows
Description copied from class:BinaryStoreWriterV2
Flush all of the deferred rows in the input collection to the underlying stream.- Overrides:
flushDeferredRows
in classBinaryStoreWriterV2
- Parameters:
part
- The collection of deferred rows for the partitionVlaue- Throws:
IOException
- if an error occurs during writing. Rows may be partially written, however there are no guarantees that the rows were written completely.
-