19 #include <couchbase/support.hxx> 39 template<
typename T>
class pool;
44 class bucket :
public std::enable_shared_from_this<bucket>
50 std::unique_ptr<pool<lcb_st*>> instance_pool_;
51 const std::string name_;
52 std::vector<std::shared_ptr<class collection> > collections_;
53 std::shared_ptr<class collection> find_or_create_collection(
const std::string&
name);
55 std::chrono::microseconds kv_timeout_;
57 bucket(std::unique_ptr<pool<lcb_st*>>& instance_pool,
const std::string&
name, std::chrono::microseconds kv_timeout);
59 static const std::string default_name;
74 CB_NODISCARD std::shared_ptr<class collection>
collection(
const std::string&
name);
83 CB_NODISCARD
const std::string&
name()
const 141 template<
typename OStream>
145 os <<
"name: " << b.
name() <<
",";
146 os <<
"instance_pool: " << *b.instance_pool_;
151 CB_NODISCARD
bool operator==(
const bucket& b)
const Exposes bucket-level operations and collections accessors.
Definition: bucket.hxx:45
CB_NODISCARD size_t available_instances() const
return the current number of libcouchbase instances that are not being used.
Definition: bucket.hxx:33
void close()
Close connection to this bucket.
CB_NODISCARD size_t max_instances() const
return maximum number of libcouchbase instances this bucket can use
CB_NODISCARD size_t instances() const
return current number of libcouchbase instances the cluster has created.
~bucket()
Destroy the bucket.
CB_NODISCARD std::shared_ptr< class collection > default_collection()
Connects to a couchbase cluster, exposes cluster operations and bucket accessors. ...
Definition: cluster.hxx:172
CB_NODISCARD std::chrono::microseconds default_kv_timeout() const
return default kv timeout
CB_NODISCARD const std::string & name() const
Get collection name.
Definition: bucket.hxx:84
friend OStream & operator<<(OStream &os, const bucket &b)
convienence method to allow outputtng information about the bucket to an ostream or similar...
Definition: bucket.hxx:143
Exposes collection-level kv operations.
Definition: collection.hxx:46