Class BarrageSubscriptionImpl

All Implemented Interfaces:
LogOutputAppendable, BarrageSubscription, LivenessManager, LivenessNode, LivenessReferent

public class BarrageSubscriptionImpl extends ReferenceCountedLivenessNode implements BarrageSubscription
This class is an intermediary helper class that uses a DoExchange to populate a BarrageTable using subscription data from a remote server, propagating updates if the request is a subscription.

Users may call entireTable() or partialTable(io.deephaven.engine.rowset.RowSet, java.util.BitSet) to initiate the gRPC call to the server. These methods return a Future<BarrageTable> to the user.

  • Method Details

    • entireTable

      public Future<Table> entireTable()
      Description copied from interface: BarrageSubscription
      Request a full subscription of the data and populate a Table with the incrementally updating data that is received. The returned future will block until all rows for the subscribed table are available.
      Specified by:
      entireTable in interface BarrageSubscription
      Returns:
      a Future that will be populated with the result Table
    • partialTable

      public Future<Table> partialTable(RowSet viewport, BitSet columns)
      Description copied from interface: BarrageSubscription
      Request a partial subscription of the data limited by viewport or column set and populate a Table with the data that is received. The returned future will block until the subscribed table viewport is satisfied.
      Specified by:
      partialTable in interface BarrageSubscription
      Parameters:
      viewport - the position-space viewport to use for the subscription
      columns - the columns to include in the subscription
      Returns:
      a Future that will be populated with the result Table
    • snapshotEntireTable

      public Future<Table> snapshotEntireTable()
      Description copied from interface: BarrageSubscription
      Request a full snapshot of the data and populate a Table with the incrementally updating data that is received. The returned future will block until all rows for the snapshot table are available.
      Specified by:
      snapshotEntireTable in interface BarrageSubscription
      Returns:
      a Future that will be populated with the result Table
    • snapshotPartialTable

      public Future<Table> snapshotPartialTable(RowSet viewport, BitSet columns)
      Description copied from interface: BarrageSubscription
      Request a partial snapshot of the data limited by viewport or column set and populate a Table with the data that is received. The returned future will block until the snapshot table viewport is satisfied.
      Specified by:
      snapshotPartialTable in interface BarrageSubscription
      Parameters:
      viewport - the position-space viewport to use for the subscription
      columns - the columns to include in the subscription
      Returns:
      a Future that will be populated with the result Table
    • snapshotPartialTable

      public Future<Table> snapshotPartialTable(RowSet viewport, BitSet columns, boolean reverseViewport)
      Description copied from interface: BarrageSubscription
      Request a partial snapshot of the data limited by viewport or column set and populate a Table with the data that is received. Allows the viewport to be reversed. The returned future will block until the snapshot table viewport is satisfied.
      Specified by:
      snapshotPartialTable in interface BarrageSubscription
      Parameters:
      viewport - the position-space viewport to use for the subscription
      columns - the columns to include in the subscription
      reverseViewport - Whether to treat posRowSet as offsets from LongSizedDataStructure.size() rather than 0
      Returns:
      a Future that will be populated with the result Table
    • partialTable

      public Future<Table> partialTable(RowSet viewport, BitSet columns, boolean reverseViewport)
      Description copied from interface: BarrageSubscription
      Request a partial subscription of the data limited by viewport or column set and populate a Table with the data that is received. Allows the viewport to be reversed. The returned future will block until the subscribed table viewport is satisfied.
      Specified by:
      partialTable in interface BarrageSubscription
      Parameters:
      viewport - the position-space viewport to use for the subscription
      columns - the columns to include in the subscription
      reverseViewport - Whether to treat posRowSet as offsets from LongSizedDataStructure.size() rather than 0
      Returns:
      a Future that will be populated with the result Table
    • destroy

      protected void destroy()
      Description copied from class: ReferenceCountedLivenessReferent
      Attempt to release (destructively when necessary) resources held by this object. This may render the object unusable for subsequent operations. Implementations should be sure to call super.destroy().

      This is intended to only ever be used as a side effect of decreasing the reference count to 0.

      Overrides:
      destroy in class ReferenceCountedLivenessReferent
    • append

      public LogOutput append(LogOutput logOutput)
      Specified by:
      append in interface LogOutputAppendable
      Overrides:
      append in class ReferenceCounted
    • makeRequestInternal

      @VisibleForTesting public static ByteBuffer makeRequestInternal(@Nullable @Nullable RowSet viewport, @Nullable @Nullable BitSet columns, boolean reverseViewport, @Nullable @Nullable BarrageSubscriptionOptions options, byte @NotNull [] ticketId)
    • getClientDoExchangeDescriptor

      public static io.grpc.MethodDescriptor<org.apache.arrow.flight.impl.Flight.FlightData,BarrageMessage> getClientDoExchangeDescriptor(BarrageSubscriptionOptions options, ChunkType[] columnChunkTypes, Class<?>[] columnTypes, Class<?>[] componentTypes, StreamReader streamReader)
      Fetch the client side descriptor for a specific table schema.
      Parameters:
      options - the set of options that last across the entire life of the subscription
      columnChunkTypes - the chunk types per column
      columnTypes - the class type per column
      componentTypes - the component class type per column
      streamReader - the stream reader - intended to be thread safe and re-usable
      Returns:
      the client side method descriptor