Class ConnectionAwareRemoteTable

All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable, LiveTable, NotificationQueue.Dependency, Deflatable<Table>, Table, LivenessManager, LivenessNode, LivenessReferent, LongSizedDataStructure, DynamicNode, DynamicTable, NotificationStepReceiver, NotificationStepSource, SystemicObject, Serializable

public class ConnectionAwareRemoteTable
extends QueryTable
implements LiveTable
Given the name of a persistent query, plus a prototype or definition of the table to be returned, connect to it and fetch a preemptive table by name. In the event that the underlying persistent query cannot be uniquely identified, fail hard. In the event that the underlying persistent query is not running, return the prototype table (no rows). If the underlying persistent query fails while this table is connected, then this will either: 1. Immediately inform clients that all rows have been removed. If the underlying persistent query then reconnects, this will inform clients that new rows have been added at that time. 2. Simply stop sending out updates, but leave the existing data in place. If the underlying persistent query then reconnects, at THAT time inform clients that all rows have been removed, then add all the rows from the restarted query. In either case, if at any time the PQ definition does not match the pre-existing definition, then explode. Specifically, the PQ must have all of the columns called for by the ConnectionAwareRemoteTable, all of which must match the type specified in the pre-existing definition. If the persistent query has additional columns not specified in the pre-existing definition, these will be ignored.
See Also:
Serialized Form
  • Field Details

    • RECONNECT_CHECK_TIMEOUT_PROPERTY

      public static final String RECONNECT_CHECK_TIMEOUT_PROPERTY
      A property that can be set to make the CART automatically check after X length of time to make sure that if the underlying query never went down, then the CART will reconnect.
      See Also:
      Constant Field Values
  • Constructor Details

    • ConnectionAwareRemoteTable

      @ScriptApi public ConnectionAwareRemoteTable​(@NotNull com.fishlib.io.logger.Logger log, @NotNull String owner, @NotNull String queryName, @NotNull String tableName, boolean clearOnDisconnect, @NotNull Table prototype)
      Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.
      Parameters:
      log - The Logger object
      owner - The username of the owner of the persistent query
      queryName - The name of the persistent query
      tableName - The name of the preemptive table within the persistent query to retrieve
      clearOnDisconnect - If true, this table should appear empty if the underlying persistent query provides data and then later disconnects. If false, this table will hang on to any data it has already received when the underlying persistent query disconnects, and will then update itself if the underlying persistent query later reconnects.
      prototype - A prototype of the table expected to be returned by the persistent query table. The definition of this prototype must exactly match that of the returned table.
    • ConnectionAwareRemoteTable

      @ScriptApi public ConnectionAwareRemoteTable​(@NotNull com.fishlib.io.logger.Logger log, @NotNull String owner, @NotNull String queryName, @NotNull String tableName, boolean clearOnDisconnect, @NotNull Table prototype, int retryAttemptsInWindow, long retryWindowMillis)
      Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.
      Parameters:
      log - The Logger object
      owner - The username of the owner of the persistent query
      queryName - The name of the persistent query
      tableName - The name of the preemptive table within the persistent query to retrieve
      clearOnDisconnect - If true, this table should appear empty if the underlying persistent query provides data and then later disconnects. If false, this table will hang on to any data it has already received when the underlying persistent query disconnects, and will then update itself if the underlying persistent query later reconnects.
      prototype - A prototype of the table expected to be returned by the persistent query table. The definition of this prototype must exactly match that of the returned table.
      retryAttemptsInWindow - Number of retry attempts before giving up and erroring. Default 0 (no limit).
      retryWindowMillis - How long the retry window is, in milliseconds, before resetting. Default 5 minutes.
    • ConnectionAwareRemoteTable

      @ScriptApi public ConnectionAwareRemoteTable​(@NotNull com.fishlib.io.logger.Logger log, @NotNull String owner, @NotNull String queryName, @NotNull String tableName, boolean clearOnDisconnect, @NotNull TableDefinition definition)
      Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.
      Parameters:
      log - The Logger object
      owner - The username of the owner of the persistent query
      queryName - The name of the persistent query
      tableName - The name of the preemptive table within the persistent query to retrieve
      clearOnDisconnect - If true, this table should appear empty if the underlying persistent query provides data and then later disconnects. If false, this table will hang on to any data it has already received when the underlying persistent query disconnects, and will then update itself if the underlying persistent query later reconnects.
      definition - A TableDefinition matching that of the table to be retrieved from the persistent query.
    • ConnectionAwareRemoteTable

      @ScriptApi public ConnectionAwareRemoteTable​(@NotNull com.fishlib.io.logger.Logger log, @NotNull String owner, @NotNull String queryName, @NotNull String tableName, boolean clearOnDisconnect, @NotNull TableDefinition definition, int retryAttemptsInWindow, long retryWindowMillis)
      Retrieve a remote table, treating non-running or disconnected queries as empty tables rather than errors.
      Parameters:
      log - The Logger object
      owner - The username of the owner of the persistent query
      queryName - The name of the persistent query
      tableName - The name of the preemptive table within the persistent query to retrieve
      clearOnDisconnect - If true, this table should appear empty if the underlying persistent query provides data and then later disconnects. If false, this table will hang on to any data it has already received when the underlying persistent query disconnects, and will then update itself if the underlying persistent query later reconnects.
      definition - A TableDefinition matching that of the table to be retrieved from the persistent query.
      retryAttemptsInWindow - Number of retry attempts before giving up and erroring. Default 0 (no limit).
      retryWindowMillis - How long the retry window is, in milliseconds, before resetting. Default 5 minutes.
  • Method Details