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 io.deephaven.enterprise.controller.client.ControllerClientGrpc grpcClient) PersistentQueryControllerClientImpl
(@NotNull String who, @NotNull io.deephaven.shadow.core.io.grpc.ManagedChannel channel) PersistentQueryControllerClientImpl
(@NotNull String who, @NotNull io.deephaven.shadow.core.io.grpc.ManagedChannel channel, @NotNull ScheduledExecutorService executorService) PersistentQueryControllerClientImpl
(@NotNull String who, @NotNull io.deephaven.shadow.core.io.grpc.ManagedChannel channel, @NotNull ScheduledExecutorService executorService, @NotNull io.deephaven.enterprise.auth.AuthenticationClient authClient, long heartBeatPeriodMillis, long heartBeatTimeoutMillis) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addObserver
(@NotNull PersistentQueryControllerClient.Observer observer) Add an Observer.void
addObserverAndGetData
(@NotNull PersistentQueryControllerClient.Observer observer) Add an Observer.long
addQuery
(@NotNull PersistentQueryConfigMessage config) Adds a configuration to the controller's hash table.boolean
authenticate
(@NotNull io.deephaven.enterprise.auth.AuthToken token) Use the specified auth token to authenticate this client to the hashtable server.@Nullable PersistentQueryInfoMessage
get
(long querySerial) Get theinfo
for the specified query serial.@Nullable PersistentQueryInfoMessage
Get theinfo
for the specified query name.@Nullable PersistentQueryInfoMessage
Get theinfo
for the specified query owner and name.@NotNull ControllerConfigurationMessage
Get the currentControllerConfigurationMessage
.@NotNull Map<Long,
PersistentQueryInfoMessage> Get a copy of the current set of query data.@Nullable String
getScriptBody
(@NotNull String scriptPath, boolean isPathRelative, @Nullable String scriptLoaderStateJson) Get the body of the specified script as the currently authenticated user.@Nullable String
getScriptBodyByQuery
(@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 String
getScriptBodyByUser
(@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.boolean
Check if the client is connected to the Controller.void
modifyQuery
(@NotNull PersistentQueryConfigMessage config, boolean restartIfRunning) Modifies a configuration in the controller's hash table.void
Command the PersistentQueryController to reload parts of its configuration without requiring a controller restart.void
removeObserver
(@NotNull PersistentQueryControllerClient.Observer observer) Remove the specifiedPersistentQueryControllerClient.Observer
from the notification list.void
removeQuery
(long serialId) Removes a configuration from the controller's hash table by serial ID.void
restartQueriesBySerial
(@NotNull List<Long> serials) Restarts one or more persistent queries.void
restartReplicas
(@NotNull List<ReplicaSpecifier> replicas) Restart one or more query replicas and/or spares.void
Make this client ephemeral.void
shutdown()
Shut down the client.void
stopQueriesBySerial
(@NotNull List<Long> serials) Stop the specified queries by serial.void
Subscribe for updates for all visible queries.void
updateQueryStatus
(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, wait
Methods inherited from interface io.deephaven.enterprise.dnd.controller.PersistentQueryControllerClient
modifyQuery, removeQuery, restartQueries, restartQueriesBySerial, restartQuery, stopQueries, stopQueriesBySerial, stopQuery
Methods 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.deephaven.shadow.core.io.grpc.ManagedChannel channel) -
PersistentQueryControllerClientImpl
public PersistentQueryControllerClientImpl(@NotNull @NotNull String who, @NotNull @NotNull io.deephaven.shadow.core.io.grpc.ManagedChannel channel, @NotNull @NotNull ScheduledExecutorService executorService) -
PersistentQueryControllerClientImpl
public PersistentQueryControllerClientImpl(@NotNull @NotNull String who, @NotNull @NotNull io.deephaven.shadow.core.io.grpc.ManagedChannel channel, @NotNull @NotNull ScheduledExecutorService executorService, @NotNull @NotNull io.deephaven.enterprise.auth.AuthenticationClient authClient, long heartBeatPeriodMillis, long heartBeatTimeoutMillis) -
PersistentQueryControllerClientImpl
public PersistentQueryControllerClientImpl(@NotNull @NotNull io.deephaven.enterprise.controller.client.ControllerClientGrpc grpcClient)
-
-
Method Details
-
addObserver
Description copied from interface:PersistentQueryControllerClient
Add an Observer. If the controller is available thePersistentQueryControllerClient.Observer.handleConnectionEstablished()
will be invoked immediately. No initialput
events will be generated. If you want an initial snapshot with registration usePersistentQueryControllerClient.addObserverAndGetData(Observer)
- Specified by:
addObserver
in interfacePersistentQueryControllerClient
- Parameters:
observer
- thePersistentQueryControllerClient.Observer
to add
-
addObserverAndGetData
public void addObserverAndGetData(@NotNull @NotNull PersistentQueryControllerClient.Observer observer) Description copied from interface:PersistentQueryControllerClient
Add an Observer. If the controller is available thePersistentQueryControllerClient.Observer.handleConnectionEstablished()
will be invoked immediately. Theput
method will be immediately invoked for each existing query.- Specified by:
addObserverAndGetData
in interfacePersistentQueryControllerClient
- Parameters:
observer
- thePersistentQueryControllerClient.Observer
to add
-
removeObserver
Description copied from interface:PersistentQueryControllerClient
Remove the specifiedPersistentQueryControllerClient.Observer
from the notification list.- Specified by:
removeObserver
in interfacePersistentQueryControllerClient
- Parameters:
observer
- the observer to remove.
-
getDataCopy
Description copied from interface:PersistentQueryControllerClient
Get a copy of the current set of query data.- Specified by:
getDataCopy
in interfacePersistentQueryControllerClient
- Returns:
- a copy of the current set of queries.
-
isConnected
public boolean isConnected()Description copied from interface:PersistentQueryControllerClient
Check if the client is connected to the Controller.- Specified by:
isConnected
in interfacePersistentQueryControllerClient
- Returns:
true
if is connected,false
otherwise
-
setEphemeral
public void setEphemeral()Description copied from interface:PersistentQueryControllerClient
Make this client ephemeral. An Ephemeral client will not try to reconnect once it has lost its connection.- Specified by:
setEphemeral
in interfacePersistentQueryControllerClient
-
authenticate
public boolean authenticate(@NotNull @NotNull io.deephaven.enterprise.auth.AuthToken token) Description copied from interface:PersistentQueryControllerClient
Use the specified auth token to authenticate this client to the hashtable server.- Specified by:
authenticate
in interfacePersistentQueryControllerClient
- Parameters:
token
- the token for authentication- Returns:
- true if authentication was successful.
-
subscribeToAll
Description copied from interface:PersistentQueryControllerClient
Subscribe for updates for all visible queries. This method will block until subscription is complete, or an error occurs.- Specified by:
subscribeToAll
in interfacePersistentQueryControllerClient
- Throws:
UncheckedDeephavenException
- If an error occurs
-
shutdown
Description copied from interface:PersistentQueryControllerClient
Shut down the client.- Specified by:
shutdown
in interfacePersistentQueryControllerClient
- Throws:
IOException
- if an error occurs while shutting down
-
getConfiguration
Description copied from interface:PersistentQueryControllerClient
Get the currentControllerConfigurationMessage
.- Specified by:
getConfiguration
in interfacePersistentQueryControllerClient
- Returns:
- the current controller configuration
-
reloadConfiguration
public void reloadConfiguration()Description copied from interface:PersistentQueryControllerClient
Command 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:
reloadConfiguration
in interfacePersistentQueryControllerClient
-
addQuery
Description copied from interface:PersistentQueryControllerClient
Adds a configuration to the controller's hash table.- Specified by:
addQuery
in 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:PersistentQueryControllerClient
Modifies a configuration in the controller's hash table.- Specified by:
modifyQuery
in 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:PersistentQueryControllerClient
Removes a configuration from the controller's hash table by serial ID.- Specified by:
removeQuery
in interfacePersistentQueryControllerClient
- Parameters:
serialId
- the serial ID of configuration to remove
-
restartQueriesBySerial
Description copied from interface:PersistentQueryControllerClient
Restarts one or more persistent queries.- Specified by:
restartQueriesBySerial
in interfacePersistentQueryControllerClient
- Parameters:
serials
- a list of serial ids to restart
-
restartReplicas
Description copied from interface:PersistentQueryControllerClient
Restart one or more query replicas and/or spares.- Specified by:
restartReplicas
in interfacePersistentQueryControllerClient
- Parameters:
replicas
- the replicas or spares to restart.
-
stopQueriesBySerial
Description copied from interface:PersistentQueryControllerClient
Stop the specified queries by serial.- Specified by:
stopQueriesBySerial
in interfacePersistentQueryControllerClient
- Parameters:
serials
- the serials
-
get
Description copied from interface:PersistentQueryControllerClient
Get theinfo
for the specified query serial.- Specified by:
get
in interfacePersistentQueryControllerClient
- Parameters:
querySerial
- the query serial- Returns:
- the
info
or null if it did not exist.
-
get
Description copied from interface:PersistentQueryControllerClient
Get theinfo
for the specified query name.- Specified by:
get
in interfacePersistentQueryControllerClient
- Parameters:
name
- the name of the query- Returns:
- the
info
if it exists.
-
get
@Nullable public @Nullable PersistentQueryInfoMessage get(@NotNull @NotNull String owner, @NotNull @NotNull String name) Description copied from interface:PersistentQueryControllerClient
Get theinfo
for the specified query owner and name.- Specified by:
get
in interfacePersistentQueryControllerClient
- Parameters:
owner
- the expected owner of the queryname
- the name of the query- Returns:
- the
info
if 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:PersistentQueryControllerClient
Publish an update for a persistent query. This is intended for use by Interactive Consoles only. Thestatus
.scopeFields
, andtableGroups
fields may all be omitted. If all three are omitted the message will be treated as a basic heartbeat.- Specified by:
updateQueryStatus
in 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:PersistentQueryScriptSource
Get the script paths available for the specified user.- Specified by:
getScriptPathsByUser
in 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:PersistentQueryScriptSource
Get all script paths available for the currently authenticated user.- Specified by:
getScriptPaths
in 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:PersistentQueryScriptSource
Get all script paths available to the owner of a specific query by serial, providing optional script loader state information.- Specified by:
getScriptPathsByQuery
in 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:PersistentQueryScriptSource
Get the body of the specified script as the currently authenticated user.- Specified by:
getScriptBody
in interfacePersistentQueryScriptSource
- Parameters:
scriptPath
- the script pathisPathRelative
- if thescriptPath
is 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:PersistentQueryScriptSource
Get the body of the specified script as the specified user.- Specified by:
getScriptBodyByUser
in interfacePersistentQueryScriptSource
- Parameters:
scriptPath
- the script pathownerName
- the user to fetch the body asisPathRelative
- if thescriptPath
is 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:PersistentQueryScriptSource
Get a script by path for the owner of a specific query by serial, with optional script loader state information.- Specified by:
getScriptBodyByQuery
in interfacePersistentQueryScriptSource
- Parameters:
scriptPath
- The path string.querySerial
- The Serial ID.isPathRelative
- if thescriptPath
is relativescriptLoaderStateJson
- optional script loader state information- Returns:
- The contents of the script.
-