Package com.illumon.iris.db.v2.locations
Class DeferredTableLocation.SnapshotDriven<CLT extends ColumnLocation>
java.lang.Object
com.illumon.iris.db.v2.locations.DeferredTableLocation<CLT>
com.illumon.iris.db.v2.locations.DeferredTableLocation.SnapshotDriven<CLT>
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable
,TableLocation<CLT>
,TableLocationKey
,TableLocationState
,NamedImplementation
- Enclosing class:
- DeferredTableLocation<CLT extends ColumnLocation>
public static final class DeferredTableLocation.SnapshotDriven<CLT extends ColumnLocation> extends DeferredTableLocation<CLT>
DeferredTableLocation that implements metadata getters by delegating to a snapshot. Snapshotted TableLocations
never support subscriptions, and don't allow any sort of metadata refresh.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.iris.db.v2.locations.DeferredTableLocation
DeferredTableLocation.DataDriven<CLT extends ColumnLocation>, DeferredTableLocation.SnapshotDriven<CLT extends ColumnLocation>, DeferredTableLocation.TableLocationCreator<CLT extends ColumnLocation>
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 Constructor Description SnapshotDriven(TableKey tableKey, TableLocationMetadataIndex.TableLocationSnapshot tableLocationSnapshot, DeferredTableLocation.TableLocationCreator<CLT> tableLocationCreator)
-
Method Summary
Modifier and Type Method Description int
getColumnVersion()
Get the column version for this location.Table
getDataIndex(com.illumon.dataobjects.ColumnDefinition<?>... columns)
Get the data index table for the specified set of columns.TableLocation.Format
getFormat()
Get the format that was used to persist this table location.long
getLastModifiedTimeMillis()
long
getSize()
List<SortPair>
getSortedColumns()
Get an ordered list of columns this location is sorted by.Object
getStateLock()
boolean
hasDataIndexFor(com.illumon.dataobjects.ColumnDefinition<?>... columns)
Check if this location has a data index for the specified columns.void
refresh()
Initialize or refresh state information.void
subscribe(TableLocation.Listener listener)
Subscribe to pushed location updates.boolean
supportsSubscriptions()
Does this location support subscriptions? That is, can this location ever have ticking data?void
unsubscribe(TableLocation.Listener listener)
Unsubscribe from pushed location updates.Methods inherited from class com.illumon.iris.db.v2.locations.DeferredTableLocation
getColumnLocation, getColumnPartition, getImplementationName, getInternalPartition, getTableKey, getVisit, isRealized, toString, visit
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, toGenericString, toStringDetailed, toStringHelper
Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
copyStateValuesTo, getSizeStr, writeStateValuesTo
-
Constructor Details
-
SnapshotDriven
public SnapshotDriven(@NotNull TableKey tableKey, @NotNull TableLocationMetadataIndex.TableLocationSnapshot tableLocationSnapshot, @NotNull DeferredTableLocation.TableLocationCreator<CLT> tableLocationCreator)
-
-
Method Details
-
getStateLock
- Returns:
- The Object that accessors should synchronize on if they want to invoke multiple getters with consistent results.
-
getSize
public long getSize()- 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 long getLastModifiedTimeMillis()- 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
-
getFormat
Description copied from interface:TableLocation
Get the format that was used to persist this table location.- Returns:
- The format for this table location
-
supportsSubscriptions
public boolean supportsSubscriptions()Description copied from interface:TableLocation
Does this location support subscriptions? That is, can this location ever have ticking data?- Returns:
- True if this location supports subscriptions
-
subscribe
Description copied from interface:TableLocation
Subscribe to pushed location updates. Subscribing more than once with the same listener without an intervening unsubscribe is an error, and may result in undefined behavior.
This is a possibly asynchronous operation - listener will receive 1 or more handleUpdate callbacks, followed by 0 or 1 handleException callbacks during invocation and continuing after completion, on a thread determined by the implementation. Don't hold a lock that prevents notification delivery while subscribing!
This method only guarantees eventually consistent state. To force a state update, use refresh() after subscription completes.
- Parameters:
listener
- A listener
-
unsubscribe
Description copied from interface:TableLocation
Unsubscribe from pushed location updates.- Parameters:
listener
- The listener to forget about
-
refresh
public void refresh()Description copied from interface:TableLocation
Initialize or refresh state information. -
getSortedColumns
Description copied from interface:TableLocation
Get an ordered list of columns this location is sorted by.- Returns:
- a non-null ordered list of
SortPair
s
-
hasDataIndexFor
public boolean hasDataIndexFor(@NotNull com.illumon.dataobjects.ColumnDefinition<?>... columns)Description copied from interface:TableLocation
Check if this location has a data index for the specified columns.- Parameters:
columns
- the set of columns to check for.- Returns:
- true if the table has a Data Index for the specified columns
-
getDataIndex
@Nullable public Table getDataIndex(@NotNull com.illumon.dataobjects.ColumnDefinition<?>... 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.- Parameters:
columns
- the key columns for the index- Returns:
- the index table or null if one does not exist.
-
getColumnVersion
public int getColumnVersion()Description copied from interface:TableLocation
Get the column version for this location.- Returns:
- the column version
-