Class TablePublisher
blink table from added tables.-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a snapshot of the data fromtableinto theblink table.Theblink table'sdefinition.Creates a newblink tablewith itsattribute"InputTable" set to anInputTableUpdaterimplementation based onthis.booleanisAlive()Checks whetherthisis alive; iffalse, the caller should stop adding new data and release any related resources as soon as practicable since adding data won't have any downstream effects.static TablePublisherof(String name, TableDefinition definition, Consumer<TablePublisher> onFlushCallback, Runnable onShutdownCallback) Constructs a table publisher.static TablePublisherof(String name, TableDefinition definition, Consumer<TablePublisher> onFlushCallback, Runnable onShutdownCallback, UpdateGraph updateGraph, int chunkSize) Constructs a table publisher.voidpublishFailure(Throwable failure) Indicate that data publication has failed.table()Theblink table.
-
Method Details
-
of
public static TablePublisher of(String name, TableDefinition definition, @Nullable Consumer<TablePublisher> onFlushCallback, @Nullable Runnable onShutdownCallback) Constructs a table publisher.The
onFlushCallback, if present, is called once at the beginning of each update graph cycle. This is a pattern that allows publishers to add any data they may have been batching. Do note though, this blocks the update cycle from proceeding, so implementations should take care to not do extraneous work.The
onShutdownCallback, if present, is called one time when the publisher should stop publishing new data and release any related resources as soon as practicable since publishing won't have any downstream effects.Equivalent to calling
of(String, TableDefinition, Consumer, Runnable, UpdateGraph, int)with theupdateGraphfromExecutionContext.getContext()andchunkSize2048.- Parameters:
name- the namedefinition- the table definitiononFlushCallback- the on-flush callbackonShutdownCallback- the on-shutdown callback- Returns:
- the table publisher
-
of
public static TablePublisher of(String name, TableDefinition definition, @Nullable Consumer<TablePublisher> onFlushCallback, @Nullable Runnable onShutdownCallback, UpdateGraph updateGraph, int chunkSize) Constructs a table publisher.The
onFlushCallback, if present, is called once at the beginning of each update graph cycle. This is a pattern that allows publishers to add any data they may have been batching. Do note though, this blocks the update cycle from proceeding, so implementations should take care to not do extraneous work.The
onShutdownCallback, if present, is called one time when the publisher should stop publishing new data and release any related resources as soon as practicable since publishing won't have any downstream effects.The
chunkSizeis the size at which chunks will be filled from the source table during anadd(io.deephaven.engine.table.Table). The suggested value is 2048.- Parameters:
name- the namedefinition- the table definitiononFlushCallback- the on-flush callbackonShutdownCallback- the on-shutdown callbackupdateGraph- the update graph for the blink tablechunkSize- the chunk size is the maximum size- Returns:
- the table publisher
-
definition
Theblink table'sdefinition.- Returns:
- the definition
-
table
Theblink table.May return
nullif invoked more than once and the initial caller does not enforce strong reachability of the result.- Returns:
- the blink table
-
add
Adds a snapshot of the data fromtableinto theblink table. The addedtablemust contain a superset of the columns from thedefinition; the columns may be in any order. Columns fromtablethat are not in thedefinitionare ignored.All of the data from
tablewill be:- consistent with a point in time
- fully contained in a single blink table's update cycle
- non-interleaved with any other calls to add (concurrent, or not)
- Parameters:
table- the table to add
-
publishFailure
Indicate that data publication has failed.Blink tablelistenerswill be notified of the failure, the on-shutdown callback will be invoked if it hasn't already been,thispublisher will no longer bealive, and future calls toaddwill silently return without publishing. These effects may resolve asynchronously.- Parameters:
failure- the failure
-
isAlive
public boolean isAlive()Checks whetherthisis alive; iffalse, the caller should stop adding new data and release any related resources as soon as practicable since adding data won't have any downstream effects.Once this is
false, it will always remainfalse. For more prompt notifications, callers may prefer to use on-shutdown callbacks.- Returns:
- if this is alive
-
inputTable
Creates a newblink tablewith itsattribute"InputTable" set to anInputTableUpdaterimplementation based onthis. The implementation's definition of "completed" with respect toInputTableUpdater.add(Table)andInputTableUpdater.addAsync(Table, InputTableStatusListener)matches the semantics provided byadd(Table)- that is, "completed" means that a snapshot ofnewDatahas been taken and handed off. The implementation does not implementInputTableUpdater.delete(Table)norInputTableUpdater.deleteAsync(Table, InputTableStatusListener).May return
nullif invoked more than once and the initial caller does not enforce strong reachability of the result.- Returns:
- the input-table blink table
-