Class TableMapSupplier
- All Implemented Interfaces:
Deflatable<TableMap>,LivenessManager,LivenessNode,LivenessReferent,TableMap,TransformableTableMap
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.TableMap
TableMap.KeyListener, TableMap.ListenerNested classes/interfaces inherited from interface com.illumon.iris.db.v2.TransformableTableMap
TransformableTableMap.AsTableBuilder -
Field Summary
Fields inherited from interface com.illumon.iris.db.v2.TableMap
SENTINEL_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKeyListener(TableMap.KeyListener listener) Listen to changes in the map's keys.voidaddListener(TableMap.Listener listener) Add a new listener for changes to the map.<R> RApplies a function to this tableMap.asTable(boolean strictKeys, boolean allowCoalesce, boolean sanityCheckJoins) Create a Table out of this TableMap's values.voidDrop a previously-retained reference to this referent.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.WeakReference<? extends LivenessReferent>Get aWeakReferenceto this referent.getWithTransform(Object key, Function<Table, Table> transform) Gets a table with a given key, applying the specified transform before returning.merge()Merges all of the component tables into a single Table.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.voidremoveKeyListener(TableMap.KeyListener listener) Removes a key change listener.voidremoveListener(TableMap.Listener listener) Removes a map change listener.intsize()Number of tables in the map.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.booleantryManage(LivenessReferent referent) Attempt to add the specified referent to this manager.booleanIf this referent is "live", behave asLivenessReferent.retainReference()and return true.values()Gets the values.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.db.util.liveness.LivenessManager
manageMethods inherited from interface com.illumon.iris.db.util.liveness.LivenessReferent
getReferentDescription, retainReferenceMethods inherited from interface com.illumon.iris.db.v2.TableMap
asTableMap, deflate, transformTables, transformTablesMethods inherited from interface com.illumon.iris.db.v2.TransformableTableMap
asTable, asTableBuilder
-
Constructor Details
-
TableMapSupplier
-
-
Method Details
-
get
Description copied from interface:TableMapGets a table with a given key. Note that this causes the currentLivenessManager(seeLivenessScopeStack) to manage the result if non-null. -
getWithTransform
Description copied from interface:TableMapGets a table with a given key, applying the specified transform before returning.- Specified by:
getWithTransformin interfaceTableMap- Parameters:
key- key- Returns:
- table associated with the key, or null if the key is not present.
-
getKeySet
Description copied from interface:TableMapGets the keys. -
entrySet
Description copied from interface:TableMapGets the entries. -
values
Description copied from interface:TableMapGets the values. -
size
public int size()Description copied from interface:TableMapNumber of tables in the map. -
populateKeys
Description copied from interface:TableMapWhen 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.- Specified by:
populateKeysin interfaceTableMap- Parameters:
keys- the keys to add to the map- Returns:
- this TableMap
-
addListener
Description copied from interface:TableMapAdd a new listener for changes to the map.- Specified by:
addListenerin interfaceTableMap- Parameters:
listener- map change listener
-
removeListener
Description copied from interface:TableMapRemoves a map change listener.- Specified by:
removeListenerin interfaceTableMap- Parameters:
listener- map change listener.
-
addKeyListener
Description copied from interface:TableMapListen to changes in the map's keys.- Specified by:
addKeyListenerin interfaceTableMap- Parameters:
listener- key change listener
-
removeKeyListener
Description copied from interface:TableMapRemoves a key change listener.- Specified by:
removeKeyListenerin interfaceTableMap- Parameters:
listener- key change listener to remove
-
flatten
Description copied from interface:TableMapFlattens all of the result tables within the tablemap. -
preemptiveUpdatesTable
Description copied from interface:TableMapCreates preemptive tables out of all of the result tables within the tablemap.- Specified by:
preemptiveUpdatesTablein interfaceTableMap- Parameters:
intervalMillis- update interval for the preemptive tables
-
apply
Description copied from interface:TableMapApplies 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. -
transformTablesWithKey
Description copied from interface:TableMapApplies 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
TableMap.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 useTableMap.transformTablesWithKey(TableDefinition, BiFunction).- Specified by:
transformTablesWithKeyin interfaceTableMap- Parameters:
function- the bifunction to apply to each table in this TableMap- Returns:
- a new TableMap where each table has had function applied
-
transformTablesWithKey
public TableMap transformTablesWithKey(TableDefinition returnDefinition, BiFunction<Object, Table, Table> function) Description copied from interface:TableMapApplies a transformation function on all tables in the TableMap, producing a new TableMap which will update as new keys are added.- Specified by:
transformTablesWithKeyin interfaceTableMap- 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
Description copied from interface:TableMapApplies 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.- Specified by:
transformTablesWithMapin interfaceTableMap- 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
-
tryManage
Description copied from interface:LivenessManagerAttempt to add the specified referent to this manager.- Specified by:
tryManagein interfaceLivenessManager- Parameters:
referent- The referent to add- Returns:
- Whether the referent was in fact added
-
tryRetainReference
public boolean tryRetainReference()Description copied from interface:LivenessReferentIf this referent is "live", behave asLivenessReferent.retainReference()and return true. Otherwise, returns false rather than throwing an exception.- Specified by:
tryRetainReferencein interfaceLivenessReferent- Returns:
- True if this referent was retained, false otherwise
-
dropReference
public void dropReference()Description copied from interface:LivenessReferentDrop a previously-retained reference to this referent.- Specified by:
dropReferencein interfaceLivenessReferent
-
getWeakReference
Description copied from interface:LivenessReferentGet aWeakReferenceto this referent. This may be cached, or newly created.- Specified by:
getWeakReferencein interfaceLivenessReferent- Returns:
- A new or cached reference to this referent
-
merge
Description copied from interface:TransformableTableMapMerges all of the component tables into a single Table.- Specified by:
mergein interfaceTransformableTableMap- Returns:
- all of our component tables merged into a single Table.
-
asTable
Description copied from interface:TransformableTableMapCreate a Table out of this TableMap's values.Creates a proxy object that in many respects acts like a Table, you can perform many of the table operations on it, which are then applied using
TableMap.transformTables(java.util.function.Function)orTableMap.transformTablesWithMap(TableMap, BiFunction)if the right hand side of an operation is another TableMap.The returned table acts as if it were an uncoalesced table; when two of our Proxy objects are operated on together, e.g., by a
Table.join(com.illumon.iris.db.tables.Table)) operation, then tables with identical keys are used. If strictKeys is set, an error occurs if the two TableMaps do not have identical keySets.Supported operations include those which return a
Table,LongSizedDataStructure.size(),Table.getDefinition()and operations to retrieve attributes. Operations which retrieve data (such asTable.getIndex()} orTable.getColumn(int)require a coalesce operation. If allowCoalesce is not set to true, then the coalescing operations will fail with anIllegalArgumentException.- Specified by:
asTablein interfaceTransformableTableMap- Parameters:
strictKeys- if we should fail when our RHS TableMap does not have the same keySetallowCoalesce- if we should allow this TableMap to be automatically coalesced into a tablesanityCheckJoins- if we should sanity check join keys, meaning that we should refuse to perform any joins if the join keys would span two segments of the TableMap. This option is safer, but requires additional work on the query engine to perform the safety checks.- Returns:
- a Table object that performs operations by segment
-