Class PersistentQueryControllerClientImpl
java.lang.Object
io.deephaven.enterprise.dnd.controller.PersistentQueryControllerClientImpl
- All Implemented Interfaces:
PersistentQueryControllerClient,PersistentQueryScriptSource
public class PersistentQueryControllerClientImpl
extends Object
implements PersistentQueryControllerClient
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.enterprise.dnd.controller.PersistentQueryControllerClient
PersistentQueryControllerClient.Observer, PersistentQueryControllerClient.ObserverImpl -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.deephaven.hash.KeyedLongObjectHashMap<PersistentQueryInfoMessage> -
Constructor Summary
ConstructorsConstructorDescriptionPersistentQueryControllerClientImpl(@NotNull String who, @NotNull ControllerClientGrpc grpcClient) PersistentQueryControllerClientImpl(@NotNull String who, @NotNull io.grpc.ManagedChannel channel) PersistentQueryControllerClientImpl(@NotNull String who, @NotNull io.grpc.ManagedChannel channel, @NotNull ScheduledExecutorService executorService) PersistentQueryControllerClientImpl(@NotNull String who, @NotNull io.grpc.ManagedChannel channel, @NotNull ScheduledExecutorService executorService, @NotNull AuthenticationClient authClient, long heartBeatPeriodMillis, long heartBeatTimeoutMillis) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObserver(@NotNull PersistentQueryControllerClient.Observer observer) Add an Observer.voidaddObserverAndGetData(@NotNull PersistentQueryControllerClient.Observer observer) Add an Observer.longaddQuery(@NotNull PersistentQueryConfigMessage config) Adds a configuration to the controller's hash table.booleanauthenticate(@NotNull AuthToken token) Use the specified auth token to authenticate this client to the hashtable server.@Nullable PersistentQueryInfoMessageget(long querySerial) Get theinfofor the specified query serial.@Nullable PersistentQueryInfoMessageGet theinfofor the specified query name.@Nullable PersistentQueryInfoMessageGet theinfofor the specified query owner and name.@NotNull ControllerConfigurationMessageGet the currentControllerConfigurationMessage.@NotNull Map<Long,PersistentQueryInfoMessage> Get a copy of the current set of query data.@Nullable StringgetScriptBody(@NotNull String scriptPath, boolean isPathRelative, @Nullable String scriptLoaderStateJson) Get the body of the specified script as the currently authenticated user.@Nullable StringgetScriptBodyByQuery(@NotNull String scriptPath, long querySerial, boolean isPathRelative, @Nullable String scriptLoaderStateJson) Get a script by path for the owner of a specific query by serial, with optional script loader state information.@Nullable StringgetScriptBodyByUser(@NotNull String scriptPath, @NotNull String ownerName, boolean isPathRelative, @Nullable String scriptLoaderStateJson) Get the body of the specified script as the specified user.getScriptPaths(@Nullable String scriptLoaderStateJson, boolean useRelativePath) Get all script paths available for the currently authenticated user.getScriptPathsByQuery(long querySerial, @Nullable String scriptLoaderState, boolean useRelativePath) Get all script paths available to the owner of a specific query by serial, providing optional script loader state information.getScriptPathsByUser(@NotNull String userName, @Nullable String scriptLoaderStateJson, boolean useRelativePath) Get the script paths available for the specified user.booleanCheck if the client is connected to the Controller.voidmodifyQuery(@NotNull PersistentQueryConfigMessage config, boolean restartIfRunning) Modifies a configuration in the controller's hash table.voidCommand the PersistentQueryController to reload parts of its configuration without requiring a controller restart.voidremoveObserver(@NotNull PersistentQueryControllerClient.Observer observer) Remove the specifiedPersistentQueryControllerClient.Observerfrom the notification list.voidremoveQuery(long serialId) Removes a configuration from the controller's hash table by serial ID.voidrestartQueriesBySerial(@NotNull List<Long> serials) Restarts one or more persistent queries.voidrestartReplicas(@NotNull List<ReplicaSpecifier> replicas) Restart one or more query replicas and/or spares.voidMake this client ephemeral.voidshutdown()Shut down the client.voidstopQueriesBySerial(@NotNull List<Long> serials) Stop the specified queries by serial.voidSubscribe for updates for all visible queries.voidsubscribeWithFilter(@NotNull List<SubscriptionFilter> filters) Subscribe for updates narrowed to the PQs that match at least one of the supplied filter elements (OR-combined).voidupdateQueryStatus(long querySerial, String processInfoId, @Nullable PersistentQueryStatusEnum status, @Nullable Map<String, ExportedObjectInfoMessage> scopeFields, @Nullable Map<String, String[]> tableGroups) Publish an update for a persistent query.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.enterprise.dnd.controller.PersistentQueryControllerClient
modifyQuery, removeQuery, restartQueries, restartQueriesBySerial, restartQuery, stopQueries, stopQueriesBySerial, stopQueryMethods inherited from interface io.deephaven.enterprise.dnd.controller.PersistentQueryScriptSource
getScriptBody, getScriptBodyByQuery, getScriptBodyByUser, getScriptPaths, getScriptPathsByQuery, getScriptPathsByUser
-
Field Details
-
queryMap
-
-
Constructor Details
-
PersistentQueryControllerClientImpl
public PersistentQueryControllerClientImpl(@NotNull @NotNull String who, @NotNull @NotNull io.grpc.ManagedChannel channel) -
PersistentQueryControllerClientImpl
public PersistentQueryControllerClientImpl(@NotNull @NotNull String who, @NotNull @NotNull io.grpc.ManagedChannel channel, @NotNull @NotNull ScheduledExecutorService executorService) -
PersistentQueryControllerClientImpl
public PersistentQueryControllerClientImpl(@NotNull @NotNull String who, @NotNull @NotNull io.grpc.ManagedChannel channel, @NotNull @NotNull ScheduledExecutorService executorService, @NotNull @NotNull AuthenticationClient authClient, long heartBeatPeriodMillis, long heartBeatTimeoutMillis) -
PersistentQueryControllerClientImpl
public PersistentQueryControllerClientImpl(@NotNull @NotNull String who, @NotNull @NotNull ControllerClientGrpc grpcClient)
-
-
Method Details
-
addObserver
Description copied from interface:PersistentQueryControllerClientAdd an Observer. If the controller is available thePersistentQueryControllerClient.Observer.handleConnectionEstablished()will be invoked immediately. No initialputevents will be generated. If you want an initial snapshot with registration usePersistentQueryControllerClient.addObserverAndGetData(Observer)- Specified by:
addObserverin interfacePersistentQueryControllerClient- Parameters:
observer- thePersistentQueryControllerClient.Observerto add
-
addObserverAndGetData
public void addObserverAndGetData(@NotNull @NotNull PersistentQueryControllerClient.Observer observer) Description copied from interface:PersistentQueryControllerClientAdd an Observer. If the controller is available thePersistentQueryControllerClient.Observer.handleConnectionEstablished()will be invoked immediately. Theputmethod will be immediately invoked for each existing query.- Specified by:
addObserverAndGetDatain interfacePersistentQueryControllerClient- Parameters:
observer- thePersistentQueryControllerClient.Observerto add
-
removeObserver
Description copied from interface:PersistentQueryControllerClientRemove the specifiedPersistentQueryControllerClient.Observerfrom the notification list.- Specified by:
removeObserverin interfacePersistentQueryControllerClient- Parameters:
observer- the observer to remove.
-
getDataCopy
Description copied from interface:PersistentQueryControllerClientGet a copy of the current set of query data.- Specified by:
getDataCopyin interfacePersistentQueryControllerClient- Returns:
- a copy of the current set of queries.
-
isConnected
public boolean isConnected()Description copied from interface:PersistentQueryControllerClientCheck if the client is connected to the Controller.- Specified by:
isConnectedin interfacePersistentQueryControllerClient- Returns:
trueif is connected,falseotherwise
-
setEphemeral
public void setEphemeral()Description copied from interface:PersistentQueryControllerClientMake this client ephemeral. An Ephemeral client will not try to reconnect once it has lost its connection.- Specified by:
setEphemeralin interfacePersistentQueryControllerClient
-
authenticate
Description copied from interface:PersistentQueryControllerClientUse the specified auth token to authenticate this client to the hashtable server.- Specified by:
authenticatein interfacePersistentQueryControllerClient- Parameters:
token- the token for authentication- Returns:
- true if authentication was successful.
-
subscribeToAll
Description copied from interface:PersistentQueryControllerClientSubscribe for updates for all visible queries. This method will block until subscription is complete, or an error occurs.- Specified by:
subscribeToAllin interfacePersistentQueryControllerClient- Throws:
UncheckedDeephavenException- If an error occurs
-
subscribeWithFilter
public void subscribeWithFilter(@NotNull @NotNull List<SubscriptionFilter> filters) throws UncheckedDeephavenException Description copied from interface:PersistentQueryControllerClientSubscribe for updates narrowed to the PQs that match at least one of the supplied filter elements (OR-combined). An empty list is equivalent toPersistentQueryControllerClient.subscribeToAll(). This method blocks until the initial snapshot is received or an error occurs.Per the proto contract on
SubscribeRequest.filters, the server may decide to ignore the filter (an older controller will not know about the field). The underlying gRPC client always re-applies the same filter locally, synthesizing remove notifications for any PQ that transitions out of the matching set (e.g. via rename or owner change), so callers see the same enter/leave semantics regardless.- Specified by:
subscribeWithFilterin interfacePersistentQueryControllerClient- Parameters:
filters- the filter list narrowing the subscription.- Throws:
UncheckedDeephavenException- If an error occurs.
-
shutdown
Description copied from interface:PersistentQueryControllerClientShut down the client.- Specified by:
shutdownin interfacePersistentQueryControllerClient- Throws:
IOException- if an error occurs while shutting down
-
getConfiguration
Description copied from interface:PersistentQueryControllerClientGet the currentControllerConfigurationMessage.- Specified by:
getConfigurationin interfacePersistentQueryControllerClient- Returns:
- the current controller configuration
-
reloadConfiguration
public void reloadConfiguration()Description copied from interface:PersistentQueryControllerClientCommand the PersistentQueryController to reload parts of its configuration without requiring a controller restart. The controller will broadcast the updated configuration to all connected clients.Note that not all properties or configuration parameters may be reloaded.
- Specified by:
reloadConfigurationin interfacePersistentQueryControllerClient
-
addQuery
Description copied from interface:PersistentQueryControllerClientAdds a configuration to the controller's hash table.- Specified by:
addQueryin interfacePersistentQueryControllerClient- Parameters:
config- the configuration to add- Returns:
- the serial number of the added configuration
-
modifyQuery
public void modifyQuery(@NotNull @NotNull PersistentQueryConfigMessage config, boolean restartIfRunning) Description copied from interface:PersistentQueryControllerClientModifies a configuration in the controller's hash table.- Specified by:
modifyQueryin interfacePersistentQueryControllerClient- Parameters:
config- the updated configurationrestartIfRunning- restart the query when it is running if set to true
-
removeQuery
public void removeQuery(long serialId) Description copied from interface:PersistentQueryControllerClientRemoves a configuration from the controller's hash table by serial ID.- Specified by:
removeQueryin interfacePersistentQueryControllerClient- Parameters:
serialId- the serial ID of configuration to remove
-
restartQueriesBySerial
Description copied from interface:PersistentQueryControllerClientRestarts one or more persistent queries.- Specified by:
restartQueriesBySerialin interfacePersistentQueryControllerClient- Parameters:
serials- a list of serial ids to restart
-
restartReplicas
Description copied from interface:PersistentQueryControllerClientRestart one or more query replicas and/or spares.- Specified by:
restartReplicasin interfacePersistentQueryControllerClient- Parameters:
replicas- the replicas or spares to restart.
-
stopQueriesBySerial
Description copied from interface:PersistentQueryControllerClientStop the specified queries by serial.- Specified by:
stopQueriesBySerialin interfacePersistentQueryControllerClient- Parameters:
serials- the serials
-
get
Description copied from interface:PersistentQueryControllerClientGet theinfofor the specified query serial.- Specified by:
getin interfacePersistentQueryControllerClient- Parameters:
querySerial- the query serial- Returns:
- the
infoor null if it did not exist.
-
get
Description copied from interface:PersistentQueryControllerClientGet theinfofor the specified query name.- Specified by:
getin interfacePersistentQueryControllerClient- Parameters:
name- the name of the query- Returns:
- the
infoif it exists.
-
get
@Nullable public @Nullable PersistentQueryInfoMessage get(@NotNull @NotNull String owner, @NotNull @NotNull String name) Description copied from interface:PersistentQueryControllerClientGet theinfofor the specified query owner and name.- Specified by:
getin interfacePersistentQueryControllerClient- Parameters:
owner- the expected owner of the queryname- the name of the query- Returns:
- the
infoif it exists.
-
updateQueryStatus
public void updateQueryStatus(long querySerial, String processInfoId, @Nullable @Nullable PersistentQueryStatusEnum status, @Nullable @Nullable Map<String, ExportedObjectInfoMessage> scopeFields, @Nullable @Nullable Map<String, String[]> tableGroups) Description copied from interface:PersistentQueryControllerClientPublish an update for a persistent query. This is intended for use by Interactive Consoles only. Thestatus.scopeFields, andtableGroupsfields may all be omitted. If all three are omitted the message will be treated as a basic heartbeat.- Specified by:
updateQueryStatusin interfacePersistentQueryControllerClient- Parameters:
querySerial- the serial of the query this update is for.status- an optional new statusscopeFields- an optional map of exportable objectstableGroups- an optional map of exportable object to ACL groups.
-
getScriptPathsByUser
@NotNull public @NotNull Set<String> getScriptPathsByUser(@NotNull @NotNull String userName, @Nullable @Nullable String scriptLoaderStateJson, boolean useRelativePath) Description copied from interface:PersistentQueryScriptSourceGet the script paths available for the specified user.- Specified by:
getScriptPathsByUserin interfacePersistentQueryScriptSource- Parameters:
userName- the user to fetch paths forscriptLoaderStateJson- optional script loader state informationuseRelativePath- whether to return relative or display script paths- Returns:
- the set of paths available for the specified user
-
getScriptPaths
@NotNull public @NotNull Set<String> getScriptPaths(@Nullable @Nullable String scriptLoaderStateJson, boolean useRelativePath) Description copied from interface:PersistentQueryScriptSourceGet all script paths available for the currently authenticated user.- Specified by:
getScriptPathsin interfacePersistentQueryScriptSource- Parameters:
scriptLoaderStateJson- optional script loader state informationuseRelativePath- whether to return relative or display script paths- Returns:
- the set of paths available for the current user
-
getScriptPathsByQuery
@NotNull public @NotNull Set<String> getScriptPathsByQuery(long querySerial, @Nullable @Nullable String scriptLoaderState, boolean useRelativePath) Description copied from interface:PersistentQueryScriptSourceGet all script paths available to the owner of a specific query by serial, providing optional script loader state information.- Specified by:
getScriptPathsByQueryin interfacePersistentQueryScriptSource- Parameters:
querySerial- the query serialscriptLoaderState- an optional loader stateuseRelativePath- whether to return relative or display script paths- Returns:
- The paths available to the serial ID.
-
getScriptBody
@Nullable public @Nullable String getScriptBody(@NotNull @NotNull String scriptPath, boolean isPathRelative, @Nullable @Nullable String scriptLoaderStateJson) Description copied from interface:PersistentQueryScriptSourceGet the body of the specified script as the currently authenticated user.- Specified by:
getScriptBodyin interfacePersistentQueryScriptSource- Parameters:
scriptPath- the script pathisPathRelative- if thescriptPathis a relative pathscriptLoaderStateJson- optional script loader state information- Returns:
- the body of the script
-
getScriptBodyByUser
@Nullable public @Nullable String getScriptBodyByUser(@NotNull @NotNull String scriptPath, @NotNull @NotNull String ownerName, boolean isPathRelative, @Nullable @Nullable String scriptLoaderStateJson) Description copied from interface:PersistentQueryScriptSourceGet the body of the specified script as the specified user.- Specified by:
getScriptBodyByUserin interfacePersistentQueryScriptSource- Parameters:
scriptPath- the script pathownerName- the user to fetch the body asisPathRelative- if thescriptPathis relativescriptLoaderStateJson- optional script loader state information- Returns:
- the body of the script
-
getScriptBodyByQuery
@Nullable public @Nullable String getScriptBodyByQuery(@NotNull @NotNull String scriptPath, long querySerial, boolean isPathRelative, @Nullable @Nullable String scriptLoaderStateJson) Description copied from interface:PersistentQueryScriptSourceGet a script by path for the owner of a specific query by serial, with optional script loader state information.- Specified by:
getScriptBodyByQueryin interfacePersistentQueryScriptSource- Parameters:
scriptPath- The path string.querySerial- The Serial ID.isPathRelative- if thescriptPathis relativescriptLoaderStateJson- optional script loader state information- Returns:
- The contents of the script.
-