Class StreamToBlinkTableAdapter
- All Implemented Interfaces:
LogOutputAppendable
,NotificationQueue.Dependency
,StreamConsumer
,StreamFailureConsumer
,SafeCloseable
,AutoCloseable
,Runnable
tables
that conform to
blink table
semantics.- ImplNote:
- The constructor publishes
this
to anUpdateSourceRegistrar
and thus cannot be subclassed.
-
Constructor Summary
ConstructorDescriptionStreamToBlinkTableAdapter
(@NotNull TableDefinition tableDefinition, @NotNull StreamPublisher streamPublisher, @NotNull UpdateSourceRegistrar updateSourceRegistrar, @NotNull String name) Construct the adapter withinitialize == true
and without extra attributes.StreamToBlinkTableAdapter
(@NotNull TableDefinition tableDefinition, @NotNull StreamPublisher streamPublisher, @NotNull UpdateSourceRegistrar updateSourceRegistrar, @NotNull String name, @NotNull Map<String, Object> extraAttributes) Construct the adapter withinitialize == true
.StreamToBlinkTableAdapter
(@NotNull TableDefinition tableDefinition, @NotNull StreamPublisher streamPublisher, @NotNull UpdateSourceRegistrar updateSourceRegistrar, @NotNull String name, @NotNull Map<String, Object> extraAttributes, boolean initialize) Construct the adapter. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
accept
(@NotNull WritableChunk<Values>... data) final void
accept
(@NotNull Collection<WritableChunk<Values>[]> data) void
acceptFailure
(@NotNull Throwable cause) Report an error while processing the stream.void
close()
void
Initialize this adapter by invokingStreamPublisher.register(StreamConsumer)
andUpdateSourceRegistrar.addSource(Runnable)
withthis
.boolean
isAlive()
Checks whetherthis
is alive; iffalse
, the publisher should stop publishing new data and release any related resources as soon as practicable since publishing won't have any downstream effects.void
run()
boolean
satisfied
(long step) Is this ancestor satisfied? Note that this method must be safe to call on any thread.table()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.engine.updategraph.NotificationQueue.Dependency
getUpdateGraph
-
Constructor Details
-
StreamToBlinkTableAdapter
public StreamToBlinkTableAdapter(@NotNull @NotNull TableDefinition tableDefinition, @NotNull @NotNull StreamPublisher streamPublisher, @NotNull @NotNull UpdateSourceRegistrar updateSourceRegistrar, @NotNull @NotNull String name) Construct the adapter withinitialize == true
and without extra attributes.Equivalent to
new StreamToBlinkTableAdapter(tableDefinition, streamPublisher, updateSourceRegistrar, name, Map.of(), true)
.- Parameters:
tableDefinition
- the table definitionstreamPublisher
- the stream publisherupdateSourceRegistrar
- the update source registrarname
- the name
-
StreamToBlinkTableAdapter
public StreamToBlinkTableAdapter(@NotNull @NotNull TableDefinition tableDefinition, @NotNull @NotNull StreamPublisher streamPublisher, @NotNull @NotNull UpdateSourceRegistrar updateSourceRegistrar, @NotNull @NotNull String name, @NotNull @NotNull Map<String, Object> extraAttributes) Construct the adapter withinitialize == true
.Equivalent to
new StreamToBlinkTableAdapter(tableDefinition, streamPublisher, updateSourceRegistrar, name, extraAttributes, true)
.- Parameters:
tableDefinition
- the table definitionstreamPublisher
- the stream publisherupdateSourceRegistrar
- the update source registrarname
- the nameextraAttributes
- the extra attributes to set on the resulting table
-
StreamToBlinkTableAdapter
public StreamToBlinkTableAdapter(@NotNull @NotNull TableDefinition tableDefinition, @NotNull @NotNull StreamPublisher streamPublisher, @NotNull @NotNull UpdateSourceRegistrar updateSourceRegistrar, @NotNull @NotNull String name, @NotNull @NotNull Map<String, Object> extraAttributes, boolean initialize) Construct the adapter.- Parameters:
tableDefinition
- the table definitionstreamPublisher
- the stream publisherupdateSourceRegistrar
- the update source registrarname
- the nameextraAttributes
- the extra attributes to set on the resulting tableinitialize
- if the constructor should invokeinitialize()
; iffalse
, the caller is responsible for invokinginitialize()
.
-
-
Method Details
-
initialize
public void initialize()Initialize this adapter by invokingStreamPublisher.register(StreamConsumer)
andUpdateSourceRegistrar.addSource(Runnable)
withthis
. Must be called once if and only ifthis
was constructed withinitialize == false
. -
table
Return theblink
table
that this adapter is producing, and ensure that this StreamToBlinkTableAdapter no longer enforces strong reachability of the result. May returnnull
if invoked more than once and the initial caller does not enforce strong reachability of the result.- Returns:
- The resulting blink table
-
isAlive
public boolean isAlive()Checks whetherthis
is alive; iffalse
, the publisher should stop publishing new data and release any related resources as soon as practicable since publishing won't have any downstream effects.Once this is
false
, it will always remainfalse
. For more prompt notifications, publishers may prefer to respond toStreamPublisher.shutdown()
.- Returns:
- if this is alive
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSafeCloseable
-
run
public void run() -
accept
Description copied from interface:StreamConsumer
Accept a batch of rows splayed across per-columnchunks
ofvalues
.Ownership of
data
passes to the consumer, which must be sure toclose
each chunk when it's no longer needed.Implementations will generally have a mechanism for determining the expected number and type of input chunks, but this is not dictated at the interface level.
- Specified by:
accept
in interfaceStreamConsumer
- Parameters:
data
- Per-columnchunks
ofvalues
. Must all have the samesize
.
-
accept
Accept a collection of batches of rows splayed across per-columnchunks
ofvalues
.Ownership of all the chunks contained within
data
passes to the consumer, which must be sure toclose
each chunk when it's no longer needed.Implementations will generally have a mechanism for determining the expected number and type of input chunks for each element, but this is not dictated at the interface level.
Implementations may provide more specific semantics about this method in comparison to repeated invocations of
StreamConsumer.accept(WritableChunk[])
.Ensures that the blink table sees the full collection of chunks in a single cycle.
- Specified by:
accept
in interfaceStreamConsumer
- Parameters:
data
- A collection of per-columnchunks
ofvalues
. All chunks in each element must have the samesize
, but different elements may have differing chunk sizes.
-
acceptFailure
Description copied from interface:StreamFailureConsumer
Report an error while processing the stream.- Specified by:
acceptFailure
in interfaceStreamFailureConsumer
- Parameters:
cause
- the cause of the error
-
satisfied
public boolean satisfied(long step) Description copied from interface:NotificationQueue.Dependency
Is this ancestor satisfied? Note that this method must be safe to call on any thread.- Specified by:
satisfied
in interfaceNotificationQueue.Dependency
- Parameters:
step
- The step for which we are testing satisfaction- Returns:
- Whether the dependency is satisfied on
step
(and will not fire subsequent notifications)
-
getUpdateGraph
- Specified by:
getUpdateGraph
in interfaceNotificationQueue.Dependency
- Returns:
- the update graph that this dependency is a part of
-
append
- Specified by:
append
in interfaceLogOutputAppendable
-