Class WritableLocalTableLocationProvider
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,TableKey,TableLocationProvider,NamedImplementation
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.locations.TableKey
TableKey.KeyedObjectKeyImpl<VALUE_TYPE>, TableKey.SelfKeyedObjectKeyImpl<VALUE_TYPE extends TableKey>Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.locations.TableLocationProvider
TableLocationProvider.Listener, TableLocationProvider.NullTableLocationProvider -
Field Summary
Fields inherited from class com.illumon.iris.db.v2.locations.SubscriptionAggregator
subscriptionsFields inherited from interface com.illumon.iris.db.v2.locations.TableLocationProvider
globalMark -
Method Summary
Modifier and TypeMethodDescriptionprotected voidRefresh and activate update pushing from the implementing class.protected voidDeactivate pushed updates from the implementing class.protected voidInitialization method for subclasses to override, in case simply callingTableLocationProvider.refresh()is inappropriate.Get a name for the implementing class.voidhandleTableLocationKey(TableLocationKey locationKey) Deliver a possibly-new key.protected final WritableLocalTableLocationmakeTableLocation(TableLocationKey locationKey) Make a new implementation-appropriate TableLocation from the supplied key.protected <T> booleanmatchSubscriptionToken(T token) Verify that a notification pertains to a currently-active subscription.protected booleanmaybeReloadLocation(TableLocation tableLocation, boolean verifyCheckpoint, boolean observedLocationCreation) Determine whether the table (checkpoint) has changed out from under us and reload if necessary.putIfAbsent(TableLocationKey locationKey) voidrefresh()Initialize or refresh state information about the list of existing locations.voidrefreshAndRescan(Consumer<TableLocationKey> locationKeyObserver) Initialize or refresh state information about the list of existing locations.Methods inherited from class com.illumon.iris.db.v2.locations.AbstractTableLocationProvider
clearTableLocations, computeWithSubscriptionLock, deliverInitialSnapshot, ensureInitialized, getLog, getNamespace, getTableKey, getTableLocationIfPresent, getTableLocations, getTableName, getTableType, handleTableLocationKey, handleTableLocationKeyRemoved, isInitialized, mark, refreshAndRescan, removeTableLocationKey, removeUnvisited, setInitialized, toStringMethods inherited from class com.illumon.iris.db.v2.locations.SubscriptionAggregator
activationFailed, activationSuccessful, checkHasSubscribers, 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.iris.db.v2.locations.TableKey
append, asTableIdentifier, toStringDetailed, toStringHelper, toStringSimple, writeToMethods inherited from interface com.illumon.iris.db.v2.locations.TableLocationProvider
getName, getTableLocation, getTableLocation, subscribe, supportsSubscriptions, traverse, unsubscribe
-
Method Details
-
doInitialization
protected void doInitialization()Description copied from class:AbstractTableLocationProviderInitialization method for subclasses to override, in case simply callingTableLocationProvider.refresh()is inappropriate. This is *not* guaranteed to be called only once. It should internally callAbstractTableLocationProvider.setInitialized()upon successful initialization.- Overrides:
doInitializationin classAbstractTableLocationProvider
-
getImplementationName
Description copied from interface:NamedImplementationGet a name for the implementing class. Useful for abstract classes that implement
LogOutputAppendableor overridetoString.The default implementation is correct, but not suitable for high-frequency usage.
- Returns:
- A name for the implementing class
-
refresh
public void refresh()Description copied from interface:TableLocationProviderInitialize or refresh state information about the list of existing locations. -
refreshAndRescan
Description copied from interface:TableLocationProviderInitialize or refresh state information about the list of existing locations. If applicable, perform extra work to ensure any cached information is up to date.- Parameters:
locationKeyObserver- call this TableLocationKey consumer with each location encountered (instead of the default)
-
activateUnderlyingDataSource
protected void activateUnderlyingDataSource()Description copied from class:SubscriptionAggregatorRefresh 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:
activateUnderlyingDataSourcein classSubscriptionAggregator<TableLocationProvider.Listener>
-
deactivateUnderlyingDataSource
protected void deactivateUnderlyingDataSource()Description copied from class:SubscriptionAggregatorDeactivate pushed updates from the implementing class. Must be called under the subscription lock.- Overrides:
deactivateUnderlyingDataSourcein classSubscriptionAggregator<TableLocationProvider.Listener>
-
matchSubscriptionToken
protected <T> boolean matchSubscriptionToken(T token) Description copied from class:SubscriptionAggregatorVerify that a notification pertains to a currently-active subscription. Must be called under the subscription lock.- Overrides:
matchSubscriptionTokenin classSubscriptionAggregator<TableLocationProvider.Listener>- Parameters:
token- A subscription-related object that the subclass can use to match a notification- Returns:
- True iff notification delivery should proceed
-
putIfAbsent
-
handleTableLocationKey
Deliver a possibly-new key.- Overrides:
handleTableLocationKeyin classAbstractTableLocationProvider- Parameters:
locationKey- The new key
-
maybeReloadLocation
protected boolean maybeReloadLocation(TableLocation tableLocation, boolean verifyCheckpoint, boolean observedLocationCreation) Description copied from class:AbstractTableLocationProviderDetermine whether the table (checkpoint) has changed out from under us and reload if necessary.- Overrides:
maybeReloadLocationin classAbstractTableLocationProvider- Parameters:
tableLocation- the maybe-new table locationverifyCheckpoint- true if we are in a mode calling for checking location checkpointsobservedLocationCreation- true if the location was just created, vs pulled from a map. This may influence what work is performed in this method.- Returns:
- if the checkpoint was reloaded
-
makeTableLocation
@NotNull protected final WritableLocalTableLocation makeTableLocation(@NotNull TableLocationKey locationKey) Description copied from class:AbstractTableLocationProviderMake a new implementation-appropriate TableLocation from the supplied key.- Specified by:
makeTableLocationin classAbstractTableLocationProvider- Parameters:
locationKey- The table location key- Returns:
- The new TableLocation
-