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<CLT>
,TableLocationKey
,TableLocationState
,NamedImplementation
- Direct Known Subclasses:
LocalTableLocation
,ReadOnlyParquetTableLocation
public abstract class AbstractTableLocation<TKT extends TableKey,CLT extends ColumnLocation> extends SubscriptionAggregator<TableLocation.Listener> implements TableLocation<CLT>
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
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
Constructors Modifier Constructor Description protected
AbstractTableLocation(TKT tableKey, TableLocationKey tableLocationKey, boolean supportsSubscriptions)
-
Method Summary
Modifier and Type Method Description protected void
clearColumnLocations()
Clear all column locations (usually because a truncated location was observed).protected void
deliverInitialSnapshot(TableLocation.Listener listener)
Prompt listeners to record current state, under the subscriptions lock.CLT
getColumnLocation(CharSequence name)
String
getColumnPartition()
String
getInternalPartition()
long
getLastModifiedTimeMillis()
long
getSize()
Object
getStateLock()
TKT
getTableKey()
long
getVisit()
return the last value set inTableLocation.visit(long)
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)
String
toString()
AbstractTableLocation<TKT,CLT>
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.iris.db.v2.locations.TableLocation
append, getColumnVersion, getDataIndex, getFormat, getSortedColumns, hasDataIndexFor, refresh, subscribe, supportsSubscriptions, toGenericString, toStringDetailed, toStringHelper, unsubscribe
Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
copyStateValuesTo, getSizeStr, writeStateValuesTo
-
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<TKT extends TableKey>
- 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<TKT extends TableKey>
- 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<TKT extends TableKey>
- 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<TKT extends TableKey>
- 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).
-