Class TablePublisher

java.lang.Object
io.deephaven.stream.TablePublisher

public class TablePublisher extends Object
Produces a blink table from added tables.
  • 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 the updateGraph from ExecutionContext.getContext() and chunkSize 2048.

      Parameters:
      name - the name
      definition - the table definition
      onFlushCallback - the on-flush callback
      onShutdownCallback - 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 chunkSize is the size at which chunks will be filled from the source table during an add(io.deephaven.engine.table.Table). The suggested value is 2048.

      Parameters:
      name - the name
      definition - the table definition
      onFlushCallback - the on-flush callback
      onShutdownCallback - the on-shutdown callback
      updateGraph - the update graph for the blink table
      chunkSize - the chunk size is the maximum size
      Returns:
      the table publisher
    • definition

      public TableDefinition definition()
      The blink table's definition.
      Returns:
      the definition
    • table

      public Table table()
      The blink table.

      May return null if invoked more than once and the initial caller does not enforce strong reachability of the result.

      Returns:
      the blink table
    • add

      public void add(Table table)
      Adds a snapshot of the data from table into the blink table. The added table must contain a superset of the columns from the definition; the columns may be in any order. Columns from table that are not in the definition are ignored.

      All of the data from table will be:

      1. consistent with a point in time
      2. fully contained in a single blink table's update cycle
      3. non-interleaved with any other calls to add (concurrent, or not)
      Parameters:
      table - the table to add
    • publishFailure

      public void publishFailure(Throwable failure)
      Indicate that data publication has failed. Blink table listeners will be notified of the failure, the on-shutdown callback will be invoked if it hasn't already been, this publisher will no longer be alive, and future calls to add will silently return without publishing. These effects may resolve asynchronously.
      Parameters:
      failure - the failure
    • isAlive

      public boolean isAlive()
      Checks whether this is alive; if false, 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 remain false. For more prompt notifications, callers may prefer to use on-shutdown callbacks.

      Returns:
      if this is alive
    • inputTable

      public Table inputTable()
      Creates a new blink table with its attribute "InputTable" set to an InputTableUpdater implementation based on this. The implementation's definition of "completed" with respect to InputTableUpdater.add(Table) and InputTableUpdater.addAsync(Table, InputTableStatusListener) matches the semantics provided by add(Table) - that is, "completed" means that a snapshot of newData has been taken and handed off. The implementation does not implement InputTableUpdater.delete(Table) nor InputTableUpdater.deleteAsync(Table, InputTableStatusListener).

      May return null if invoked more than once and the initial caller does not enforce strong reachability of the result.

      Returns:
      the input-table blink table