Class BaseLastByTableImportState<KEY_TYPE>
- All Implemented Interfaces:
ImportState
,LiveTable
,Externalizable
,Serializable
,Runnable
- Direct Known Subclasses:
LastByTableImportState
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 interface
The Legacy engine must create an initial Index, but the Core+ engine must create an initial RowSet. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for an empty import state with null name.Constructor for an empty import state. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
ensureInitialized
(FullTableLocationKey locationKey) Called when non-import code needs to ensure that an ImportState's internals have been initialized because of their side effects.getName()
protected abstract BaseLastByTableImportState.RowSetFactoryAdapter
Get the builder suitable for creating an initial RowSet (or Index) for this engine.protected abstract boolean
Verify that this state remains valid for refreshing.protected abstract void
maybeUpdate
(long[] addedKeys, long[] removedKeys) Update the table if we remain the owner of the ImportStatefinal void
newRowForKey
(KEY_TYPE key) Observe a new row for the specified key, which may be compound.void
onClose()
Called when the data ingestion process for the location observed by this ImportState is finished, temporarily or permanently, in a consistent state.void
onFlush()
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).void
Call when the data ingestion process for the location observed by this ImportState is finished, temporarily or permanently, in an inconsistent state.abstract void
onResume
(FullTableLocationKey locationKey) Called when data ingestion is resumed for the location observed by this ImportState.void
onTruncate
(FullTableLocationKey locationKey) Called when the underlying table location has been truncated.void
void
refresh()
Refresh this LiveTable.final void
skipRow()
Observe the passing of a row that will not be a part of the last-by view.protected abstract void
protected abstract void
void
Methods inherited from class com.illumon.iris.db.tables.dataimport.importstate.TupleKeyedAbstractImportState
newRow, newRow, newRow, newRow, prepareElement, prepareKey
-
Constructor Details
-
BaseLastByTableImportState
public BaseLastByTableImportState()Constructor for an empty import state with null name. -
BaseLastByTableImportState
Constructor for an empty import state.- Parameters:
name
- The name for this last-by view.
-
-
Method Details
-
getName
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
getRowSetFactoryAdapter
Get the builder suitable for creating an initial RowSet (or Index) for this engine.- Returns:
- the RowSetAdapter for this concrete state.
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
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 aCanonicalizableTuple
directly 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 useSmartKey
orPair
directly as keys or indirectly as elements.- Specified by:
newRowForKey
in 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:
getImportDetails
in interfaceImportState
-
ensureInitialized
Description copied from interface:ImportState
Called 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 theLiveTableMonitor
lock.- Specified by:
ensureInitialized
in interfaceImportState
- Parameters:
locationKey
- The full table location key of the location whose ImportState is being initialized
-
onResume
Description copied from interface:ImportState
Called when data ingestion is resumed for the location observed by this ImportState.- Specified by:
onResume
in interfaceImportState
- Parameters:
locationKey
- The full table location key of the location that has been resumed
-
onTruncate
Description copied from interface:ImportState
Called when the underlying table location has been truncated. Useful for resetting any in-memory state that may otherwise linger inappropriately.- Specified by:
onTruncate
in interfaceImportState
- Parameters:
locationKey
- The full table location key of the location that has been truncated
-
onFlush
public void onFlush()Description copied from interface:ImportState
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).- Specified by:
onFlush
in interfaceImportState
-
onRelease
public void onRelease()Description copied from interface:ImportState
Call when the data ingestion process for the location observed by this ImportState is finished, temporarily or permanently, in an inconsistent state.- Specified by:
onRelease
in interfaceImportState
-
onClose
public void onClose()Description copied from interface:ImportState
Called when the data ingestion process for the location observed by this ImportState is finished, temporarily or permanently, in a consistent state.- Specified by:
onClose
in interfaceImportState
-
startRefreshing
protected abstract void startRefreshing() -
stopRefreshing
protected abstract void stopRefreshing() -
isValidToRefresh
protected abstract boolean isValidToRefresh()Verify that this state remains valid for refreshing.- Returns:
- true if this state is valid for refreshing.
-
maybeUpdate
protected abstract void maybeUpdate(long[] addedKeys, long[] removedKeys) Update the table if we remain the owner of the ImportState- Parameters:
addedKeys
- row keys (positions in this partition) added to the tableremovedKeys
- row keys (positions in this partition) removed from the table
-
refresh
public void refresh()Description copied from interface:LiveTable
Refresh this LiveTable.
-