Class AbstractTableSubscription

java.lang.Object
io.deephaven.web.client.api.event.HasEventHandling
io.deephaven.web.client.api.subscription.AbstractTableSubscription
Direct Known Subclasses:
JsTreeTable.TreeSubscription, TableSubscription, TableViewportSubscription

@TsIgnore public abstract class AbstractTableSubscription extends HasEventHandling
Superclass of various subscription types, allowing specific implementations to customize behavior for their needs.

Instances are not ready to use right away, owing to the fact that we need to wait both for the provided state to resolve (so that we have the table schema, know what kind of subscription we will make, and know what column types will be resolves), and because until the subscription has finished being set up, we will not have received the size of the table. When closed, it cannot be reused again.

This is also a base class for types exposed to JS.

This is a rough analog of the JVM's BarrageSubscriptionImpl class. In contrast to the JVM code, this is exposed to api consumers, rather than wrapping in a Table type, as it handles the barrage stream and provides events that client code can listen to.

  • Field Details

    • EVENT_UPDATED

      public static final String EVENT_UPDATED
      Indicates that some new data is available on the client, either an initial snapshot or a delta update. The detail field of the event will contain a TableSubscriptionEventData detailing what has changed, or allowing access to the entire range of items currently in the subscribed columns.
      See Also:
    • rowStyleColumn

      protected int rowStyleColumn
    • viewportRowSet

      protected RangeSet viewportRowSet
    • barrageSubscription

      protected WebBarrageSubscription barrageSubscription
    • status

  • Constructor Details

  • Method Details

    • revive

      protected void revive()
      Creates the connection to the server. Used on initial connection, and for viewport reconnects.
    • subscriptionRequest

      protected static com.google.flatbuffers.FlatBufferBuilder subscriptionRequest(byte[] tableTicket, BitSet columns, @Nullable @Nullable RangeSet viewport, BarrageSubscriptionOptions options, boolean isReverseViewport)
    • sendFirstSubscriptionRequest

      protected abstract void sendFirstSubscriptionRequest()
    • sendBarrageSubscriptionRequest

      protected void sendBarrageSubscriptionRequest(@Nullable @Nullable RangeSet viewport, elemental2.core.JsArray<Column> columns, Double updateIntervalMs, boolean isReverseViewport)
    • makeColumnBitset

      protected BitSet makeColumnBitset(elemental2.core.JsArray<Column> columns)
    • state

      public ClientTableState state()
    • connection

      protected WorkerConnection connection()
    • isSubscriptionReady

      protected boolean isSubscriptionReady()
      True if the subscription is in the ACTIVE state, meaning that the server and client are in sync with the state of the subscription.
    • isClosed

      public boolean isClosed()
      Returns true if the subscription is closed and cannot be used again, false if it is actively listening for more data.
    • hasValidSize

      public boolean hasValidSize()
      Returns true if the subscription is in a state where it can be used to read data, false if still waiting for the server to send the first snapshot or if the subscription has been closed.
      Returns:
      true if the size() method will return data based on the subscription, false if some other source of the table's size will be used.
    • size

      public double size()
    • notifyUpdate

      protected void notifyUpdate(RangeSet rowsAdded, RangeSet rowsRemoved, RangeSet totalMods, ShiftedRange[] shifted)
    • onStreamEnd

      protected void onStreamEnd(ResponseStreamWrapper.Status status)
    • getColumns

      public elemental2.core.JsArray<Column> getColumns()
      The columns that were subscribed to when this subscription was created
      Returns:
      Column
    • close

      @JsMethod public void close()
      Stops the subscription on the server.