Interface InputTableUpdater
Implementations of this interface will make their own guarantees about how atomically changes will be applied and what operations they support.
-
Method Summary
Modifier and TypeMethodDescriptionvoidWritenewDatato this table.voidaddAsync(Table newData, InputTableStatusListener listener) WritenewDatato this table.default voidDelete the keys contained intablefrom this input table.default voiddeleteAsync(Table table, InputTableStatusListener listener) Delete the keys contained in table from this input table.static InputTableUpdaterGet the input table updater from the giventableornullif it is not set.Gets the names of the key columns.Get the underlying Table definition (which includes the names and types of all of the columns).Gets the names of the value columns.default booleanReturns true if the specified column exists in this InputTable.default booleanReturns true if the specified column is a key.default voidvalidateAddOrModify(Table tableToApply) Helper to check if a table is compatible with this table, so that it could be added as contents.default voidvalidateDelete(Table tableToDelete) Validates that the given table definition is suitable to be passed todelete(Table).
-
Method Details
-
from
Get the input table updater from the giventableornullif it is not set.Equivalent to
(InputTableUpdater) table.getAttribute(Table.INPUT_TABLE_ATTRIBUTE).- Parameters:
table- the table- Returns:
- the input table updater
- See Also:
-
getKeyNames
Gets the names of the key columns.- Returns:
- a list with the names of the key columns of this input table
-
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
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
Validates that the given table definition is suitable to be passed todelete(Table).- Parameters:
tableToDelete- The definition of the table to delete- Throws:
UnsupportedOperationException- If this table does not support deletesArgumentException- If the given definition isn't compatible to be used to delete
-
add
WritenewDatato 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 listeneror any othernotification-dispatched callback dispatched by this InputTable'supdate 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
WritenewDatato this table. Added rows with keys that match existing rows replace those rows, if supported.The callback to
listenerwill 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 listeneror any othernotification-dispatched callback as long astableis alreadysatisfiedon the current cycle.- Parameters:
newData- The data to write to this tablelistener- The listener for asynchronous results
-
delete
Delete the keys contained intablefrom 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 listeneror any othernotification-dispatched callback dispatched by this InputTable'supdate 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
Delete the keys contained in table from this input table.The callback to
listenerwill 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 listeneror any othernotification-dispatched callback as long astableis alreadysatisfiedon the current cycle.- Parameters:
table- Table containing the rows to delete- Throws:
UnsupportedOperationException- If this table does not support deletes
-
isKey
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
Returns true if the specified column exists in this InputTable.- Parameters:
columnName- the column to interrogate- Returns:
- true if columnName exists in this InputTable
-