Couchbase C++ SDK 1.0.2 (rev. 51f4775)
Loading...
Searching...
No Matches
cluster Class Reference

The cluster is the main entry point when connecting to a Couchbase cluster. More...

#include <couchbase/cluster.hxx>

Public Member Functions

 cluster ()=default
 
 cluster (const cluster &other)=default
 
 cluster (cluster &&other)=default
 
 ~cluster ()=default
 
auto operator= (const cluster &other) -> cluster &=default
 
auto operator= (cluster &&other) -> cluster &=default
 
void notify_fork (fork_event event)
 
void close (std::function< void()> &&handler)
 
auto close () -> std::future< void >
 
auto bucket (std::string_view bucket_name) const -> bucket
 Opens a bucket with the given name.
 
void query (std::string statement, const query_options &options, query_handler &&handler) const
 Performs a query against the query (N1QL) services.
 
auto query (std::string statement, const query_options &options) const -> std::future< std::pair< error, query_result > >
 Performs a query against the query (N1QL) services.
 
void search (std::string index_name, search_request request, const search_options &options, search_handler &&handler) const
 Performs a request against the full text search services.
 
auto search (std::string index_name, search_request request, const search_options &options={}) const -> std::future< std::pair< error, search_result > >
 Performs a request against the full text search services.
 
void analytics_query (std::string statement, const analytics_options &options, analytics_handler &&handler) const
 Performs a query against the analytics services.
 
auto analytics_query (std::string statement, const analytics_options &options={}) const -> std::future< std::pair< error, analytics_result > >
 Performs a query against the analytics services.
 
void ping (const ping_options &options, ping_handler &&handler) const
 Performs application-level ping requests against services in the Couchbase cluster.
 
auto ping (const ping_options &options={}) const -> std::future< std::pair< error, ping_result > >
 Performs application-level ping requests against services in the Couchbase cluster.
 
void diagnostics (const diagnostics_options &options, diagnostics_handler &&handler) const
 Assembles a diagnostics report on the current state of the cluster from the SDK's point of view.
 
auto diagnostics (const diagnostics_options &options={}) const -> std::future< std::pair< error, diagnostics_result > >
 Assembles a diagnostics report on the current state of the cluster from the SDK's point of view.
 
auto query_indexes () const -> query_index_manager
 Provides access to the N1QL index management services.
 
auto analytics_indexes () const -> analytics_index_manager
 Provides access ot the Analytics index management services.
 
auto buckets () const -> bucket_manager
 Provides access to the bucket management services.
 
auto search_indexes () const -> search_index_manager
 Provides access to search index management services.
 
auto transactions () const -> std::shared_ptr< couchbase::transactions::transactions >
 Provides access to transaction services.
 

Static Public Member Functions

static void connect (const std::string &connection_string, const cluster_options &options, cluster_connect_handler &&handler)
 Connect to a Couchbase cluster.
 
static auto connect (const std::string &connection_string, const cluster_options &options) -> std::future< std::pair< error, cluster > >
 Connect to a Couchbase cluster.
 

Detailed Description

The cluster is the main entry point when connecting to a Couchbase cluster.

Since
1.0.0
Committed
Generally available API and should be preferred in production
Examples
async_game_server.cxx, and game_server.cxx.

Constructor & Destructor Documentation

◆ cluster() [1/3]

cluster ( )
default

◆ cluster() [2/3]

cluster ( const cluster & other)
default

◆ cluster() [3/3]

cluster ( cluster && other)
default

◆ ~cluster()

~cluster ( )
default

Member Function Documentation

◆ analytics_indexes()

auto analytics_indexes ( ) const -> analytics_index_manager
nodiscard

Provides access ot the Analytics index management services.

Returns
a manager instance
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ analytics_query() [1/2]

void analytics_query ( std::string statement,
const analytics_options & options,
analytics_handler && handler ) const

Performs a query against the analytics services.

Parameters
statementthe query statement.
optionsoptions to customize the query request.
handlerthe handler that implements query_handler
Exceptions
errc::common::ambiguous_timeout
errc::common::unambiguous_timeout
See also
https://docs.couchbase.com/server/current/analytics/introduction.html
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ analytics_query() [2/2]

auto analytics_query ( std::string statement,
const analytics_options & options = {} ) const -> std::future< std::pair< error, analytics_result > >
nodiscard

Performs a query against the analytics services.

Parameters
statementthe query statement.
optionsoptions to customize the query request.
Returns
future object that carries result of the operation
See also
https://docs.couchbase.com/server/current/analytics/introduction.html
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ bucket()

auto bucket ( std::string_view bucket_name) const -> bucket
nodiscard

Opens a bucket with the given name.

Parameters
bucket_namethe name of the bucket to open.
Returns
a bucket once opened.
Since
1.0.0
Committed
Generally available API and should be preferred in production
Examples
async_game_server.cxx, and game_server.cxx.

◆ buckets()

auto buckets ( ) const -> bucket_manager
nodiscard

Provides access to the bucket management services.

Returns
a manager instance
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ close() [1/2]

auto close ( ) -> std::future< void >
nodiscard

◆ close() [2/2]

void close ( std::function< void()> && handler)

◆ connect() [1/2]

static auto connect ( const std::string & connection_string,
const cluster_options & options ) -> std::future< std::pair< error, cluster > >
staticnodiscard

Connect to a Couchbase cluster.

Parameters
connection_stringconnection string used to locate the Couchbase cluster object.
optionsoptions to customize connection (note, that connection_string takes precedence over this options).
Returns
future object that carries cluster object and operation status
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ connect() [2/2]

static void connect ( const std::string & connection_string,
const cluster_options & options,
cluster_connect_handler && handler )
static

Connect to a Couchbase cluster.

Parameters
connection_stringconnection string used to locate the Couchbase cluster object.
optionsoptions to customize connection (note, that connection_string takes precedence over this options).
handlerthe handler
Since
1.0.0
Committed
Generally available API and should be preferred in production
Examples
async_game_server.cxx, distributed_mutex.cxx, game_server.cxx, and minimal.cxx.

◆ diagnostics() [1/2]

void diagnostics ( const diagnostics_options & options,
diagnostics_handler && handler ) const

Assembles a diagnostics report on the current state of the cluster from the SDK's point of view.

Note
This operation does not perform any I/O to produce the report. It will only use the current known state of the cluster to assemble the report So, if for example, no SQL++ queries have been run, the Query service's socket pool might be empty and as a result not show up in the report. If you wish to actively assess the health of the cluster by performing I/O, consider using ping() instead.
Parameters
optionscustom options to change the default behavior.
handlerthe handler that implements diagnostics_handler.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ diagnostics() [2/2]

auto diagnostics ( const diagnostics_options & options = {}) const -> std::future< std::pair< error, diagnostics_result > >
nodiscard

Assembles a diagnostics report on the current state of the cluster from the SDK's point of view.

Note
This operation does not perform any I/O to produce the report. It will only use the current known state of the cluster to assemble the report So, if for example, no SQL++ queries have been run, the Query service's socket pool might be empty and as a result not show up in the report. If you wish to actively assess the health of the cluster by performing I/O, consider using ping() instead.
Parameters
optionscustom options to change the default behavior.
Returns
future object that carries result of the operation.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ notify_fork()

void notify_fork ( fork_event event)

◆ operator=() [1/2]

auto operator= ( cluster && other) -> cluster &=default
default

◆ operator=() [2/2]

auto operator= ( const cluster & other) -> cluster &=default
default

◆ ping() [1/2]

void ping ( const ping_options & options,
ping_handler && handler ) const

Performs application-level ping requests against services in the Couchbase cluster.

Note
This operation performs active I/O against services and endpoints to assess their health. If you do not wish to performs I/O, consider using diagnostics() instead.
Parameters
optionscustom options to change the default behavior.
handlerthe handler that implements ping_handler.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ ping() [2/2]

auto ping ( const ping_options & options = {}) const -> std::future< std::pair< error, ping_result > >
nodiscard

Performs application-level ping requests against services in the Couchbase cluster.

Note
This operation performs active I/O against services and endpoints to assess their health. If you do not wish to performs I/O, consider using diagnostics() instead.
Parameters
optionscustom options to change the default behavior.
Returns
future object that carries result of the operation.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ query() [1/2]

auto query ( std::string statement,
const query_options & options ) const -> std::future< std::pair< error, query_result > >
nodiscard

Performs a query against the query (N1QL) services.

Parameters
statementthe N1QL query statement.
optionsoptions to customize the query request.
Returns
future object that carries result of the operation
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ query() [2/2]

void query ( std::string statement,
const query_options & options,
query_handler && handler ) const

Performs a query against the query (N1QL) services.

Parameters
statementthe N1QL query statement.
optionsoptions to customize the query request.
handlerthe handler that implements query_handler
Exceptions
errc::common::ambiguous_timeout
errc::common::unambiguous_timeout
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ query_indexes()

auto query_indexes ( ) const -> query_index_manager
nodiscard

Provides access to the N1QL index management services.

Returns
a manager instance
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ search() [1/2]

void search ( std::string index_name,
search_request request,
const search_options & options,
search_handler && handler ) const

Performs a request against the full text search services.

This can be used to perform a traditional FTS query, and/or a vector search.

Parameters
index_namename of the search index
requestrequest object, see search_request for more details.
optionsoptions to customize the query request.
handlerthe handler that implements search_handler
Exceptions
errc::common::ambiguous_timeout
errc::common::unambiguous_timeout
See also
https://docs.couchbase.com/server/current/fts/fts-introduction.html
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ search() [2/2]

auto search ( std::string index_name,
search_request request,
const search_options & options = {} ) const -> std::future< std::pair< error, search_result > >
nodiscard

Performs a request against the full text search services.

This can be used to perform a traditional FTS query, and/or a vector search.

Parameters
index_namename of the search index
requestrequest object, see search_request for more details.
optionsoptions to customize the query request.
Returns
future object that carries result of the operation
Exceptions
errc::common::ambiguous_timeout
errc::common::unambiguous_timeout
See also
https://docs.couchbase.com/server/current/fts/fts-introduction.html
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ search_indexes()

auto search_indexes ( ) const -> search_index_manager
nodiscard

Provides access to search index management services.

Returns
a manager instance
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ transactions()

auto transactions ( ) const -> std::shared_ptr< couchbase::transactions::transactions >
nodiscard

Provides access to transaction services.

See transactions for details on using the transactions object.

Returns
an transactions object
Since
1.0.0
Committed
Generally available API and should be preferred in production

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