Top-level class: Client#

Description#

The Client class is the main entry point to the Deephaven Client API. Use Connect to connect to a Deephaven instance, then call GetManager to get a TableHandleManager

Example:

const char *server = "localhost:10000";
auto client = Client::Connect(server);
auto manager = client.GetManager();
auto my_data = manager.FetchTable("MyData");
auto filtered = my_data.Where("Price < 100")
    .Sort(SortPair("Timestamp"))
    .Tail(5);

Declarations#

class Client#

The main class for interacting with Deephaven. Start here to Connect with the server and to get a TableHandleManager.

Public Functions

Client(Client &&other) noexcept#

Move constructor

Client &operator=(Client &&other) noexcept#

Move assigment operator.

~Client()#

Destructor

void Close()#

Shuts down the Client and all associated state (GRPC connections, subscriptions, etc). This method is used if a caller wants to shut down Client state early. If it is not called, the shutdown actions will happen when this Client is destructed. The caller must not use any associated data structures (TableHandleManager, TableHandle, etc) after Close() is called or after Client’s destructor is invoked. If the caller tries to do so, the behavior is unspecified.

TableHandleManager GetManager() const#

Gets a TableHandleManager which you can use to create empty tables, fetch tables, and so on. You can create more than one TableHandleManager.

Returns:

The TableHandleManager.

OnCloseCbId AddOnCloseCallback(OnCloseCb cb)#

Adds a callback to be invoked when this client is closed. On close callbacks are invoked before the client is actually shut down, so they can perform regular client and table manager operations before closing.

Parameters:

cb – the callback

Returns:

an id for the added callback that can be used to remove it.

bool RemoveOnCloseCallback(OnCloseCbId cb_id)#

Removes an on close callback.

Parameters:

cb_id – the id of the callback to remove

Returns:

true if a callback with that id was found and removed, false otherwise.

Public Static Functions

static Client Connect(const std::string &target, const ClientOptions &options = {})#

Factory method to Connect to a Deephaven server using the specified options.

Parameters:
  • target – A connection string in the format host:port. For example “localhost:10000”.

  • options – An options object for setting options like authentication and script language.

Returns:

A Client object conneted to the Deephaven server.

class ClientOptions#

Public Functions

ClientOptions(const ClientOptions &other)#

Copy constructor

ClientOptions(ClientOptions &&other) noexcept#

Move constructor

ClientOptions &operator=(const ClientOptions &other)#

Copy assigment operator.

ClientOptions &operator=(ClientOptions &&other) noexcept#

Move assigment operator.

~ClientOptions()#

Destructor

ClientOptions &SetDefaultAuthentication()#

Modifies the ClientOptions object to set the default authentication scheme.

Returns:

*this, so that methods can be chained.

ClientOptions &SetBasicAuthentication(const std::string &username, const std::string &password)#

Modifies the ClientOptions object to set the basic authentication scheme.

Returns:

*this, so that methods can be chained.

ClientOptions &SetCustomAuthentication(const std::string &authentication_key, const std::string &authentication_value)#

Modifies the ClientOptions object to set a custom authentication scheme.

Returns:

*this, so that methods can be chained.

ClientOptions &SetSessionType(std::string session_type)#

Modifies the ClientOptions object to set the scripting language for the session.

Parameters:

session_type – The scripting language for the session, such as “groovy” or “python”.

Returns:

*this, so that methods can be chained.

ClientOptions &SetUseTls(bool use_tls)#

Configure whether to set server connections as TLS

Parameters:

use_tls – true if server connections should be TLS/SSL, false for insecure.

Returns:

*this, to be used for chaining

ClientOptions &SetTlsRootCerts(std::string tls_root_certs)#

Sets a PEM-encoded certificate root for server connections. The empty string means use system defaults.

Parameters:

pem – a PEM encoded certificate chain.

Returns:

*this, to be used for chaining

ClientOptions &SetClientCertChain(std::string client_cert_chain)#

Sets a PEM-encoded certificate for the client and use mutual TLS. The empty string means don’t use mutual TLS.

Parameters:

pem – a PEM encoded certificate chain, or empty for no mutual TLS.

Returns:

*this, to be used for chaining

ClientOptions &SetClientPrivateKey(std::string client_cert_chain)#

Sets a PEM-encoded private key for the client certificate chain when using mutual TLS.

Parameters:

pem – a PEM encoded private key.

Returns:

*this, to be used for chaining

ClientOptions &AddExtraHeader(std::string header_name, std::string header_value)#

Adds an extra header with a constant name and value to be sent with every outgoing server request.

Parameters:
  • header_name – The header name

  • header_value – The header value

Returns:

*this, to be used for chaining

inline const std::string &AuthorizationValue() const#

Returns the value for the authorization header that will be sent to the server on the first request; this value is a function of the authentication method selected.

Returns:

A string value for the authorization header

inline bool UseTls() const#

Returns true if server connections should be configured for TLS/SSL.

Returns:

true if this connection should be TLS/SSL, false for insecure.

inline const std::string &TlsRootCerts() const#

The PEM-encoded certificate root for server connections, or the empty string if using system defaults.

Returns:

A PEM-encoded certificate chain, or empty.

inline const std::string &ClientCertChain() const#

The PEM-encoded certificate chain to use for the client when using mutual TLS, or the empty string for no mutual TLS.

Returns:

A PEM-encoded certificate chain, or empty.

inline const std::string &ClientPrivateKey() const#

The PEM-encoded client private key to use for mutual TLS.

Returns:

A PEM-encoded private key, or empty.

inline const int_options_t &IntOptions() const#

Integer-valued channel options set for server connections.

Returns:

A vector of pairs of string option name and integer option value

inline const string_options_t &StringOptions() const#

String-valued channel options set for server connections.

Returns:

A vector of pairs of string option name and string option value

inline const extra_headers_t &ExtraHeaders() const#

Extra headers that should be sent with each outgoing server request.

Returns:

A vector of pairs of string header name and string header value