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.
  • Field Details

  • Constructor Details

    • AbstractTableLocation

      protected AbstractTableLocation(@NotNull TKT tableKey, @NotNull TableLocationKey tableLocationKey, boolean supportsSubscriptions)
      Parameters:
      tableKey - Table key for the table this location belongs to
      tableLocationKey - A key whose field values will be deep-copied to this location
      supportsSubscriptions - Whether subscriptions are to be supported
  • Method Details

    • visit

      public AbstractTableLocation<TKT,CLT> visit(long stamp)
      Description copied from interface: TableLocation
      Mark this table location as visited, with the given (time)stamp.
      Specified by:
      visit in interface TableLocation
      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 in TableLocation.visit(long)
      Specified by:
      getVisit in interface TableLocation
      Returns:
      the last value set in visit()
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • getInternalPartition

      @NotNull public final String getInternalPartition()
      Specified by:
      getInternalPartition in interface TableLocationKey
      Returns:
      The internal partition that encloses the identified table location, or null if none exists
    • getColumnPartition

      @NotNull public final String getColumnPartition()
      Specified by:
      getColumnPartition in interface TableLocationKey
      Returns:
      The column partition that encloses the identified table location, or null if none exists
    • getStateLock

      @NotNull public final Object getStateLock()
      Specified by:
      getStateLock in interface TableLocationState
      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 interface TableLocationState
      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 interface TableLocationState
      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

      @NotNull public TKT getTableKey()
      Specified by:
      getTableKey in interface TableLocation
      Returns:
      A TableKey instance for the enclosing table
    • deliverInitialSnapshot

      protected final void deliverInitialSnapshot(@NotNull TableLocation.Listener listener)
      Description copied from class: SubscriptionAggregator
      Prompt listeners to record current state, under the subscriptions lock.
      Specified by:
      deliverInitialSnapshot in class SubscriptionAggregator<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 size
      lastModifiedTimeMillis - The new lastModificationTimeMillis
    • handleUpdate

      public void handleUpdate(@NotNull TableLocationState source)
      Update all state fields from source's values, as in handleUpdate(long, long). See TableLocationState for documentation of values.
      Parameters:
      source - The source to copy state values from
    • getColumnLocation

      @NotNull public final CLT getColumnLocation(@NotNull CharSequence name)
      Specified by:
      getColumnLocation in interface TableLocation
      Parameters:
      name - The column name
      Returns:
      The ColumnLocation for the defined column under this table location
    • makeColumnLocation

      @NotNull protected abstract CLT makeColumnLocation(@NotNull String name)
    • clearColumnLocations

      protected final void clearColumnLocations()
      Clear all column locations (usually because a truncated location was observed).
    • getDataIndex

      @Nullable public final Table getDataIndex(@NotNull String... columns)
      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 interface TableLocation
      Parameters:
      columns - the key columns for the index
      Returns:
      the index table or null if one does not exist.
    • getDataIndexImpl

      @Nullable protected abstract Table getDataIndexImpl(@NotNull String... columns)
      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.