Package com.illumon.iris.db.v2.remote
Class ReplicatedTable
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,LiveTable,NotificationQueue.Dependency,Deflatable<Table>,Table,LivenessManager,LivenessNode,LivenessReferent,LongSizedDataStructure,DynamicNode,DynamicTable,NotificationStepReceiver,NotificationStepSource,SystemicObject,Closeable,Serializable,AutoCloseable,Runnable
A client side viewport of a server side Table. This is backed by a RemoteTableHandle.TableProxy
which is in turn backed by a RemoteTableHandle. Clients may request a client id to set
a specific viewport. This class will subscribe to updates for all of the specified rows and columns in all set viewports.
Note that in this case viewport is defined as a set of positions into the original table.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA listener for population events within this table.Nested classes/interfaces inherited from class com.illumon.iris.db.v2.remote.InitialSnapshotTable
InitialSnapshotTable.Setter<T>Nested classes/interfaces inherited from class com.illumon.iris.db.v2.QueryTable
QueryTable.FilteredTable, QueryTable.MemoizableOperation, QueryTable.OperationNested classes/interfaces inherited from class com.illumon.iris.db.v2.BaseTable
BaseTable.CopyAttributeOperation, BaseTable.ListenerImpl, BaseTable.ShiftAwareListenerImpl, BaseTable.SwapListenerFactory<T extends SwapListenerBase>Nested classes/interfaces inherited from interface com.illumon.iris.db.tables.Table
Table.AsOfMatchRule, Table.GroupStrategy, Table.RenameFunction -
Field Summary
FieldsFields inherited from class com.illumon.iris.db.v2.remote.InitialSnapshotTable
capacity, freeset, populatedCells, populatedRows, settersFields inherited from class com.illumon.iris.db.v2.QueryTable
modifiedColumnSet, USE_CHUNKED_CROSS_JOIN, USE_UNTRACKED_LASTBY_FOR_AUTOMATED_FILTERSFields inherited from class com.illumon.iris.db.v2.BaseTable
attributes, definition, description, PRINT_SERIALIZED_UPDATE_OVERLAPS, sharedAttributesFields inherited from interface com.illumon.iris.db.v2.NotificationStepReceiver
NULL_NOTIFICATION_STEPFields inherited from interface com.illumon.iris.db.tables.Table
ACL_ATTRIBUTE, ADD_ONLY_TABLE_ATTRIBUTE, COLUMN_DESCRIPTIONS_ATTRIBUTE, COLUMN_RENDERERS_ATTRIBUTE, CUSTOM_ACTIONS_ATTRIBUTE, DO_NOT_MAKE_REMOTE_ATTRIBUTE, EMPTY_SOURCE_TABLE_ATTRIBUTE, FILTERABLE_COLUMNS_ATTRIBUTE, HIERARCHICAL_CHILDREN_TABLE_MAP_ATTRIBUTE, HIERARCHICAL_SOURCE_INFO_ATTRIBUTE, HIERARCHICAL_SOURCE_TABLE_ATTRIBUTE, INPUT_TABLE_ATTRIBUTE, KEY_COLUMNS_ATTRIBUTE, LAYOUT_HINTS_ATTRIBUTE, MERGED_TABLE_ATTRIBUTE, NON_DISPLAY_TABLE, PLUGIN_NAME, PREDEFINED_ROLLUP_ATTRIBUTE, PREEMPTIVE_VIEWPORT_TYPE, PREPARED_RLL_ATTRIBUTE, PREVIEW_PARENT_TABLE, REVERSE_LOOKUP_ATTRIBUTE, ROLLUP_LEAF_ATTRIBUTE, SNAPSHOT_VIEWPORT_TYPE, SORTABLE_COLUMNS_ATTRIBUTE, SORTED_COLUMNS_ATTRIBUTE, SYSTEMIC_TABLE_ATTRIBUTE, TABLE_DESCRIPTION_ATTRIBUTE, TOTALS_TABLE_ATTRIBUTE, TREE_TABLE_FILTER_REVERSE_LOOKUP_ATTRIBUTE, UNIQUE_KEYS_ATTRIBUTE, UNTRACKED_LASTBY_TABLE_ATTRIBUTE, VIEWPORT_TYPE_ATTRIBUTE, ZERO_LENGTH_TABLE_ARRAY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedReplicatedTable(com.fishlib.io.logger.Logger log, LiveTableRegistrar registrar, NotificationQueue notificationQueue, int subscriptionId, RemoteTableHandle.TableProxy tableProxy, LinkedHashMap<String, ColumnSource> columns, WritableSource[] writableSources, RedirectionIndex redirectionIndex, BitSet subscribedColumns, boolean isViewPort) -
Method Summary
Modifier and TypeMethodDescriptionvoidListen for population events.com.fishlib.base.log.LogOutputappend(com.fishlib.base.log.LogOutput logOutput) voidclose()Release resources held by this table, possibly destructively.voidEnqueue an error to be reported on the next refresh cycle.voidfreeze()Freeze the table.getAttribute(String key) Get the value of the specified attribute.protected NotificationQueueGet the notification queue to insert notifications into as they are generated by listeners duringDynamicTable.notifyListeners(Index, Index, Index).Get the set of populated rows in Key space.longGet theRemoteTableHandlebacking thisReplicatedTableintGet the subscription ID of this table with the server.Get theRemoteTableHandle.TableProxybacking this replicated table.booleanCheck if this table has beenunsubscribed.intAllocate and return a new viewport client ID for use withsetViewPort(int, Index)and it's overrides.Get the current positional viewport index.voidhandleUpdate(DeltaUpdates deltaUpdates) booleanhasAttribute(String name) Check if the specified attribute exists in this table.booleanisColumnFullyPopulated(int column) Check if the column specified is fully populated.booleanisPopulated(long position, int column) Check if the specified position is populated.booleanisPopulated(long row, BitSet columns) Check if All of the columns in the specified row are populated.booleanisPopulated(Index rows, BitSet columns) Check if All of the columns in the specified row are populated.booleanCheck if this table is a viewport.protected static LinkedHashMap<String,ColumnSource> makeColumns(com.illumon.dataobjects.ColumnDefinition[] columns, WritableSource[] writableSources, RedirectionIndex emptyRedirectionIndex) Setup the columns for the replicated table.voidrefresh()Refresh this LiveTable.voidRemove the specified listener from notifications.voidremoveViewportClient(int client) Remove the specified client from the set of viewports.voidsetColumnUpdateSnapshot(InitialSnapshot updateSnapshot) voidsetInitialSnapshot(InitialSnapshot initialSnapshot) voidsetReplacementSnapshot(InitialSnapshot replacementSnapshot) voidsetRowUpdateSnapshot(InitialSnapshot updateSnapshot) voidSet this table as unsubscribed.static ReplicatedTablesetupForUnitTests(com.fishlib.io.logger.Logger log, LiveTableRegistrar registrar, NotificationQueue notificationQueue, RemoteTableHandle.TableProxy tableProxy, int tableId, Table tablePrototype, boolean isViewPort) static ReplicatedTablesetupReplicatedTable(com.fishlib.io.logger.Logger log, int tableId, RemoteTableHandle.TableProxy tableProxy, BitSet subscribedColumns, boolean isViewPort) Set up a Replicated table from the given proxy, id and columns.voidsetViewPort(int client, long firstPosition, long lastPosition) Set the row viewport for the specified client.voidsetViewPort(int client, Index newViewPort) Set the positional viewport for a particular clientvoidsetViewportAndColumns(int client, long firstPosition, long lastPosition, BitSet columns) Set the row and column viewport for the specified client.voidsetViewportAndColumns(int client, Index newViewPort, BitSet columns) Set the positional viewport and relevant columns for the specified clientvoidsuspendViewportClient(int client) Suspend the viewport for a particular client.toString()voidUnsubscribe this table from the server.voidupdateColumnSubscriptions(int client, BitSet newColumns) Set the set of columns subscribed for the specified client id.voidWait for initial data to be available.voidWait for all of the columns and rows in the viewport to become populated.voidwaitForPopulation(long position, int column) Waits for the specified position to become populated.voidwaitForPopulation(Index positions, BitSet columns) Waits for all of the columns in the specified positions to become populated.Methods inherited from class com.illumon.iris.db.v2.remote.InitialSnapshotTable
getFreeRows, getSetter, getSubscribedColumns, isSubscribedColumn, processInitialSnapshot, setupInitialSnapshotTable, setupInitialSnapshotTable, setupInitialSnapshotTable, setupInitialSnapshotTableMethods inherited from class com.illumon.iris.db.v2.QueryTable
absSumBy, aj, apply, applyToAllBy, avgBy, by, byExternal, copy, copy, countBy, disableParallelWhereForThread, disableWriteReplace, dropColumns, enableWriteReplace, exactJoin, firstBy, flatten, getColumn, getColumnSource, getColumnSourceMap, getColumnSources, getDataIndex, getIndex, getModifiedColumnSetForUpdates, getRecord, getSubTable, getSubTable, head, headBy, headPct, isFlat, join, lastBy, lazyUpdate, leftJoin, maxBy, medianBy, memoizeResult, minBy, naturalJoin, newModifiedColumnSet, newModifiedColumnSetIdentityTransformer, newModifiedColumnSetIdentityTransformer, newModifiedColumnSetTransformer, preemptiveSnapshotTable, preemptiveUpdatesTable, preemptiveUpdatesTable, raj, releaseCachedResources, renameColumns, reverse, rollup, select, selectDistinct, setDataIndexProvider, setFlat, setMemoizeResults, silent, size, slice, snapshot, snapshotHistory, snapshotIncremental, sort, stdBy, sumBy, tail, tailBy, tailPct, treeTable, ungroup, update, updateBy, updateView, validateSelect, varBy, view, wavgBy, where, whereIn, wouldMatch, wsumByMethods inherited from class com.illumon.iris.db.v2.BaseTable
addParentReference, awaitUpdate, awaitUpdate, clearSortingRestrictions, copyAttributes, copyAttributes, createSwapListenerIfRefreshing, destroy, getAttributeNames, getAttributes, getDefinition, getDescription, getLastNotificationStep, initializeWithSnapshot, isAddOnly, isAddOnly, isFailed, isRefreshing, isSystemicObject, layoutHints, listenForDirectUpdates, listenForUpdates, listenForUpdates, markSystemic, notifyListeners, notifyListenersOnError, removeDirectUpdateListener, removeUpdateListener, removeUpdateListener, restrictSortTo, satisfied, setAttribute, setColumnRenderers, setLastNotificationStep, setRefreshing, setTotalsTable, shouldCopyAttribute, withColumnDescription, withKeys, withTableDescription, withUniqueKeysMethods inherited from class com.illumon.iris.db.util.liveness.LivenessArtifact
manageWithCurrentScope, unmanage, unmanageMethods inherited from class com.illumon.iris.db.util.liveness.ReferenceCountedLivenessNode
dropReference, getWeakReference, initializeTransientFieldsForLiveness, onReferenceCountAtZero, tryManage, tryRetainReferenceMethods inherited from class com.illumon.util.referencecounting.ReferenceCounted
decrementReferenceCount, incrementReferenceCount, resetReferenceCount, tryDecrementReferenceCount, tryIncrementReferenceCountMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.DynamicTable
listenForUpdates, newModifiedColumnSetTransformer, newModifiedColumnSetTransformer, notifyListenersMethods inherited from interface com.illumon.iris.db.util.liveness.LivenessManager
manage, tryManageMethods inherited from interface com.illumon.iris.db.util.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReferenceMethods inherited from interface com.illumon.iris.db.util.LongSizedDataStructure
intSize, intSizeMethods inherited from interface com.illumon.iris.db.tables.Table
absSumBy, absSumBy, absSumBy, aj, aj, aj, aj, aj, applyToAllBy, applyToAllBy, applyToAllBy, avgBy, avgBy, avgBy, by, by, by, by, by, by, byExternal, byteColumnIterator, characterColumnIterator, coalesce, columnIterator, countBy, countBy, countBy, dateTimeColumnAsNanos, dateTimeColumnAsNanos, deflate, deflate, doubleColumnIterator, dropColumnFormats, dropColumns, exactJoin, exactJoin, exactJoin, exactJoin, firstBy, firstBy, firstBy, floatColumnIterator, formatColumns, formatColumnWhere, formatRowWhere, getAttributes, getColumn, getColumns, getColumnSource, getMeta, getViewPort, hasColumns, hasColumns, headBy, headBy, integerColumnIterator, isEmpty, isLive, join, join, join, join, join, join, join, join, join, lastBy, lastBy, lastBy, layoutHints, lazyUpdate, lazyUpdate, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, longColumnIterator, maxBy, maxBy, maxBy, medianBy, medianBy, medianBy, minBy, minBy, minBy, moveColumns, moveColumns, moveDownColumns, moveUpColumns, naturalJoin, naturalJoin, naturalJoin, naturalJoin, preemptiveSnapshotTable, raj, raj, raj, raj, raj, renameAllColumns, renameColumns, renameColumns, rollup, rollup, rollup, rollup, rollup, rollup, rollup, select, select, select, selectDistinct, selectDistinct, selectDistinct, shortColumnIterator, sizeForInstrumentation, snapshot, snapshotIncremental, sort, sort, sortDescending, sortDescending, stdBy, stdBy, stdBy, subscribeToPreemptiveUpdates, sumBy, sumBy, sumBy, supportsPreemptiveSubscription, tailBy, tailBy, ungroup, ungroup, ungroup, ungroupAllBut, update, update, updateBy, updateBy, updateBy, updateBy, updateBy, updateView, updateView, validateSelect, varBy, varBy, varBy, view, view, wavgBy, wavgBy, wavgBy, where, where, where, whereIn, whereIn, whereIn, whereNotIn, whereNotIn, whereOneOf, whereOneOf, whereOneOf, withColumnDescription, wouldMatch, wsumBy, wsumBy, wsumBy
-
Field Details
-
REPLICATED_TABLE_DEBUG
public static final boolean REPLICATED_TABLE_DEBUG
-
-
Constructor Details
-
ReplicatedTable
protected ReplicatedTable(com.fishlib.io.logger.Logger log, LiveTableRegistrar registrar, NotificationQueue notificationQueue, int subscriptionId, @NotNull RemoteTableHandle.TableProxy tableProxy, LinkedHashMap<String, ColumnSource> columns, WritableSource[] writableSources, RedirectionIndex redirectionIndex, BitSet subscribedColumns, boolean isViewPort)
-
-
Method Details
-
getProcessedDelta
public long getProcessedDelta() -
setInitialSnapshot
-
setReplacementSnapshot
-
setColumnUpdateSnapshot
-
setRowUpdateSnapshot
-
getSubscriptionId
public int getSubscriptionId()Get the subscription ID of this table with the server. This ID can be used to retrieve the table on the server within aRemoteQuery- Returns:
- the id of this table for use with queries to the server
-
handleUpdate
-
refresh
public void refresh()Description copied from interface:LiveTableRefresh this LiveTable. -
getNotificationQueue
Description copied from class:BaseTableGet the notification queue to insert notifications into as they are generated by listeners duringDynamicTable.notifyListeners(Index, Index, Index). This method may be overridden to provide a different notification queue than theLiveTableMonitor.DEFAULTinstance for more complex behavior.- Overrides:
getNotificationQueuein classBaseTable- Returns:
- The
NotificationQueueto add to.
-
freeze
public void freeze()Freeze the table. This will stop all update propagation. -
close
public void close()Description copied from interface:TableRelease resources held by this table, possibly destructively. This may render the table unsuitable or unsafe for further use. -
unsubscribe
public void unsubscribe()Unsubscribe this table from the server. The table will no longer be usable afterwards -
updateColumnSubscriptions
Set the set of columns subscribed for the specified client id.- Parameters:
client- the client idnewColumns- the columns that should be subscribed.
-
getViewportClientId
public int getViewportClientId()Allocate and return a new viewport client ID for use withsetViewPort(int, Index)and it's overrides.- Returns:
- the newly allocated client id.
-
setViewPort
public void setViewPort(int client, long firstPosition, long lastPosition) Set the row viewport for the specified client.- Parameters:
client- the client idfirstPosition- the first position in the viewportlastPosition- the last position in the viewport (exclusive)
-
setViewportAndColumns
public void setViewportAndColumns(int client, long firstPosition, long lastPosition, BitSet columns) Set the row and column viewport for the specified client.- Parameters:
client- the client idfirstPosition- the first position in the viewportlastPosition- the last position in the viewport (exclusive)columns- the columns in the viewport
-
removeViewportClient
public void removeViewportClient(int client) Remove the specified client from the set of viewports. This will remove any subscribed viewports for this client.- Parameters:
client- the client to remove.
-
suspendViewportClient
public void suspendViewportClient(int client) Suspend the viewport for a particular client. Suspended viewports will not receive updates- Parameters:
client- the client to suspend
-
setViewPort
Set the positional viewport for a particular client- Parameters:
client- the client idnewViewPort- the viewport for this client
-
setViewportAndColumns
Set the positional viewport and relevant columns for the specified client- Parameters:
client- the client idnewViewPort- the positional viewportcolumns- the columns to include
-
getUnsubscribed
public boolean getUnsubscribed()Check if this table has beenunsubscribed.- Returns:
- true if the table has been unsubscribed
-
setUnsubscribed
public void setUnsubscribed()Set this table as unsubscribed. -
enqueueError
Enqueue an error to be reported on the next refresh cycle.- Parameters:
e- The error
-
getTableProxy
Get theRemoteTableHandle.TableProxybacking this replicated table.- Returns:
- the backing proxy
-
setupReplicatedTable
@InternalUseOnly public static ReplicatedTable setupReplicatedTable(com.fishlib.io.logger.Logger log, int tableId, @NotNull RemoteTableHandle.TableProxy tableProxy, BitSet subscribedColumns, boolean isViewPort) Set up a Replicated table from the given proxy, id and columns. This is intended for Deephaven use only.- Parameters:
log- a loggertableId- the table ID from the pqtableProxy- the proxy to the original tablesubscribedColumns- a bitset of columns that are subscribedisViewPort- true if the table will be a viewport.- Returns:
- a properly initialized
ReplicatedTable
-
setupForUnitTests
@TestUseOnly public static ReplicatedTable setupForUnitTests(com.fishlib.io.logger.Logger log, LiveTableRegistrar registrar, NotificationQueue notificationQueue, @NotNull RemoteTableHandle.TableProxy tableProxy, int tableId, Table tablePrototype, boolean isViewPort) -
makeColumns
@NotNull protected static LinkedHashMap<String,ColumnSource> makeColumns(com.illumon.dataobjects.ColumnDefinition[] columns, WritableSource[] writableSources, RedirectionIndex emptyRedirectionIndex) Setup the columns for the replicated table. NB: Your emptyRedirectionIndex must be initialized and empty. -
waitForData
public void waitForData()Wait for initial data to be available. This method will block. -
waitForPopulation
public void waitForPopulation(long position, int column) Waits for the specified position to become populated. This method automatically converts the specified position into the table's keyspace.- Parameters:
position- the positioncolumn- the column
-
waitForPopulation
public void waitForPopulation()Wait for all of the columns and rows in the viewport to become populated. -
waitForPopulation
Waits for all of the columns in the specified positions to become populated. This method automatically converts the specified positions into the table's keyspace.- Parameters:
positions- the rows to inspectcolumns- a BitSet of column indices to check for population
-
isViewPort
public boolean isViewPort()Check if this table is a viewport. A viewport table is a partial view of another table. If this returns false then this table contains the entire source table it was based on.- Returns:
- true if this table was a viewport.
-
isPopulated
public boolean isPopulated(long position, int column) Check if the specified position is populated. This method automatically converts the specified position into the table's keyspace.- Parameters:
position- the positioncolumn- the column- Returns:
- true of it has been populated
-
getViewportIndex
Get the current positional viewport index. If this ReplicatedTable is a viewport for another table (see ...) then this returns the union of all viewports from all clients. Otherwise it returns a flat set of positions from 0 - tableSize -1;- Returns:
- an index of viewport positions
-
getPopulatedRows
Get the set of populated rows in Key space.- Returns:
- the populated keys.
-
isPopulated
Check if All of the columns in the specified row are populated. Note that the input row index is expected to be in position space. It is internally converted to the table's keyspace.- Parameters:
row- The row to inspectcolumns- a BitSet of column indices to check for population
-
isPopulated
Check if All of the columns in the specified row are populated. Note that the input row index is expected to be in position space. It is internally converted to the table's keyspace.- Parameters:
rows- the rows to inspectcolumns- a BitSet of column indices to check for population
-
isColumnFullyPopulated
public boolean isColumnFullyPopulated(int column) Check if the column specified is fully populated.- Parameters:
column- the column index- Returns:
- true if the column is completely populated.
-
getAttribute
Description copied from interface:TableGet the value of the specified attribute.- Specified by:
getAttributein interfaceTable- Overrides:
getAttributein classBaseTable- Parameters:
key- the name of the attribute- Returns:
- the value, or null if there was none.
-
hasAttribute
Description copied from interface:TableCheck if the specified attribute exists in this table.- Specified by:
hasAttributein interfaceTable- Overrides:
hasAttributein classBaseTable- Parameters:
name- the name of the attribute- Returns:
- true if the attribute exists
-
addPopulationListener
Listen for population events. Note that these are stored asWeakReferences, so you must retain a reference to them somewhere or they will be reclaimed by the garbage collector.- Parameters:
listener- the listener
-
removePopulationListener
Remove the specified listener from notifications.- Parameters:
listener- the listener to remove
-
getRemoteTableHandle
Get theRemoteTableHandlebacking thisReplicatedTable- Returns:
- the RemoteTableHandle.
-
toString
-
append
public com.fishlib.base.log.LogOutput append(@NotNull com.fishlib.base.log.LogOutput logOutput)
-