Class SingleTableLocationProvider
- All Implemented Interfaces:
TableLocationProvider
,NamedImplementation
TableLocationProvider
that provides access to exactly one, previously-known TableLocation
. In
contrast to AbstractTableLocationProvider
, this class does not manage the liveness of the table location.
Managment must be done externally (as in SourcePartitionedTable
).-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.locations.TableLocationProvider
TableLocationProvider.Listener
-
Constructor Summary
ConstructorsConstructorDescriptionSingleTableLocationProvider
(@NotNull TableLocation tableLocation, TableUpdateMode locationUpdateMode) -
Method Summary
Modifier and TypeMethodDescriptionEnsure that this location provider is initialized.Get a name for the implementing class.getKey()
Get theTableKey
associated with this provider.@NotNull TableUpdateMode
Get the locationupdate guarantees
of this provider describing how individual locations will add or remove rows.@Nullable TableLocation
getTableLocationIfPresent
(@NotNull TableLocationKey tableLocationKey) Get theTableLocation
associated with the given key if it exists.void
getTableLocationKeys
(Consumer<LiveSupplier<ImmutableTableLocationKey>> consumer, Predicate<ImmutableTableLocationKey> filter) Get this provider's currently known location keys.@NotNull TableUpdateMode
Get theupdate guarantees
of this provider describing how this provider will add or remove table locations.boolean
hasTableLocationKey
(@NotNull TableLocationKey tableLocationKey) Check if this provider knows the supplied location key.void
refresh()
Initialize or refresh state information about the list of existing locations.void
subscribe
(@NotNull TableLocationProvider.Listener listener) Subscribe to pushed location additions.boolean
Does this provider support subscriptions? That is, can this provider ever have ticking data?void
unsubscribe
(@NotNull 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, wait
Methods inherited from interface io.deephaven.engine.table.impl.locations.TableLocationProvider
getName, getTableLocation, getTableLocationKeys, getTableLocationKeys
-
Constructor Details
-
SingleTableLocationProvider
public SingleTableLocationProvider(@NotNull @NotNull TableLocation tableLocation, TableUpdateMode locationUpdateMode) - Parameters:
tableLocation
- The only table location that this provider will ever provide
-
-
Method Details
-
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
-
getKey
Description copied from interface:TableLocationProvider
Get theTableKey
associated with this provider.- Specified by:
getKey
in interfaceTableLocationProvider
- Returns:
- The associated
TableKey
-
supportsSubscriptions
public boolean supportsSubscriptions()Description copied from interface:TableLocationProvider
Does this provider support subscriptions? That is, can this provider ever have ticking data?- Specified by:
supportsSubscriptions
in interfaceTableLocationProvider
- Returns:
- True if this provider supports subscriptions.
-
subscribe
Description copied from interface:TableLocationProvider
Subscribe 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 handleTableLocationKey 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:
subscribe
in interfaceTableLocationProvider
- Parameters:
listener
- A listener.
-
unsubscribe
Description copied from interface:TableLocationProvider
Unsubscribe from pushed location additions.- Specified by:
unsubscribe
in interfaceTableLocationProvider
- Parameters:
listener
- The listener to forget about.
-
refresh
public void refresh()Description copied from interface:TableLocationProvider
Initialize or refresh state information about the list of existing locations.- Specified by:
refresh
in interfaceTableLocationProvider
-
ensureInitialized
Description copied from interface:TableLocationProvider
Ensure 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:
ensureInitialized
in interfaceTableLocationProvider
- Returns:
- this, to allow method chaining.
-
getTableLocationKeys
public void getTableLocationKeys(Consumer<LiveSupplier<ImmutableTableLocationKey>> consumer, Predicate<ImmutableTableLocationKey> filter) Description copied from interface:TableLocationProvider
Get this provider's currently known location keys. The locations specified by the keys returned may have null size - that is, they may not "exist" for application purposes.TableLocationProvider.getTableLocation(TableLocationKey)
is guaranteed to succeed for all results as long as the associatedLiveSupplier
is retained by the caller.- Specified by:
getTableLocationKeys
in interfaceTableLocationProvider
- Parameters:
consumer
- A consumer to receive the location keysfilter
- A filter to apply to the location keys before the consumer is called
-
hasTableLocationKey
Description copied from interface:TableLocationProvider
Check if this provider knows the supplied location key.- Specified by:
hasTableLocationKey
in interfaceTableLocationProvider
- Parameters:
tableLocationKey
- The key to test.- Returns:
- Whether the key is known to this provider.
-
getTableLocationIfPresent
@Nullable public @Nullable TableLocation getTableLocationIfPresent(@NotNull @NotNull TableLocationKey tableLocationKey) Description copied from interface:TableLocationProvider
Get theTableLocation
associated with the given key if it exists. Callers should ensure that they retain theLiveSupplier
returned byTableLocationProvider.getTableLocationKeys(Consumer, Predicate)
for the key they are interested in, as the location may be removed if the supplier is no longer live.- Specified by:
getTableLocationIfPresent
in interfaceTableLocationProvider
- Parameters:
tableLocationKey
- ATableLocationKey
specifying the location to get.- Returns:
- The
TableLocation
matching the given key if present, else null.
-
getUpdateMode
Description copied from interface:TableLocationProvider
Get theupdate guarantees
of this provider describing how this provider will add or remove table locations.- Specified by:
getUpdateMode
in interfaceTableLocationProvider
-
getLocationUpdateMode
Description copied from interface:TableLocationProvider
Get the locationupdate guarantees
of this provider describing how individual locations will add or remove rows.- Specified by:
getLocationUpdateMode
in interfaceTableLocationProvider
-