Class LogAggregatorWriterStandard

java.lang.Object
com.illumon.iris.db.v2.logaggregator.LogAggregatorWriterStandard
All Implemented Interfaces:
io.deephaven.enterprise.binlog.channels.ChannelManager, io.deephaven.enterprise.binlog.channels.ChannelManagerStandard, io.deephaven.enterprise.binlog.support.SinglePartitionBufferWriter

public class LogAggregatorWriterStandard extends Object implements io.deephaven.enterprise.binlog.channels.ChannelManagerStandard, io.deephaven.enterprise.binlog.support.SinglePartitionBufferWriter
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.
  • Constructor Details

    • LogAggregatorWriterStandard

      public LogAggregatorWriterStandard(@NotNull com.fishlib.io.logger.Logger log, @NotNull InetSocketAddress serverAddress, @NotNull String namespace, @NotNull String tableName, @NotNull TableIdentifier.NamespaceSet namespaceSet, @NotNull String internalPartition, @NotNull String columnPartition, TokenFactoryFactory tokenFactorySource) throws IOException
      Parameters:
      log - the Logger instance
      serverAddress - the LAS server's address
      namespace - the namespace
      tableName - the table name
      namespaceSet - the namespace set
      internalPartition - the internal partition
      columnPartition - the column partition; if NULL_PARTITION is specified, then the current date column partition factory will be used to determine column partition values
      tokenFactorySource - a token source for authentication
      Throws:
      IOException - from initialization
    • LogAggregatorWriterStandard

      public LogAggregatorWriterStandard(@NotNull com.fishlib.io.logger.Logger log, @NotNull InetSocketAddress serverAddress, @NotNull String namespace, @NotNull String tableName, @NotNull TableIdentifier.NamespaceSet namespaceSet, @NotNull String internalPartition, @NotNull String columnPartition, ZoneId zoneId, TokenFactoryFactory tokenFactorySource, @Nullable BiFunction<String,ZoneId,io.deephaven.enterprise.binlog.channels.ExpirationManager<String>> columnPartitionFactory)
      Create a BinaryStoreAggregatorWriterStandard for the specified time zone. This is for a specific table location (i.e. namespace/table name/namespace set/internal partition), with column partition values either specified explicitly or determined by a current-date column partition factory.
      Parameters:
      log - the Logger instance
      serverAddress - the LAS server's address
      namespace - the namespace
      tableName - the table name
      namespaceSet - the namespace set
      internalPartition - the internal partition
      columnPartition - the column partition; if NULL_PARTITION is specified, then the current date column partition factory will be used to determine column partition values
      zoneId - the time zone ID for standard partition determination, or null to use the system default zone
      tokenFactorySource - a token source for authentication
      Throws:
      IOException - from initialization
  • Method Details

    • setHeader

      public void setHeader(ByteBuffer headerBuffer) throws IOException
      Specified by:
      setHeader in interface io.deephaven.enterprise.binlog.support.SinglePartitionBufferWriter
      Throws:
      IOException
    • getChannel

      @NotNull public GatheringByteChannel getChannel() throws IOException
      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 interface io.deephaven.enterprise.binlog.channels.ChannelManagerStandard
      Returns:
      non-null, open channel to the server, else an exception
      Throws:
      IOException
    • close

      public void close() throws IOException
      Send CLIENT_FINISHED message, poll for an ACK and close the channel.
      Specified by:
      close in interface io.deephaven.enterprise.binlog.channels.ChannelManager
      Specified by:
      close in interface io.deephaven.enterprise.binlog.support.SinglePartitionBufferWriter
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Specified by:
      flush in interface io.deephaven.enterprise.binlog.channels.ChannelManager
      Throws:
      IOException
    • sendDeletePartition

      public void sendDeletePartition() throws IOException
      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 static io.deephaven.enterprise.binlog.channels.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 date
      zoneid - the ZoneId needed to create a DailyExpiration
      Returns:
      an ExpirationManager appropriate to the member variables
    • writeDataToPartition

      public void writeDataToPartition(ByteBuffer bufferToWrite) throws IOException
      Specified by:
      writeDataToPartition in interface io.deephaven.enterprise.binlog.support.SinglePartitionBufferWriter
      Throws:
      IOException