Package com.illumon.iris.db.v2.locations
Class AbstractTableLocation<TKT extends TableKey,CLT extends ColumnLocation>
java.lang.Object
com.illumon.iris.db.v2.locations.SubscriptionAggregator<TableLocation.Listener>
com.illumon.iris.db.v2.locations.AbstractTableLocation<TKT,CLT>
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable
,TableLocation
,TableLocationKey
,TableLocationState
,NamedImplementation
- Direct Known Subclasses:
LocalTableLocation
,ReadOnlyParquetTableLocation
,RemoteTableLocationImpl
public abstract class AbstractTableLocation<TKT extends TableKey,CLT extends ColumnLocation>
extends SubscriptionAggregator<TableLocation.Listener>
implements TableLocation
Partial TableLocation implementation for use by TableDataService implementations.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.locations.TableLocation
TableLocation.Format, TableLocation.Listener
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
TableLocationKey.ComparatorImpl, TableLocationKey.KeyedObjectKeyImpl<VALUE_TYPE>, TableLocationKey.SelfKeyedObjectKeyImpl<VALUE_TYPE extends TableLocationKey>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<List<String>,
SoftReference<Table>> A map of grouping (or data index) columns to the materializedprotected static final SoftReference<Table>
Fields inherited from class com.illumon.iris.db.v2.locations.SubscriptionAggregator
subscriptions
Fields inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
COMPARATOR, NULL_PARTITION
Fields inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
NULL_SIZE, NULL_TIME, REMOVE_SIZE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractTableLocation
(TKT tableKey, TableLocationKey tableLocationKey, boolean supportsSubscriptions) -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
Clear all column locations (usually because a truncated location was observed).protected final void
deliverInitialSnapshot
(TableLocation.Listener listener) Prompt listeners to record current state, under the subscriptions lock.final CLT
final String
final Table
getDataIndex
(String... columns) Get the data index table for the specified set of columns.protected abstract Table
getDataIndexImpl
(String... columns) Load the data index from the location implementaiton.final String
final long
final long
getSize()
final Object
long
getVisit()
return the last value set inTableLocation.visit(long)
final void
handleUpdate
(long size, long lastModifiedTimeMillis) See TableLocationState for documentation of values.void
handleUpdate
(TableLocationState source) Update all state fields from source's values, as inhandleUpdate(long, long)
.protected abstract CLT
makeColumnLocation
(String name) final String
toString()
visit
(long stamp) Mark this table location as visited, with the given (time)stamp.Methods inherited from class com.illumon.iris.db.v2.locations.SubscriptionAggregator
activateUnderlyingDataSource, activationFailed, activationSuccessful, checkHasSubscribers, deactivateUnderlyingDataSource, matchSubscriptionToken, postActivationHook, subscribe, supportsSubscriptions, unsubscribe
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.illumon.util.type.NamedImplementation
getImplementationName
Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocation
append, as, getColumnLocation, getFormat, getSortedColumns, hasDataIndexFor, refresh, subscribe, supportsSubscriptions, toGenericString, toStringDetailed, toStringHelper, unsubscribe
Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
writeTo
Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
copyStateValuesTo, getSizeStr, writeStateValuesTo
-
Field Details
-
NO_GROUPING_SENTINEL
-
cachedGroupings
A map of grouping (or data index) columns to the materialized
-
-
Constructor Details
-
AbstractTableLocation
protected AbstractTableLocation(@NotNull TKT tableKey, @NotNull TableLocationKey tableLocationKey, boolean supportsSubscriptions) - Parameters:
tableKey
- Table key for the table this location belongs totableLocationKey
- A key whose field values will be deep-copied to this locationsupportsSubscriptions
- Whether subscriptions are to be supported
-
-
Method Details
-
visit
Description copied from interface:TableLocation
Mark this table location as visited, with the given (time)stamp.- Specified by:
visit
in interfaceTableLocation
- Parameters:
stamp
- a monotonically increasing value indicating when this location was visited.- Returns:
- returns itself for chaining
-
getVisit
public long getVisit()Description copied from interface:TableLocation
return the last value set inTableLocation.visit(long)
- Specified by:
getVisit
in interfaceTableLocation
- Returns:
- the last value set in visit()
-
toString
-
getInternalPartition
- Specified by:
getInternalPartition
in interfaceTableLocationKey
- Returns:
- The internal partition that encloses the identified table location, or null if none exists
-
getColumnPartition
- Specified by:
getColumnPartition
in interfaceTableLocationKey
- Returns:
- The column partition that encloses the identified table location, or null if none exists
-
getStateLock
- Specified by:
getStateLock
in interfaceTableLocationState
- Returns:
- The Object that accessors should synchronize on if they want to invoke multiple getters with consistent results.
-
getSize
public final long getSize()- Specified by:
getSize
in interfaceTableLocationState
- Returns:
- The size of a table location:
NULL_SIZE : Size information is unknown or does not exist for this table location
>= 0 : The table location exists and has (possibly empty) data
-
getLastModifiedTimeMillis
public final long getLastModifiedTimeMillis()- Specified by:
getLastModifiedTimeMillis
in interfaceTableLocationState
- Returns:
- The last modified time for a table location, in milliseconds from the epoch:
NULL_TIME : Modification time information is unknown or does not exist for this table location
>= 0L : The time this table was last modified, in milliseconds from the UTC epoch
-
getTableKey
- Specified by:
getTableKey
in interfaceTableLocation
- Returns:
- A TableKey instance for the enclosing table
-
deliverInitialSnapshot
Description copied from class:SubscriptionAggregator
Prompt listeners to record current state, under the subscriptions lock.- Specified by:
deliverInitialSnapshot
in classSubscriptionAggregator<TableLocation.Listener>
- Parameters:
listener
- The listener to notify
-
handleUpdate
public final void handleUpdate(long size, long lastModifiedTimeMillis) See TableLocationState for documentation of values.- Parameters:
size
- The new sizelastModifiedTimeMillis
- The new lastModificationTimeMillis
-
handleUpdate
Update all state fields from source's values, as inhandleUpdate(long, long)
. SeeTableLocationState
for documentation of values.- Parameters:
source
- The source to copy state values from
-
getColumnLocation
- Specified by:
getColumnLocation
in interfaceTableLocation
- Parameters:
name
- The column name- Returns:
- The ColumnLocation for the defined column under this table location
-
makeColumnLocation
-
clearColumnLocations
protected final void clearColumnLocations()Clear all column locations (usually because a truncated location was observed). -
getDataIndex
Description copied from interface:TableLocation
Get the data index table for the specified set of columns. Note that the order of columns does not matter here.- Specified by:
getDataIndex
in interfaceTableLocation
- Parameters:
columns
- the key columns for the index- Returns:
- the index table or null if one does not exist.
-
getDataIndexImpl
Load the data index from the location implementaiton. Implementations of this method should not perform any result caching.- Parameters:
columns
- the columns to load an index for.- Returns:
- the data index table, or an empty table or null if none existed.
-