Class BarrageMessageWriterImpl

java.lang.Object
io.deephaven.extensions.barrage.BarrageMessageWriterImpl
All Implemented Interfaces:
BarrageMessageWriter, SafeCloseable, AutoCloseable

public class BarrageMessageWriterImpl extends Object implements BarrageMessageWriter
  • Constructor Details

    • BarrageMessageWriterImpl

      public BarrageMessageWriterImpl(@NotNull @NotNull BarrageMessage message, @NotNull @NotNull ChunkWriter<Chunk<Values>>[] chunkWriters, @NotNull BarragePerformanceLog.WriteMetricsConsumer writeConsumer)
      Create a barrage stream writer that can slice and dice the barrage message for delivery to clients.
      Parameters:
      message - the writer takes ownership of the message and its internal objects
      chunkWriters - the chunk chunkWriters
      writeConsumer - a method that can be used to record write time
  • Method Details

    • getMessage

      public BarrageMessage getMessage()
      Specified by:
      getMessage in interface BarrageMessageWriter
      Returns:
      the BarrageMessage that this writer is operating on
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SafeCloseable
    • getSubView

      public BarrageMessageWriter.MessageView getSubView(BarrageSubscriptionOptions options, boolean isInitialSnapshot, boolean isFullSubscription, @Nullable @Nullable RowSet viewport, boolean reverseViewport, @Nullable @Nullable RowSet keyspaceViewportPrev, @Nullable @Nullable RowSet keyspaceViewport, @Nullable @Nullable BitSet subscribedColumns)
      Description copied from interface: BarrageMessageWriter
      Obtain a BarrageMessageWriter.MessageView of this BarrageMessageWriter that can be sent to a single subscriber.

      Note that all passed in arguments are owned by the caller and may be modified external to this method.

      Specified by:
      getSubView in interface BarrageMessageWriter
      Parameters:
      options - serialization options for this specific view
      isInitialSnapshot - indicates whether this is the first snapshot for the listener
      isFullSubscription - whether this is a full subscription (possibly a growing viewport)
      viewport - is the position-space viewport
      reverseViewport - is the viewport reversed (relative to end of table instead of beginning)
      keyspaceViewportPrev - is the key-space viewport prior to applying the update
      keyspaceViewport - is the key-space viewport
      subscribedColumns - are the columns subscribed for this view
      Returns:
      a MessageView filtered by the subscription properties that can be sent to that subscriber
    • getSubView

      public BarrageMessageWriter.MessageView getSubView(BarrageSubscriptionOptions options, boolean isInitialSnapshot)
      Description copied from interface: BarrageMessageWriter
      Obtain a Full-Subscription BarrageMessageWriter.MessageView of this BarrageMessageWriter that can be sent to a single subscriber.
      Specified by:
      getSubView in interface BarrageMessageWriter
      Parameters:
      options - serialization options for this specific view
      isInitialSnapshot - indicates whether this is the first snapshot for the listener
      Returns:
      a MessageView filtered by the subscription properties that can be sent to that subscriber
    • getSnapshotView

      public BarrageMessageWriter.MessageView getSnapshotView(BarrageSnapshotOptions options, @Nullable @Nullable RowSet viewport, boolean reverseViewport, @Nullable @Nullable RowSet keyspaceViewport, @Nullable @Nullable BitSet snapshotColumns)
      Description copied from interface: BarrageMessageWriter
      Obtain a BarrageMessageWriter.MessageView of this BarrageMessageWriter that can be sent to a single requestor.

      Note that all passed in arguments are owned by the caller and may be modified external to this method.

      Specified by:
      getSnapshotView in interface BarrageMessageWriter
      Parameters:
      options - serialization options for this specific view
      viewport - is the position-space viewport
      reverseViewport - is the viewport reversed (relative to end of table instead of beginning)
      snapshotColumns - are the columns included for this view
      Returns:
      a MessageView filtered by the snapshot properties that can be sent to that requestor
    • getSnapshotView

      public BarrageMessageWriter.MessageView getSnapshotView(BarrageSnapshotOptions options)
      Description copied from interface: BarrageMessageWriter
      Obtain a Full-Snapshot BarrageMessageWriter.MessageView of this BarrageMessageWriter that can be sent to a single requestor.
      Specified by:
      getSnapshotView in interface BarrageMessageWriter
      Parameters:
      options - serialization options for this specific view
      Returns:
      a MessageView filtered by the snapshot properties that can be sent to that requestor
    • writeHeader

      protected void writeHeader(ByteBuffer metadata, MutableInt size, com.google.flatbuffers.FlatBufferBuilder header, ExposedByteArrayOutputStream baos) throws IOException
      This implementation prepares the protobuf FlightData header.
      Throws:
      IOException