Couchbase C++ SDK 1.0.4 (rev. 5355b0f)
Loading...
Searching...
No Matches
bucket_manager.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
22#include <couchbase/error.hxx>
27
28#include <future>
29#include <memory>
30
31#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
32namespace couchbase
33{
34namespace core
35{
36class cluster;
37} // namespace core
38class bucket_manager_impl;
39} // namespace couchbase
40#endif
41
42namespace couchbase
43{
44class cluster;
45
47{
48public:
59 void get_bucket(std::string bucket_name,
60 const get_bucket_options& options,
61 get_bucket_handler&& handler) const;
62
63 [[nodiscard]] auto get_bucket(std::string bucket_name, const get_bucket_options& options = {})
64 const -> std::future<std::pair<error, management::cluster::bucket_settings>>;
65
76 get_all_buckets_handler&& handler) const;
77
78 [[nodiscard]] auto get_all_buckets(const get_all_buckets_options& options = {}) const
79 -> std::future<std::pair<error, std::vector<management::cluster::bucket_settings>>>;
80
89 const create_bucket_options& options,
90 create_bucket_handler&& handler) const;
91
92 [[nodiscard]] auto create_bucket(const management::cluster::bucket_settings& bucket_settings,
93 const create_bucket_options& options = {}) const
94 -> std::future<error>;
95
104 const update_bucket_options& options,
105 update_bucket_handler&& handler) const;
106
107 [[nodiscard]] auto update_bucket(const management::cluster::bucket_settings& bucket_settings,
108 const update_bucket_options& options = {}) const
109 -> std::future<error>;
110
118 void drop_bucket(std::string bucket_name,
119 const drop_bucket_options& options,
120 drop_bucket_handler&& handler) const;
121
122 [[nodiscard]] auto drop_bucket(std::string bucket_name, const drop_bucket_options& options = {})
123 const -> std::future<error>;
124
132 void flush_bucket(std::string bucket_name,
133 const flush_bucket_options& options,
134 flush_bucket_handler&& handler) const;
135
136 [[nodiscard]] auto flush_bucket(std::string bucket_name, const flush_bucket_options& options = {})
137 const -> std::future<error>;
138
139private:
140 friend class cluster;
141
142 explicit bucket_manager(core::cluster core);
143
144 std::shared_ptr<bucket_manager_impl> impl_;
145};
146} // namespace couchbase
Definition bucket_manager.hxx:47
void create_bucket(const management::cluster::bucket_settings &bucket_settings, const create_bucket_options &options, create_bucket_handler &&handler) const
Create a bucket on the cluster.
void get_all_buckets(const get_all_buckets_options &options, get_all_buckets_handler &&handler) const
Get all buckets on the cluster.
auto get_bucket(std::string bucket_name, const get_bucket_options &options={}) const -> std::future< std::pair< error, management::cluster::bucket_settings > >
void get_bucket(std::string bucket_name, const get_bucket_options &options, get_bucket_handler &&handler) const
Get specific bucket within the cluster.
void drop_bucket(std::string bucket_name, const drop_bucket_options &options, drop_bucket_handler &&handler) const
Drop an existing bucket.
auto create_bucket(const management::cluster::bucket_settings &bucket_settings, const create_bucket_options &options={}) const -> std::future< error >
auto update_bucket(const management::cluster::bucket_settings &bucket_settings, const update_bucket_options &options={}) const -> std::future< error >
auto drop_bucket(std::string bucket_name, const drop_bucket_options &options={}) const -> std::future< error >
auto flush_bucket(std::string bucket_name, const flush_bucket_options &options={}) const -> std::future< error >
void update_bucket(const management::cluster::bucket_settings &bucket_settings, const update_bucket_options &options, update_bucket_handler &&handler) const
Update an existing bucket.
auto get_all_buckets(const get_all_buckets_options &options={}) const -> std::future< std::pair< error, std::vector< management::cluster::bucket_settings > > >
void flush_bucket(std::string bucket_name, const flush_bucket_options &options, flush_bucket_handler &&handler) const
Flush an existing bucket.
The cluster is the main entry point when connecting to a Couchbase cluster.
Definition cluster.hxx:60
Definition error.hxx:30
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28
std::function< void(error)> drop_bucket_handler
Definition drop_bucket_options.hxx:40
std::function< void(error)> flush_bucket_handler
Definition flush_bucket_options.hxx:38
std::function< void(error, management::cluster::bucket_settings)> get_bucket_handler
Definition get_bucket_options.hxx:41
std::function< void(error, std::vector< management::cluster::bucket_settings >)> get_all_buckets_handler
Definition get_all_buckets_options.hxx:41
std::function< void(error)> update_bucket_handler
Definition update_bucket_options.hxx:40
std::function< void(error)> create_bucket_handler
Definition create_bucket_options.hxx:40
Definition create_bucket_options.hxx:27
Definition drop_bucket_options.hxx:27
Definition flush_bucket_options.hxx:25
Definition get_all_buckets_options.hxx:28
Definition get_bucket_options.hxx:28
Definition bucket_settings.hxx:113
Definition update_bucket_options.hxx:27