Package io.deephaven.web.client.state
Class ClientTableState
java.lang.Object
io.deephaven.web.client.api.batch.TableConfig
io.deephaven.web.client.state.ClientTableState
Container for state information pertaining to a given
TableTicket
.
Where JsTable is a mutable object which can point to any given ClientTableState, each ClientTableState represents an
immutable table configuration / handle which can have zero or more JsTable objects bound to it.
This type is used to replace Table#StackEntry, and works with TableList to form an arbitrary "chain of table
mutations leading to table state at handle N".
Each JsTable maintains their own TableList / linking structure of ClientTableState instances, and each CTS holds maps
of "the state each bound JsTable holds -for this particular handle-".
Being mutable, a JsTable can change its binding to any given CTS instance, and will need to temporarily abandon it's
current state when transitioning to a new one. We need to be able to reinstate the last good active state whenever a
request fails, otherwise we will releaseTable from the given state.
Once no JsTable is making any use of any ClientTableState, that state should be released on the server and discarded
by the client (an interim state which an active state is based on must always be retained).
By making the JsTable read it's state from a ClientTableState, switching to another state should be relatively
seamless; JsTable is mutable and as stateless as possible, with as much state as possible shoved into CTS (so it can
go away and be restored sanely).
Consider making this a js type with restricted, read-only property access.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class io.deephaven.web.client.api.batch.TableConfig
TableConfig.JsConfig
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClientTableState
(WorkerConnection connection, TableTicket handle, JsTableFetch fetcher, String fetchSummary) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPaused
(JsTable table, PausedTableBinding paused) void
void
cleanup()
Look through paused tables to see if any of them have been closed.Class<?>[]
Returns the Java Class to represent each column in the table.Class<?>[]
Returns the Java Class to represent the component type in any list/array type.createBinding
(JsTable table) void
boolean
elemental2.promise.Promise<JsTable>
fetchTable
(HasEventHandling failHandler, BrowserHeaders metadata) findColumn
(String key) void
forActiveLifecycles
(JsConsumer<HasLifecycle> callback) void
forActiveTables
(JsConsumer<JsTable> callback) getActiveBinding
(JsTable table) Column[]
getBinding
(JsTable table) Column[]
double
long
getSize()
boolean
hasCustomColumn
(CustomColumnDescriptor candidate) boolean
boolean
hasFilter
(FilterCondition candidate) int
hashCode()
boolean
hasRetainer
(Object test) boolean
boolean
boolean
isCompatible
(List<Sort> sorts, List<FilterCondition> filters, List<CustomColumnDescriptor> customColumns, boolean flat) Checks if the current state can be used as a root to turn into the state described by the supplied arguments.boolean
boolean
isEmpty()
boolean
boolean
boolean
boolean
isStatic()
makeBitset
(Column[] columns) elemental2.promise.Promise<ClientTableState>
maybeRevive
(BrowserHeaders metadata) static Comparator<? super ClientTableState>
newState
(TableTicket newHandle, TableConfig config) void
onFailed
(JsConsumer<String> callback, JsRunnable other) void
onRunning
(JsConsumer<ClientTableState> callback, JsConsumer<String> failed, JsRunnable release) void
onRunning
(JsConsumer<ClientTableState> callback, JsRunnable other) void
elemental2.promise.Promise<ClientTableState>
refetch
(HasEventHandling failHandler, BrowserHeaders metadata) boolean
releaseTable
(JsTable table) Call this with a marker object that you want to use to cause the state to be retained.reversed()
void
setResolution
(ClientTableState.ResolutionState resolution) void
setResolution
(ClientTableState.ResolutionState resolution, String failMsg) void
setRowFormatColumn
(Column rowFormatColumn) void
setSize
(long size) boolean
toString()
void
void
Methods inherited from class io.deephaven.web.client.api.batch.TableConfig
getConditions, getCustomColumns, getDropColumns, getFilters, getSelectDistinct, getSorts, getViewColumns, isEmptyConfig, isEqual, isFlat, setConditions, setCustomColumns, setDropColumns, setFilters, setFlat, setSorts, setViewColumns, toJs, toSummaryString
-
Field Details
-
SIZE_UNINITIALIZED
public static final long SIZE_UNINITIALIZED- See Also:
-
-
Constructor Details
-
ClientTableState
public ClientTableState(WorkerConnection connection, TableTicket handle, JsTableFetch fetcher, String fetchSummary)
-
-
Method Details
-
maybeRevive
-
hasDefinition
public boolean hasDefinition() -
isRunning
public boolean isRunning() -
isResolved
public boolean isResolved() -
getHandle
-
columnTypes
Returns the Java Class to represent each column in the table. This lets the client replace certain JVM-only classes with alternative implementations, but still use the simpleBarrageTypeInfo
wrapper. -
componentTypes
Returns the Java Class to represent the component type in any list/array type. At this time, this value is not used by the chunk reading implementation. -
newState
-
getResolution
-
setResolution
-
setResolution
-
getCustomColumnsString
-
getCustomColumnsObject
-
getColumns
-
getAllColumns
-
getLayoutHints
-
getTotalsTableConfig
-
getSize
public long getSize() -
setSize
public void setSize(long size) -
getTableDef
-
getRowFormatColumn
-
setRowFormatColumn
-
equals
- Overrides:
equals
in classTableConfig
-
hashCode
public int hashCode()- Overrides:
hashCode
in classTableConfig
-
isCompatible
public boolean isCompatible(List<Sort> sorts, List<FilterCondition> filters, List<CustomColumnDescriptor> customColumns, boolean flat) Checks if the current state can be used as a root to turn into the state described by the supplied arguments. While it is technically valid to interleave filters and sorts, for maximal performance, we want to ensure filters are always applied before sorts; so, if you have added a filter, but the current state has any sorts at all, we will return false, even though this state would be correct when used, it won't be maximally efficient. Additionally, custom columns might be used in filters and sorts, but a filter or sort on a custom column cannot be created until that custom column has been exported and provides a table definition so that we can supply Column instances to operate upon.- Parameters:
sorts
- The full set of sorts we want in our resulting table statefilters
- The full set of filters we want in our resulting table statecustomColumns
- The full set of custom columns we want in our resulting table stateflat
- True if the resulting table should have a flatten index, false otherwise- Returns:
- true if this state can be used to add
-
findColumn
-
isEmpty
public boolean isEmpty()- Overrides:
isEmpty
in classTableConfig
- Returns:
- true if there are no tables bound to this state. If a table that had a subscription for this state was orphaned by a pending request, we want to clear the subscription immediately so it becomes inert (immediately remove the subscription), but we may need to rollback the request, and we don't want to release the handle until the pending request is finished (whereupon we will remove the binding).
-
retain
Call this with a marker object that you want to use to cause the state to be retained. You either need to hold onto the returned function to clear your binding, or callunretain(Object)
when finished to avoid keeping this handle alive beyond its usefulness. -
unretain
-
hasSort
-
hasFilter
-
isFinished
public boolean isFinished() -
isDisconnected
public boolean isDisconnected() -
addPaused
-
createBinding
-
releaseTable
-
makeBitset
-
getBoundTables
-
toString
- Overrides:
toString
in classTableConfig
-
toStringMinimal
-
getPrevious
-
getBinding
-
getActiveBinding
-
getActiveBindings
-
pause
-
unpause
-
ancestors
-
reversed
-
cleanup
public void cleanup()Look through paused tables to see if any of them have been closed. -
getLastTouched
public double getLastTouched() -
newestFirst
-
fetchTable
public elemental2.promise.Promise<JsTable> fetchTable(HasEventHandling failHandler, BrowserHeaders metadata) -
refetch
public elemental2.promise.Promise<ClientTableState> refetch(HasEventHandling failHandler, BrowserHeaders metadata) -
applyTableCreationResponse
-
isAncestor
-
doNotResuscitate
public void doNotResuscitate() -
shouldResuscitate
public boolean shouldResuscitate() -
hasRetainer
-
getConnection
-
getFetchSummary
-
isStatic
public boolean isStatic()
-