Couchbase C++ SDK 1.4.0 (rev. 59aa900)
Loading...
Searching...
No Matches
bucket.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright 2020-Present Couchbase, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
23#include <couchbase/scope.hxx>
25
26#include <chrono>
27#include <memory>
28
29namespace couchbase
30{
31#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
32namespace core
33{
34class cluster;
35} // namespace core
36class cluster;
37class bucket_impl;
38namespace crypto
39{
40class manager;
41} // namespace crypto
42#endif
43
50class bucket
51{
52public:
61 [[nodiscard]] auto default_scope() const -> scope;
62
71 [[nodiscard]] auto default_collection() const -> collection;
72
82 [[nodiscard]] auto scope(std::string_view scope_name) const -> scope;
83
101 void ping(const ping_options& options, ping_handler&& handler) const;
102
120 [[nodiscard]] auto ping(const ping_options& options = {}) const
121 -> std::future<std::pair<error, ping_result>>;
122
140 void wait_until_ready(std::chrono::milliseconds timeout,
141 const wait_until_ready_options& options,
142 wait_until_ready_handler&& handler) const;
143
157 [[nodiscard]] auto wait_until_ready(std::chrono::milliseconds timeout,
158 const wait_until_ready_options& options = {}) const
159 -> std::future<error>;
160
169 [[nodiscard]] auto collections() const -> collection_manager;
170
171private:
172 friend cluster;
173
174 bucket(core::cluster core, std::string_view name, std::shared_ptr<crypto::manager>);
175
176 std::shared_ptr<bucket_impl> impl_;
177};
178} // namespace couchbase
auto default_collection() const -> collection
Opens the default collection for this bucket using the default scope.
void wait_until_ready(std::chrono::milliseconds timeout, const wait_until_ready_options &options, wait_until_ready_handler &&handler) const
Waits until the desired state of the bucket is reached, actively pinging its services until they resp...
auto scope(std::string_view scope_name) const -> scope
Opens the scope with the given name.
auto wait_until_ready(std::chrono::milliseconds timeout, const wait_until_ready_options &options={}) const -> std::future< error >
Waits until the desired state of the bucket is reached.
auto default_scope() const -> scope
Opens default scope.
auto collections() const -> collection_manager
Provides access to the collection management services.
void ping(const ping_options &options, ping_handler &&handler) const
Performs application-level ping requests against services in the Couchbase cluster.
The cluster is the main entry point when connecting to a Couchbase cluster.
Definition cluster.hxx:62
Definition collection_manager.hxx:47
The collection provides access to all collection APIs.
Definition collection.hxx:76
Definition expiry.hxx:24
Definition internal.hxx:27
Represents a single item from the result of scan().
Definition allow_querying_search_index_options.hxx:28
@ timeout
Definition analytics_status.hxx:34
std::function< void(error, ping_result)> ping_handler
Definition ping_options.hxx:93
std::function< void(error)> wait_until_ready_handler
The signature for the handler of the cluster::wait_until_ready() and bucket::wait_until_ready() opera...
Definition wait_until_ready_options.hxx:110
Definition ping_options.hxx:32
Options for wait_until_ready() and wait_until_ready().
Definition wait_until_ready_options.hxx:36