Class RemoteTableLocationImpl
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable
,DeephavenFormatTableLocation
,RequestResultHandler
,TableLocation
,TableLocationKey
,TableLocationState
,NamedImplementation
-
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 class com.illumon.iris.db.v2.locations.AbstractTableLocation
cachedGroupings, NO_GROUPING_SENTINEL
Fields inherited from class com.illumon.iris.db.v2.locations.SubscriptionAggregator
subscriptions
Fields inherited from interface com.illumon.iris.db.v2.locations.protocol.RequestResultHandler
NULL
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
ConstructorsConstructorDescriptionRemoteTableLocationImpl
(TableDataProtocolDriver driver, RemoteTableDataService.TableLocationProviderImpl tableLocationProvider, TableLocationKey locationKey, boolean supportsSubscriptions) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Refresh and activate update pushing from the implementing class.boolean
Check if this subscription aggregator still has any valid subscribers - useful if there may have been no notifications delivered for some time, as a test to determine whether work should be done to maintain the underlying subscription.protected void
Deactivate pushed updates from the implementing class.int
Get the column version for this location.protected Table
getDataIndexImpl
(String... columns) Load the data index from the location implementaiton.Get a name for the implementing class.Get an ordered list of columns this location is sorted by.void
handleUpdate
(TableLocationState source) Update all state fields from source's values, as inAbstractTableLocation.handleUpdate(long, long)
.boolean
hasDataIndexFor
(String... columns) Check if this location has a data index for the specified columns.protected final com.illumon.iris.db.v2.locations.remote.RemoteColumnLocationImpl
makeColumnLocation
(String name) protected <T> boolean
matchSubscriptionToken
(T token) Verify that a notification pertains to a currently-active subscription.void
onComplete
(TableDataRequest request) Invoked when the request completed successfully.void
onRejection
(TableDataRequest request, String rejectionMessage, TableDataProtocol.RequestRejectionType requestRejectionType) Invoked when the specified request was rejected.void
onTableLocationKeyAdded
(TableLocationKey locationKey) Invoked in response to atable locations request
for each discoveredTableLocationKey
.void
onTableLocationKeyRemoved
(TableLocationKey locationKey) Invoked when the upstream provider has removed, or detected a removed location.void
Invoked in response to alocation refresh request
.void
onTimeout
(TableDataRequest request) Invoked when the specified request timed out before a response was received.void
refresh()
Initialize or refresh state information.Methods inherited from class com.illumon.iris.db.v2.locations.AbstractTableLocation
clearColumnLocations, deliverInitialSnapshot, getColumnLocation, getColumnPartition, getDataIndex, getInternalPartition, getLastModifiedTimeMillis, getSize, getStateLock, getTableKey, getVisit, handleUpdate, toString, visit
Methods inherited from class com.illumon.iris.db.v2.locations.SubscriptionAggregator
activationFailed, activationSuccessful, 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.DeephavenFormatTableLocation
getFormat
Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocation
append, as, clearColumnLocations, getColumnLocation, getColumnLocation, getDataIndex, getTableKey, getVisit, handleUpdate, subscribe, supportsSubscriptions, toGenericString, toStringDetailed, toStringHelper, unsubscribe, visit
Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
getColumnPartition, getInternalPartition, writeTo
Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
copyStateValuesTo, getLastModifiedTimeMillis, getSize, getSizeStr, getStateLock, writeStateValuesTo
-
Constructor Details
-
RemoteTableLocationImpl
public RemoteTableLocationImpl(@NotNull TableDataProtocolDriver driver, @NotNull RemoteTableDataService.TableLocationProviderImpl tableLocationProvider, @NotNull TableLocationKey locationKey, boolean supportsSubscriptions)
-
-
Method Details
-
handleUpdate
Description copied from class:AbstractTableLocation
Update all state fields from source's values, as inAbstractTableLocation.handleUpdate(long, long)
. SeeTableLocationState
for documentation of values.- Overrides:
handleUpdate
in classAbstractTableLocation<RemoteTableDataService.TableLocationProviderImpl,
com.illumon.iris.db.v2.locations.remote.RemoteColumnLocationImpl> - Parameters:
source
- The source to copy state values from
-
getImplementationName
Description copied from interface:NamedImplementation
Get a name for the implementing class. Useful for abstract classes that implement
LogOutputAppendable
or overridetoString
.The default implementation is correct, but not suitable for high-frequency usage.
- Specified by:
getImplementationName
in interfaceNamedImplementation
- Returns:
- A name for the implementing class
-
activateUnderlyingDataSource
protected void activateUnderlyingDataSource()Description copied from class:SubscriptionAggregator
Refresh and activate update pushing from the implementing class.
If the implementation will deliver notifications in a different thread than the one that calls this method, then this method must be asynchronous - that is, it must not block pending delivery of results. This requirement holds even if that other thread has nothing to do with the initial activation request!
Listeners should guard against duplicate notifications, especially if the implementation delivers synchronous notifications.
The implementation should call activationSuccessful() when done activating and delivering initial refresh results, unless activationFailed() was called instead.
Must be called under the subscription lock.
- Overrides:
activateUnderlyingDataSource
in classSubscriptionAggregator<TableLocation.Listener>
-
deactivateUnderlyingDataSource
protected void deactivateUnderlyingDataSource()Description copied from class:SubscriptionAggregator
Deactivate pushed updates from the implementing class. Must be called under the subscription lock.- Overrides:
deactivateUnderlyingDataSource
in classSubscriptionAggregator<TableLocation.Listener>
-
matchSubscriptionToken
protected <T> boolean matchSubscriptionToken(T token) Description copied from class:SubscriptionAggregator
Verify that a notification pertains to a currently-active subscription. Must be called under the subscription lock.- Overrides:
matchSubscriptionToken
in classSubscriptionAggregator<TableLocation.Listener>
- Parameters:
token
- A subscription-related object that the subclass can use to match a notification- Returns:
- True iff notification delivery should proceed
-
refresh
public void refresh()Description copied from interface:TableLocation
Initialize or refresh state information.- Specified by:
refresh
in interfaceTableLocation
-
makeColumnLocation
@NotNull protected final com.illumon.iris.db.v2.locations.remote.RemoteColumnLocationImpl makeColumnLocation(@NotNull String name) - Specified by:
makeColumnLocation
in classAbstractTableLocation<RemoteTableDataService.TableLocationProviderImpl,
com.illumon.iris.db.v2.locations.remote.RemoteColumnLocationImpl>
-
getSortedColumns
Description copied from interface:TableLocation
Get an ordered list of columns this location is sorted by.- Specified by:
getSortedColumns
in interfaceTableLocation
- Returns:
- a non-null ordered list of
SortPair
s
-
hasDataIndexFor
Description copied from interface:TableLocation
Check if this location has a data index for the specified columns.- Specified by:
hasDataIndexFor
in interfaceTableLocation
- Parameters:
columns
- the set of columns to check for.- Returns:
- true if the table has a Data Index for the specified columns
-
getDataIndexImpl
Description copied from class:AbstractTableLocation
Load the data index from the location implementaiton. Implementations of this method should not perform any result caching.- Specified by:
getDataIndexImpl
in classAbstractTableLocation<RemoteTableDataService.TableLocationProviderImpl,
com.illumon.iris.db.v2.locations.remote.RemoteColumnLocationImpl> - Parameters:
columns
- the columns to load an index for.- Returns:
- the data index table, or an empty table or null if none existed.
-
getColumnVersion
public int getColumnVersion()Description copied from interface:DeephavenFormatTableLocation
Get the column version for this location.- Specified by:
getColumnVersion
in interfaceDeephavenFormatTableLocation
- Returns:
- the column version
-
onTimeout
Description copied from interface:RequestResultHandler
Invoked when the specified request timed out before a response was received.- Specified by:
onTimeout
in interfaceRequestResultHandler
- Parameters:
request
- the request object.
-
onRejection
public void onRejection(@NotNull TableDataRequest request, String rejectionMessage, TableDataProtocol.RequestRejectionType requestRejectionType) Description copied from interface:RequestResultHandler
Invoked when the specified request was rejected. This typically happens during subscription to a location- Specified by:
onRejection
in interfaceRequestResultHandler
- Parameters:
request
- the request object.rejectionMessage
- a message for context about the rejectionrequestRejectionType
- what type of rejection was received
-
onComplete
Description copied from interface:RequestResultHandler
Invoked when the request completed successfully.- Specified by:
onComplete
in interfaceRequestResultHandler
- Parameters:
request
- the request object
-
onTableLocationState
Description copied from interface:RequestResultHandler
Invoked in response to alocation refresh request
.- Specified by:
onTableLocationState
in interfaceRequestResultHandler
- Parameters:
state
- the updatedTableLocationState
for the location requested
-
onTableLocationKeyAdded
Description copied from interface:RequestResultHandler
Invoked in response to atable locations request
for each discoveredTableLocationKey
.- Specified by:
onTableLocationKeyAdded
in interfaceRequestResultHandler
- Parameters:
locationKey
- the discoveredTableLocationKey
-
onTableLocationKeyRemoved
Description copied from interface:RequestResultHandler
Invoked when the upstream provider has removed, or detected a removed location.- Specified by:
onTableLocationKeyRemoved
in interfaceRequestResultHandler
- Parameters:
locationKey
- theTableLocationKey
that was removed
-
checkHasSubscribers
public boolean checkHasSubscribers()Description copied from class:SubscriptionAggregator
Check if this subscription aggregator still has any valid subscribers - useful if there may have been no notifications delivered for some time, as a test to determine whether work should be done to maintain the underlying subscription.- Specified by:
checkHasSubscribers
in interfaceRequestResultHandler
- Overrides:
checkHasSubscribers
in classSubscriptionAggregator<TableLocation.Listener>
- Returns:
- true if there are valid subscribers, else false
-