Class SingleTableLocationProvider
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,TableKey,TableLocationProvider,NamedImplementation
public class SingleTableLocationProvider extends Object implements TableLocationProvider
TableLocationProvider that provides access to exactly one, previously-known TableLocation.-
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 -
Field Summary
-
Constructor Summary
Constructors Constructor Description SingleTableLocationProvider(TableLocation tableLocation) -
Method Summary
Modifier and Type Method Description TableLocationProviderensureInitialized()Ensure that this location provider is initialized.CharSequencegetNamespace()TableLocationgetTableLocationIfPresent(TableLocationKey tableLocationKey)Collection<TableLocation>getTableLocations()Get this provider's currently available locations.CharSequencegetTableName()TableTypegetTableType()voidrefresh()Initialize or refresh state information about the list of existing locations.voidsubscribe(TableLocationProvider.Listener listener)Subscribe to pushed location additions.booleansupportsSubscriptions()Does this provider support subscriptions? That is, can this provider ever have ticking data?voidunsubscribe(TableLocationProvider.Listener listener)Unsubscribe from pushed location additions.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.locations.TableKey
append, asTableIdentifier, toStringDetailed, toStringHelper, writeToMethods inherited from interface com.illumon.iris.db.v2.locations.TableLocationProvider
getName, getTableLocation, getTableLocation
-
Constructor Details
-
SingleTableLocationProvider
- Parameters:
tableLocation- The only table location that this provider will ever provide
-
-
Method Details
-
supportsSubscriptions
public boolean supportsSubscriptions()Description copied from interface:TableLocationProviderDoes this provider support subscriptions? That is, can this provider ever have ticking data?- Specified by:
supportsSubscriptionsin interfaceTableLocationProvider- Returns:
- True if this provider supports subscriptions.
-
subscribe
Description copied from interface:TableLocationProviderSubscribe to pushed location additions. 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 0 or more handleTableLocation callbacks, followed by 0 or 1 handleException callbacks during invocation and continuing after completion, on a thread determined by the implementation. As noted in
BasicTableDataListener.handleException(TableDataException), an exception callback signifies that the subscription is no longer valid, and no unsubscribe is required in that case. Callers must not hold any lock that prevents notification delivery while subscribing. Callers must guard against duplicate notifications.This method only guarantees eventually consistent state. To force a state update, use refresh() after subscription completes.
- Specified by:
subscribein interfaceTableLocationProvider- Parameters:
listener- A listener.
-
unsubscribe
Description copied from interface:TableLocationProviderUnsubscribe from pushed location additions.- Specified by:
unsubscribein interfaceTableLocationProvider- Parameters:
listener- The listener to forget about.
-
refresh
public void refresh()Description copied from interface:TableLocationProviderInitialize or refresh state information about the list of existing locations.- Specified by:
refreshin interfaceTableLocationProvider
-
ensureInitialized
Description copied from interface:TableLocationProviderEnsure that this location provider is initialized. Mainly useful in cases where it cannot be otherwise guaranteed thatTableLocationProvider.refresh()orTableLocationProvider.subscribe(Listener)has been called prior to calls to the various table location fetch methods.- Specified by:
ensureInitializedin interfaceTableLocationProvider- Returns:
- this, to allow method chaining
-
getTableLocations
Description copied from interface:TableLocationProviderGet this provider's currently available locations. Locations returned may have null size - that is, they may not "exist" for application purposes.- Specified by:
getTableLocationsin interfaceTableLocationProvider- Returns:
- A collection of locations available from this provider
-
getTableLocationIfPresent
@Nullable public TableLocation getTableLocationIfPresent(@NotNull TableLocationKey tableLocationKey)- Specified by:
getTableLocationIfPresentin interfaceTableLocationProvider- Parameters:
tableLocationKey- A key specifying the location to get- Returns:
- The TableLocation matching the given key if present, else null
-
getNamespace
- Specified by:
getNamespacein interfaceTableKey- Returns:
- The namespace enclosing this table
-
getTableName
- Specified by:
getTableNamein interfaceTableKey- Returns:
- The name of this table
-
getTableType
- Specified by:
getTableTypein interfaceTableKey- Returns:
- The type of this table (which generally dictates storage, metadata-availability, etc)
-