Kudu C++ client API
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
kudu::client::KuduClientBuilder Class Reference

A "factory" for KuduClient objects. More...

#include <client.h>

Public Types

enum  EncryptionPolicy { OPTIONAL , REQUIRED_REMOTE , REQUIRED }
 Policy for on-the-wire encryption. More...
 

Public Member Functions

KuduClientBuilderclear_master_server_addrs ()
 
KuduClientBuildermaster_server_addrs (const std::vector< std::string > &addrs)
 
KuduClientBuilderadd_master_server_addr (const std::string &addr)
 
KuduClientBuilderdefault_admin_operation_timeout (const MonoDelta &timeout)
 
KuduClientBuilderdefault_rpc_timeout (const MonoDelta &timeout)
 
KuduClientBuilderconnection_negotiation_timeout (const MonoDelta &timeout)
 
KuduClientBuilderjwt (const std::string &jwt)
 
KuduClientBuilderimport_authentication_credentials (std::string authn_creds)
 
KuduClientBuildertrusted_certificate (const std::string &cert_pem)
 
KuduClientBuildernum_reactors (int num_reactors)
 Set the number of reactors for the RPC messenger.
 
KuduClientBuildersasl_protocol_name (const std::string &sasl_protocol_name)
 
KuduClientBuilderrequire_authentication (bool require_authentication)
 
KuduClientBuilderencryption_policy (EncryptionPolicy encryption_policy)
 
Status Build (sp::shared_ptr< KuduClient > *client)
 

Detailed Description

A "factory" for KuduClient objects.

This class is used to create instances of the KuduClient class with pre-set options/parameters.

Member Enumeration Documentation

◆ EncryptionPolicy

Policy for on-the-wire encryption.

Enumerator
OPTIONAL 

Optional, it uses encrypted connection if the server supports it, but it can connect to insecure servers too.

REQUIRED_REMOTE 

Only connects to remote servers that support encryption, fails otherwise. It can connect to insecure servers only locally.

REQUIRED 

Only connects to any server, including on the loopback interface, that support encryption, fails otherwise.

Member Function Documentation

◆ add_master_server_addr()

KuduClientBuilder & kudu::client::KuduClientBuilder::add_master_server_addr ( const std::string &  addr)

Add an RPC address of a master to work with.

At least one master is required.

Parameters
[in]addrRPC address of master server to add.
Returns
Reference to the updated object.

◆ Build()

Status kudu::client::KuduClientBuilder::Build ( sp::shared_ptr< KuduClient > *  client)

Create a client object.

Note
KuduClients objects are shared amongst multiple threads and, as such, are stored in shared pointers.
Parameters
[out]clientThe newly created object wrapped in a shared pointer.
Returns
Operation status. The return value may indicate an error in the create operation, or a misuse of the builder; in the latter case, only the last error is returned.

◆ clear_master_server_addrs()

KuduClientBuilder & kudu::client::KuduClientBuilder::clear_master_server_addrs ( )

Clear the set of master addresses.

Returns
Reference to the updated object.

◆ connection_negotiation_timeout()

KuduClientBuilder & kudu::client::KuduClientBuilder::connection_negotiation_timeout ( const MonoDelta timeout)

Set the timeout for negotiating a connection to a remote server.

If not provided, the underlying messenger is created with reasonable default. The result value could be retrieved using KuduClient.connection_negotiation_timeout() after an instance of KuduClient is created. Sometimes it makes sense to customize the timeout for connection negotiation, e.g. when running on a cluster with heavily loaded tablet servers. For details on the connection negotiation, see ../../../docs/design-docs/rpc.md::negotiation.

Parameters
[in]timeoutTimeout value to set.
Returns
Reference to the updated object.

◆ default_admin_operation_timeout()

KuduClientBuilder & kudu::client::KuduClientBuilder::default_admin_operation_timeout ( const MonoDelta timeout)

Set the default timeout for administrative operations.

Using this method it is possible to modify the default timeout for operations like CreateTable, AlterTable, etc. By default it is 30 seconds.

Parameters
[in]timeoutTimeout value to set.
Returns
Reference to the updated object.

◆ default_rpc_timeout()

KuduClientBuilder & kudu::client::KuduClientBuilder::default_rpc_timeout ( const MonoDelta timeout)

Set the default timeout for individual RPCs.

If not provided, defaults to 10 seconds.

Parameters
[in]timeoutTimeout value to set.
Returns
Reference to the updated object.

◆ encryption_policy()

KuduClientBuilder & kudu::client::KuduClientBuilder::encryption_policy ( EncryptionPolicy  encryption_policy)

Require encryption for the connection to a remote server.

If it's set to REQUIRED_REMOTE or REQUIRED, the client will require encrypting the traffic between the server and the client. If the server doesn't support encryption, or if it's disabled, the client will fail to connect.

Loopback connections are encrypted only if 'encryption_policy' is set to REQUIRED, or if it's required by the server.

The default value is OPTIONAL, which allows connecting to servers without encryption as well, but it will still attempt to use it if the server supports it.

Parameters
[in]encryption_policyWhich encryption policy to use.
Returns
Reference to the updated object.

◆ import_authentication_credentials()

KuduClientBuilder & kudu::client::KuduClientBuilder::import_authentication_credentials ( std::string  authn_creds)

Import serialized authentication credentials from another client.

Note
If both import_authentication_credentials and this method are called on the object, the JWT provided with this call overrides the corresponding JWT (if present) that comes as part of the imported authentication credentials.
Parameters
[in]authn_credsThe serialized authentication credentials, provided by a call to KuduClient.ExportAuthenticationCredentials in the C++ client or KuduClient::exportAuthenticationCredentials in the Java client.
Returns
Reference to the updated object.

◆ jwt()

KuduClientBuilder & kudu::client::KuduClientBuilder::jwt ( const std::string &  jwt)

Set JWT (JSON Web Token) to authenticate the client to a server.

Note
If both import_authentication_credentials and this method are called on the object, the JWT provided with this call overrides the corresponding JWT (if present) that comes as part of the imported authentication credentials.
Parameters
[in]jwtThe JSON web token to set.
Returns
Reference to the updated object.

◆ master_server_addrs()

KuduClientBuilder & kudu::client::KuduClientBuilder::master_server_addrs ( const std::vector< std::string > &  addrs)

Add RPC addresses of multiple masters.

Parameters
[in]addrsRPC addresses of masters to add.
Returns
Reference to the updated object.

◆ num_reactors()

KuduClientBuilder & kudu::client::KuduClientBuilder::num_reactors ( int  num_reactors)

Set the number of reactors for the RPC messenger.

The reactor threads are used for sending and receiving. If not provided, the underlying messenger is created with the default number of reactor threads.

Parameters
[in]num_reactorsNumber of reactors to set.
Returns
Reference to the updated object.

◆ require_authentication()

KuduClientBuilder & kudu::client::KuduClientBuilder::require_authentication ( bool  require_authentication)

Require authentication for the connection to a remote server.

If it's set to true, the client will require mutual authentication between the server and the client. If the server doesn't support authentication, or it's disabled, the client will fail to connect.

Parameters
[in]require_authenticationWhether to require authentication.
Returns
Reference to the updated object.

◆ sasl_protocol_name()

KuduClientBuilder & kudu::client::KuduClientBuilder::sasl_protocol_name ( const std::string &  sasl_protocol_name)

Set the SASL protocol name for the connection to a remote server.

If the servers use a non-default Kerberos service principal name (other than "kudu" or "kudu/<hostname>", this needs to be set for the client to be able to connect to the servers. If unset, the client will assume the server is using the default service principal.

Parameters
[in]sasl_protocol_nameSASL protocol name.
Returns
Reference to the updated object.

◆ trusted_certificate()

KuduClientBuilder & kudu::client::KuduClientBuilder::trusted_certificate ( const std::string &  cert_pem)

Add a trusted root CA certificate into the client's TLS certificate bundle.

Parameters
[in]cert_pemThe trusted certificate to add, in PEM format.
Returns
Reference to the updated object.

The documentation for this class was generated from the following file: