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
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumstatic classTableData type for full table subscriptions.static classstatic classBase type to allow trees to extend from here separately from tables.static classTableData type for viewport subscriptions.Nested classes/interfaces inherited from class io.deephaven.web.client.api.event.HasEventHandling
HasEventHandling.EventPair<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WebBarrageSubscriptionstatic final StringIndicates that some new data is available on the client, either an initial snapshot or a delta update.protected intprotected AbstractTableSubscription.Statusprotected RangeSetFields inherited from class io.deephaven.web.client.api.event.HasEventHandling
INTERNAL_EVENT_RELEASED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractTableSubscription(SubscriptionType subscriptionType, ClientTableState state, WorkerConnection connection) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops the subscription on the server.protected WorkerConnectionstatic ClientTableStatecreatePreview(WorkerConnection connection, ClientTableState tableState, DataOptions.PreviewOptions previewOptions) elemental2.core.JsArray<Column>The columns that were subscribed to when this subscription was createdstatic intgetPreviewListLengthLimit(DataOptions options) booleanReturns 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.booleanisClosed()Returns true if the subscription is closed and cannot be used again, false if it is actively listening for more data.protected booleanTrue if the subscription is in the ACTIVE state, meaning that the server and client are in sync with the state of the subscription.protected BitSetmakeColumnBitset(elemental2.core.JsArray<Column> columns) protected voidnotifyUpdate(RangeSet rowsAdded, RangeSet rowsRemoved, RangeSet totalMods, ShiftedRange[] shifted) protected voidprotected voidrevive()Creates the connection to the server.protected voidsendBarrageSubscriptionRequest(@Nullable RangeSet viewport, elemental2.core.JsArray<Column> columns, Double updateIntervalMs, boolean isReverseViewport, int previewListLengthLimit) protected abstract voiddoublesize()state()protected static com.google.flatbuffers.FlatBufferBuildersubscriptionRequest(byte[] tableTicket, BitSet columns, @Nullable RangeSet viewport, BarrageSubscriptionOptions options, boolean isReverseViewport) Methods inherited from class io.deephaven.web.client.api.event.HasEventHandling
addEventListener, addEventListenerOneShot, addEventListenerOneShot, failureHandled, fireCriticalEvent, fireCriticalEvent, fireEvent, fireEvent, fireEvent, hasListener, hasListeners, isSuppress, logPrefix, nextEvent, removeEventListener, suppressEvents, unsuppressEvents
-
Field Details
-
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
-
barrageSubscription
-
status
-
-
Constructor Details
-
AbstractTableSubscription
protected AbstractTableSubscription(SubscriptionType subscriptionType, ClientTableState state, WorkerConnection connection)
-
-
Method Details
-
createPreview
public static ClientTableState createPreview(WorkerConnection connection, ClientTableState tableState, DataOptions.PreviewOptions previewOptions) -
getPreviewListLengthLimit
-
revive
protected void revive()Creates the connection to the server. Used on initial connection, and for viewport reconnects. -
sendFirstSubscriptionRequest
protected abstract void sendFirstSubscriptionRequest() -
makeColumnBitset
-
state
-
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() -
onStreamEnd
-
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.
-