Couchbase Transactions C++ Client
1.0.0
Transactions client for couchbase
|
Connects to a couchbase cluster, exposes cluster operations and bucket accessors. More...
#include <cluster.hxx>
Public Member Functions | |
cluster (std::string cluster_address, std::string user_name, std::string password, const cluster_options &opts=cluster_options()) | |
Create a new cluster and connect to it. More... | |
cluster (const cluster &cluster) | |
Copy cluster. More... | |
~cluster () | |
Destroy a cluster. More... | |
CB_NODISCARD std::list< std::string > | buckets () |
List buckets in this cluster. More... | |
CB_NODISCARD std::shared_ptr< class bucket > | bucket (const std::string &name) |
Open a connection to a bucket. More... | |
CB_NODISCARD const std::string | cluster_address () const |
return the cluster address More... | |
CB_NODISCARD size_t | max_instances () const |
return maximum number of libcouchbase instances this cluster can use More... | |
CB_NODISCARD size_t | instances () const |
return current number of libcouchbase instances the cluster has created. More... | |
CB_NODISCARD size_t | available_instances () const |
return the current number of libcouchbase instances that are not being used. More... | |
CB_NODISCARD std::chrono::microseconds | default_kv_timeout () const |
Default kv timeout. More... | |
CB_NODISCARD bool | operator== (const couchbase::cluster &other) const |
compare two clusters for equality | |
Connects to a couchbase cluster, exposes cluster operations and bucket accessors.
|
explicit |
Create a new cluster and connect to it.
For now we are only connecting with a username and password, but this will be expanded to include ssl, with or without cert verification, soon
cluster_address | Address of the cluster, say couchbase://1.2.3.4 |
user_name | User name to use for this connection. |
password | Password for this user. |
opts | Options for this cluster. |
couchbase::cluster::cluster | ( | const cluster & | cluster | ) |
Copy cluster.
Creates a copy of the cluster, and connects.
cluster | The cluster to copy. |
couchbase::cluster::~cluster | ( | ) |
Destroy a cluster.
Calls shutdown if necessary, and deletes the underlying connection to the cluster.
CB_NODISCARD size_t couchbase::cluster::available_instances | ( | ) | const |
return the current number of libcouchbase instances that are not being used.
CB_NODISCARD std::shared_ptr<class bucket> couchbase::cluster::bucket | ( | const std::string & | name | ) |
Open a connection to a bucket.
This returns a shared pointer to a bucket.
name | Name of the bucket to connect to. |
CB_NODISCARD std::list<std::string> couchbase::cluster::buckets | ( | ) |
List buckets in this cluster.
Returns a list of the names of all the buckets in this cluster.
|
inline |
return the cluster address
Helpful for debugging/logging. Perhaps this will go away in favor of an operator<< which is a bit more useful.
CB_NODISCARD std::chrono::microseconds couchbase::cluster::default_kv_timeout | ( | ) | const |
Default kv timeout.
CB_NODISCARD size_t couchbase::cluster::instances | ( | ) | const |
return current number of libcouchbase instances the cluster has created.
CB_NODISCARD size_t couchbase::cluster::max_instances | ( | ) | const |
return maximum number of libcouchbase instances this cluster can use
The cluster maintains a pool of instances, lazily created, which it uses to communicate with the server. Each instance will maintain a number of socket connections. Any cluster calls that need an instance will use one, making it unavailable until the call is done with it. See cluster_options to set this value.