Class FunctionGeneratedTableSpec

java.lang.Object
io.deephaven.engine.table.impl.util.FunctionGeneratedTableSpec

@Immutable public abstract class FunctionGeneratedTableSpec extends Object
Describes how a FunctionGeneratedTableFactory should build and refresh a function-generated table.

Exactly one of tableSupplier() or retainingLastTableSupplier() must be provided. The former always produces a new table on each invocation; the latter may return an empty Optional, in which case the previously produced result is retained for the next cycle rather than being regenerated.

At most one of refreshInterval() or dependencies() may be provided. A refreshInterval() drives periodic (wall-clock) refreshes; dependencies() drives refreshes when at least one of the listed tables ticks. If neither is provided, the supplier is invoked exactly once at construction and the result is static.

  • Constructor Details

    • FunctionGeneratedTableSpec

      public FunctionGeneratedTableSpec()
  • Method Details

    • builder

      public static FunctionGeneratedTableSpec.Builder builder()
    • tableSupplier

      public abstract Optional<Supplier<Table>> tableSupplier()
      A supplier that always produces a new table to be reflected in the result. Mutually exclusive with retainingLastTableSupplier().
      Returns:
      the table supplier
    • retainingLastTableSupplier

      public abstract Optional<Supplier<Optional<Table>>> retainingLastTableSupplier()
      A supplier that may not produce a new table; when it returns an empty Optional, the previous result is retained for the next cycle. Mutually exclusive with tableSupplier().
      Returns:
      the retaining-last table supplier
    • refreshInterval

      public abstract Optional<Duration> refreshInterval()
      The wall-clock interval at which to invoke the supplier. Mutually exclusive with dependencies().
      Returns:
      the refresh interval
    • dependencies

      public abstract List<Table> dependencies()
      The tables that, when any of them ticks, cause the supplier to be invoked in a dependency-respecting way. Mutually exclusive with refreshInterval().
      Returns:
      the dependency tables
    • copyData

      @Default public boolean copyData()
      When true (the default), the generated data is copied into the result table using a flat, contiguous RowSet, exactly as the legacy FunctionGeneratedTableFactory does. When false, the result delegates directly to the generated table's column sources via SwitchColumnSource, avoiding the copy and adopting the generated table's own RowSet shape. In either case, each refresh that produces a table is a full replacement (all previous rows removed, all new rows added). Because the generated column sources are retained across cycles when not copying, a refreshing generated table must expose immutable column sources.
      Returns:
      whether to copy the generated data into the result
    • blinkTable

      @Default public boolean blinkTable()
      When true, the result is presented as a blink table: each refresh removes the previous rows and adds the newly generated rows, and downstream operations treat the result as retaining only the current cycle's rows. Rows generated in one update cycle are removed on the next cycle whether or not the generator runs again. Defaults to false. Requires a refresh trigger (a refreshInterval() or dependencies()).
      Returns:
      whether to present the result as a blink table
    • tableDefinition

      public abstract Optional<TableDefinition> tableDefinition()
      The table definition to use for the result. When provided, it is authoritative: it defines the result's columns, and every table the supplier produces (including the initial one) must be mutually compatible with it, or construction (or a subsequent refresh) fails. When not provided, the supplier's table defines the result's columns, so a definition is required only when a retainingLastTableSupplier() produces no table at construction time; if no definition is provided and the initial supplier invocation yields no table, construction fails.
      Returns:
      the optional table definition