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.ListenerNested 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
subscriptionsFields inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
COMPARATOR, NULL_PARTITIONFields inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
NULL_SIZE, NULL_TIME, REMOVE_SIZE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractTableLocation(TKT tableKey, TableLocationKey tableLocationKey, boolean supportsSubscriptions) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidClear all column locations (usually because a truncated location was observed).protected final voiddeliverInitialSnapshot(TableLocation.Listener listener) Prompt listeners to record current state, under the subscriptions lock.final CLTfinal Stringfinal TablegetDataIndex(String... columns) Get the data index table for the specified set of columns.protected abstract TablegetDataIndexImpl(String... columns) Load the data index from the location implementaiton.final Stringfinal longfinal longgetSize()final ObjectlonggetVisit()return the last value set inTableLocation.visit(long)final voidhandleUpdate(long size, long lastModifiedTimeMillis) See TableLocationState for documentation of values.voidhandleUpdate(TableLocationState source) Update all state fields from source's values, as inhandleUpdate(long, long).protected abstract CLTmakeColumnLocation(String name) final StringtoString()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, unsubscribeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.util.type.NamedImplementation
getImplementationNameMethods inherited from interface com.illumon.iris.db.v2.locations.TableLocation
append, as, getColumnLocation, getFormat, getSortedColumns, hasDataIndexFor, refresh, subscribe, supportsSubscriptions, toGenericString, toStringDetailed, toStringHelper, unsubscribeMethods inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
writeToMethods 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:TableLocationMark this table location as visited, with the given (time)stamp.- Specified by:
visitin 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:TableLocationreturn the last value set inTableLocation.visit(long)- Specified by:
getVisitin interfaceTableLocation- Returns:
- the last value set in visit()
-
toString
-
getInternalPartition
- Specified by:
getInternalPartitionin interfaceTableLocationKey- Returns:
- The internal partition that encloses the identified table location, or null if none exists
-
getColumnPartition
- Specified by:
getColumnPartitionin interfaceTableLocationKey- Returns:
- The column partition that encloses the identified table location, or null if none exists
-
getStateLock
- Specified by:
getStateLockin 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:
getSizein 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:
getLastModifiedTimeMillisin 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:
getTableKeyin interfaceTableLocation- Returns:
- A TableKey instance for the enclosing table
-
deliverInitialSnapshot
Description copied from class:SubscriptionAggregatorPrompt listeners to record current state, under the subscriptions lock.- Specified by:
deliverInitialSnapshotin classSubscriptionAggregator<TableLocation.Listener>- Parameters:
listener- The listener to notify
-
handleUpdate
public final void handleUpdate(long size, long lastModifiedTimeMillis) See TableLocationState for documentation of values.- Specified by:
handleUpdatein interfaceTableLocation- Parameters:
size- The new sizelastModifiedTimeMillis- The new lastModificationTimeMillis
-
handleUpdate
Update all state fields from source's values, as inhandleUpdate(long, long). SeeTableLocationStatefor documentation of values.- Parameters:
source- The source to copy state values from
-
getColumnLocation
- Specified by:
getColumnLocationin interfaceTableLocation- Parameters:
name- The column name- Returns:
- The ColumnLocation for the defined column under this table location
-
makeColumnLocation
-
clearColumnLocations
public final void clearColumnLocations()Clear all column locations (usually because a truncated location was observed).- Specified by:
clearColumnLocationsin interfaceTableLocation
-
getDataIndex
Description copied from interface:TableLocationGet the data index table for the specified set of columns. Note that the order of columns does not matter here.- Specified by:
getDataIndexin 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.
-