Class LastByTableImportState<KEY_TYPE>
- All Implemented Interfaces:
ImportState,LiveTable,Externalizable,Serializable,Runnable
ImportState that publishes a last-by view of the data being imported, producing a table intended for concurrent usage by clients with access to the importing process.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classLocalTableMap with an associated LiveTableRefreshCombiner. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for an empty import state with null name.LastByTableImportState(String name) Constructor for an empty import state. -
Method Summary
Modifier and TypeMethodDescriptionvoidensureInitialized(FullTableLocationKey locationKey) Called when non-import code needs to ensure that an ImportState's internals have been initialized because of their side effects.getTableMap(TableKey tableKey) Get aLocalTableMapkeyed byTableLocationKeyofDynamicTables that contain only anIndexand no user-facingColumnSources.getTableMap(TableKey tableKey, String name) Get aLocalTableMapkeyed byTableLocationKeyofDynamicTables that contain only anIndexand no user-facingColumnSources.final voidnewRowForKey(KEY_TYPE key) Observe a new row for the specified key, which may be compound.voidonClose()Called when the data ingestion process for the location observed by this ImportState is finished, temporarily or permanently, in a consistent state.voidonFlush()Called when the data ingestion process for the location observed by this ImportState is flushed (properly, after it has been flushed and when the resulting size has been made visible if applicable).voidCall when the data ingestion process for the location observed by this ImportState is finished, temporarily or permanently, in an inconsistent state.voidonResume(FullTableLocationKey locationKey) Called when data ingestion is resumed for the location observed by this ImportState.voidonTruncate(FullTableLocationKey locationKey) Called when the underlying table location has been truncated.voidvoidrefresh()Refresh this LiveTable.final voidskipRow()Observe the passing of a row that will not be a part of the last-by view.voidMethods inherited from class com.illumon.iris.db.tables.dataimport.importstate.TupleKeyedAbstractImportState
newRow, newRow, newRow, newRow, prepareElement, prepareKey
-
Constructor Details
-
LastByTableImportState
public LastByTableImportState()Constructor for an empty import state with null name. -
LastByTableImportState
Constructor for an empty import state.- Parameters:
name- The name for this last-by view (seegetTableMap(TableKey, String)).
-
-
Method Details
-
getTableMap
Get aLocalTableMapkeyed byTableLocationKeyofDynamicTables that contain only anIndexand no user-facingColumnSources. The contents of the result are produced by LastByImportState instances for the suppliedTableKeyand null name- Parameters:
tableKey- The key- Returns:
- The table map, possibly empty
-
getTableMap
public static LastByTableImportState.ResultTableMap getTableMap(@NotNull TableKey tableKey, String name) Get aLocalTableMapkeyed byTableLocationKeyofDynamicTables that contain only anIndexand no user-facingColumnSources. The contents of the result are produced by LastByTableImportState instances for the suppliedTableKeyand name. Distinct names should be used for distinct last-by import state views of the same table. TODO: Consider whether we should implement a LocalTableMap equivalent that stores weakly-reachable values.- Parameters:
tableKey- The keyname- The name- Returns:
- The table map, possibly empty
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
newRowForKey
Observe a new row for the specified key, which may be compound.
It is required that users of this method render their key immutable.
The recommended way to do so is to invoke
TupleKeyedAbstractImportState.prepareElement(Object)on single element keys, or construct aCanonicalizableTupledirectly from primitive elements and the result ofTupleKeyedAbstractImportState.prepareElement(Object)on all Object elements of a compound key. Alternatively,TupleKeyedAbstractImportState.prepareKey(Object)tries to do the correct thing, but may not be as performant. Users must not useSmartKeyorPairdirectly as keys or indirectly as elements.- Specified by:
newRowForKeyin classTupleKeyedAbstractImportState<KEY_TYPE>- Parameters:
key- The key
-
skipRow
public final void skipRow()Observe the passing of a row that will not be a part of the last-by view. -
getImportDetails
- Specified by:
getImportDetailsin interfaceImportState
-
ensureInitialized
Description copied from interface:ImportStateCalled when non-import code needs to ensure that an ImportState's internals have been initialized because of their side effects. Must not interfere with concurrent data ingestion in the same process. Generally should be treated as a query operation, and the caller should hold theLiveTableMonitorlock.- Specified by:
ensureInitializedin interfaceImportState- Parameters:
locationKey- The full table location key of the location whose ImportState is being initialized
-
onResume
Description copied from interface:ImportStateCalled when data ingestion is resumed for the location observed by this ImportState.- Specified by:
onResumein interfaceImportState- Parameters:
locationKey- The full table location key of the location that has been resumed
-
onTruncate
Description copied from interface:ImportStateCalled when the underlying table location has been truncated. Useful for resetting any in-memory state that may otherwise linger inappropriately.- Specified by:
onTruncatein interfaceImportState- Parameters:
locationKey- The full table location key of the location that has been truncated
-
onFlush
public void onFlush()Description copied from interface:ImportStateCalled when the data ingestion process for the location observed by this ImportState is flushed (properly, after it has been flushed and when the resulting size has been made visible if applicable).- Specified by:
onFlushin interfaceImportState
-
onRelease
public void onRelease()Description copied from interface:ImportStateCall when the data ingestion process for the location observed by this ImportState is finished, temporarily or permanently, in an inconsistent state.- Specified by:
onReleasein interfaceImportState
-
onClose
public void onClose()Description copied from interface:ImportStateCalled when the data ingestion process for the location observed by this ImportState is finished, temporarily or permanently, in a consistent state.- Specified by:
onClosein interfaceImportState
-
refresh
public void refresh()Description copied from interface:LiveTableRefresh this LiveTable.
-