Interface InputTableUpdater


public interface InputTableUpdater
A minimal interface for mutable shared tables, providing the ability to write to the table instance this is attached to. InputTable instances are set on the table as an attribute.

Implementations of this interface will make their own guarantees about how atomically changes will be applied and what operations they support.

  • Method Details

    • getKeyNames

      List<String> getKeyNames()
      Gets the names of the key columns.
      Returns:
      a list with the names of the key columns of this input table
    • getValueNames

      default List<String> getValueNames()
      Gets the names of the value columns. By default, any column not marked as a key column is a value column.
      Returns:
      a list with the names of the value columns of this input table
    • getTableDefinition

      TableDefinition getTableDefinition()
      Get the underlying Table definition (which includes the names and types of all of the columns).
      Returns:
      the TableDefinition for our user-visible table
    • validateAddOrModify

      default void validateAddOrModify(Table tableToApply)
      Helper to check if a table is compatible with this table, so that it could be added as contents.
      Parameters:
      tableToApply - the table to check if it can used to add or modify this input table
      Throws:
      TableDefinition.IncompatibleTableDefinitionException - if the definitions are not compatible
    • validateDelete

      default void validateDelete(Table tableToDelete)
      Validates that the given table definition is suitable to be passed to delete(Table).
      Parameters:
      tableToDelete - The definition of the table to delete
      Throws:
      UnsupportedOperationException - If this table does not support deletes
      ArgumentException - If the given definition isn't compatible to be used to delete
    • add

      void add(Table newData) throws IOException
      Write newData to this table. Added rows with keys that match existing rows will instead replace those rows, if supported.

      This method will block until the add is "completed", where the definition of "completed" is implementation dependenent.

      For implementations where "completed" means "visible in the next update graph cycle", this method is not suitable for use from a table listener or any other notification-dispatched callback dispatched by this InputTable's update graph. It may be suitable to delete from another update graph if doing so does not introduce any cycles.

      Parameters:
      newData - The data to write to this table
      Throws:
      IOException - If there is an error writing the data
    • addAsync

      void addAsync(Table newData, InputTableStatusListener listener)
      Write newData to this table. Added rows with keys that match existing rows replace those rows, if supported.

      The callback to listener will happen when the add has "completed", where the definition of "completed" is implementation dependenent. It's possible that the callback happens immediately on the same thread.

      This method will not block, and can be safely used from a table listener or any other notification-dispatched callback as long as table is already satisfied on the current cycle.

      Parameters:
      newData - The data to write to this table
      listener - The listener for asynchronous results
    • delete

      default void delete(Table table) throws IOException
      Delete the keys contained in table from this input table.

      This method will block until the delete is "completed", where the definition of "completed" is implementation dependenent.

      For implementations where "completed" means "visible in the next update graph cycle", this method is not suitable for use from a table listener or any other notification-dispatched callback dispatched by this InputTable's update graph. It may be suitable to delete from another update graph if doing so does not introduce any cycles.

      Parameters:
      table - The rows to delete
      Throws:
      IOException - If a problem occurred while deleting the rows.
      UnsupportedOperationException - If this table does not support deletes
    • deleteAsync

      default void deleteAsync(Table table, InputTableStatusListener listener)
      Delete the keys contained in table from this input table.

      The callback to listener will happen when the delete has "completed", where the definition of "completed" is implementation dependenent. It's possible that the callback happens immediately on the same thread.

      This method will not block, and can be safely used from a table listener or any other notification-dispatched callback as long as table is already satisfied on the current cycle.

      Parameters:
      table - Table containing the rows to delete
      Throws:
      UnsupportedOperationException - If this table does not support deletes
    • isKey

      default boolean isKey(String columnName)
      Returns true if the specified column is a key.
      Parameters:
      columnName - the column to interrogate
      Returns:
      true if columnName is a key column, false otherwise
    • hasColumn

      default boolean hasColumn(String columnName)
      Returns true if the specified column exists in this InputTable.
      Parameters:
      columnName - the column to interrogate
      Returns:
      true if columnName exists in this InputTable