Package com.illumon.iris.db.v2
Interface TableMap
- All Superinterfaces:
Deflatable<TableMap>
,LivenessManager
,LivenessNode
,LivenessReferent
,TransformableTableMap
- All Known Implementing Classes:
FilteredTableMap
,LastByTableImportState.ResultTableMap
,LocalTableMap
,TableMapClient
,TableMapImpl
,TableMapSupplier
A map of tables.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Table map key change listener.static interface
Table map change listener.Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.TransformableTableMap
TransformableTableMap.AsTableBuilder
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addKeyListener
(TableMap.KeyListener listener) Listen to changes in the map's keys.void
addListener
(TableMap.Listener listener) Add a new listener for changes to the map.<R> R
Applies a function to this tableMap.default TableMap
If you're a TableMap return this, otherwise if you're a Proxy return the underlying TableMap.default Inflatable<TableMap>
deflate
(ExportedObjectClient client) Convert this object into an Inflatable suitable for serialization.static TableMap
emptyMap()
Returns an instance of the EmptyTableMap.entrySet()
Gets the entries.flatten()
Flattens all of the result tables within the tablemap.Gets a table with a given key.Object[]
Gets the keys.getWithTransform
(Object key, Function<Table, Table> transform) Gets a table with a given key, applying the specified transform before returning.static boolean
isSentinel
(Object key) Check the key passed to the function intransformTablesWithKey(BiFunction)
, to see if it's the sentinel.populateKeys
(Object... keys) When creating the table map, some of the keys that we would like to be there eventually may not exist.preemptiveUpdatesTable
(int intervalMillis) Creates preemptive tables out of all of the result tables within the tablemap.void
removeKeyListener
(TableMap.KeyListener listener) Removes a key change listener.void
removeListener
(TableMap.Listener listener) Removes a map change listener.int
size()
Number of tables in the map.default TableMap
transformTables
(TableDefinition returnDefinition, Function<Table, Table> function) Applies a transformation function on all tables in the TableMap, producing a new TableMap which will update as new keys are added.default TableMap
transformTables
(Function<Table, Table> function) Applies a transformation function on all tables in the TableMap, producing a new TableMap which will update as new keys are added.transformTablesWithKey
(TableDefinition returnDefinition, BiFunction<Object, Table, Table> function) Applies a transformation function on all tables in the TableMap, producing a new TableMap which will update as new keys are added.transformTablesWithKey
(BiFunction<Object, Table, Table> function) Applies a transformation function on all tables in the TableMap, producing a new TableMap which will update as new keys are added.transformTablesWithMap
(TableMap otherMap, BiFunction<Table, Table, Table> function) Applies a BiFunction function on all tables in this TableMap and otherMap that have matching keys, producing a new TableMap which will update as new keys are added.values()
Gets the values.Methods inherited from interface com.illumon.iris.db.util.liveness.LivenessManager
manage, tryManage
Methods inherited from interface com.illumon.iris.db.util.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReference
Methods inherited from interface com.illumon.iris.db.v2.TransformableTableMap
asTable, asTable, asTableBuilder, merge
-
Field Details
-
SENTINEL_KEY
The sentinel key. SeeisSentinel(Object)
.
-
-
Method Details
-
emptyMap
Returns an instance of the EmptyTableMap. -
isSentinel
Check the key passed to the function intransformTablesWithKey(BiFunction)
, to see if it's the sentinel.- Parameters:
key
- the object- Returns:
- true if the key is the sentinel
-
get
Gets a table with a given key. Note that this causes the currentLivenessManager
(seeLivenessScopeStack
) to manage the result if non-null.- Parameters:
key
- key- Returns:
- table associated with the key, or null if the key is not present.
-
getWithTransform
Gets a table with a given key, applying the specified transform before returning.- Parameters:
key
- key- Returns:
- table associated with the key, or null if the key is not present.
-
getKeySet
Object[] getKeySet()Gets the keys.- Returns:
- keys
-
entrySet
Collection<Map.Entry<Object,Table>> entrySet()Gets the entries.- Returns:
- the entries
-
values
Collection<Table> values()Gets the values.- Returns:
- values
-
size
int size()Number of tables in the map.- Returns:
- number of tables in the map.
-
populateKeys
When creating the table map, some of the keys that we would like to be there eventually may not exist. This call lets you pre-populate keys, so that at initialization time you can perform the appropriate joins, etc., on empty tables that you expect to be populated in the future.- Parameters:
keys
- the keys to add to the map- Returns:
- this TableMap
-
addListener
Add a new listener for changes to the map.- Parameters:
listener
- map change listener
-
removeListener
Removes a map change listener.- Parameters:
listener
- map change listener.
-
addKeyListener
Listen to changes in the map's keys.- Parameters:
listener
- key change listener
-
removeKeyListener
Removes a key change listener.- Parameters:
listener
- key change listener to remove
-
flatten
TableMap flatten()Flattens all of the result tables within the tablemap. -
preemptiveUpdatesTable
Creates preemptive tables out of all of the result tables within the tablemap.- Parameters:
intervalMillis
- update interval for the preemptive tables
-
apply
Applies a function to this tableMap. This is useful if you have a reference to a tableMap; but not the database and want to run a series of operations against the table map without each individual operation resulting in a remote method invocation.- Type Parameters:
R
- the return type of function- Parameters:
function
- the function to run, its single argument will be this table map.- Returns:
- the return value of function
-
transformTables
Applies a transformation function on all tables in the TableMap, producing a new TableMap which will update as new keys are added.- Parameters:
function
- the function to apply to each table in this TableMap- Returns:
- a new TableMap where each table has had function applied
-
transformTables
Applies a transformation function on all tables in the TableMap, producing a new TableMap which will update as new keys are added.- Parameters:
returnDefinition
- the table definition for the tables the function will returnfunction
- the function to apply to each table in this TableMap- Returns:
- a new TableMap where each table has had function applied
-
transformTablesWithKey
Applies a transformation function on all tables in the TableMap, producing a new TableMap which will update as new keys are added.The function may be passed a sentinel key, which can be checked with
isSentinel(Object)
. On the sentinel key, the function will be passed in an empty table, and is expected to return an empty table of the proper definition. To avoid this sentinel invocation, callers can be explicit and usetransformTablesWithKey(TableDefinition, BiFunction)
.- Parameters:
function
- the bifunction to apply to each table in this TableMap- Returns:
- a new TableMap where each table has had function applied
-
transformTablesWithKey
TableMap transformTablesWithKey(TableDefinition returnDefinition, BiFunction<Object, Table, Table> function) Applies a transformation function on all tables in the TableMap, producing a new TableMap which will update as new keys are added.- Parameters:
returnDefinition
- the table definition for the tables the function will returnfunction
- the bifunction to apply to each table in this TableMap- Returns:
- a new TableMap where each table has had function applied
-
transformTablesWithMap
Applies a BiFunction function on all tables in this TableMap and otherMap that have matching keys, producing a new TableMap which will update as new keys are added. Only applies the function to tables which exist in both maps.- Parameters:
otherMap
- the other TableMapfunction
- the function to apply to each table in this TableMap, the tables in this map are the first argument the tables in the other map are the second argument.- Returns:
- a new TableMap where each table has had function applied
-
asTableMap
Description copied from interface:TransformableTableMap
If you're a TableMap return this, otherwise if you're a Proxy return the underlying TableMap.- Specified by:
asTableMap
in interfaceTransformableTableMap
- Returns:
- a TableMap representation of this object
-
deflate
Description copied from interface:Deflatable
Convert this object into an Inflatable suitable for serialization.- Specified by:
deflate
in interfaceDeflatable<TableMap>
- Parameters:
client
- the ExportedObjectClient we are deflating for.- Returns:
- an Inflatable for serializing to the client
-