Couchbase C++ SDK 1.0.4 (rev. 5355b0f)
Loading...
Searching...
No Matches
collection_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
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 collection_manager_impl;
39} // namespace couchbase
40#endif
41
42namespace couchbase
43{
44class bucket;
45
47{
48public:
58 get_all_scopes_handler&& handler) const;
59
60 [[nodiscard]] auto get_all_scopes(const get_all_scopes_options& options = {}) const
61 -> std::future<std::pair<error, std::vector<management::bucket::scope_spec>>>;
62
74 void create_collection(std::string scope_name,
75 std::string collection_name,
76 const create_collection_settings& settings,
77 const create_collection_options& options,
78 create_collection_handler&& handler) const;
79
80 [[nodiscard]] auto create_collection(std::string scope_name,
81 std::string collection_name,
82 const create_collection_settings& settings = {},
83 const create_collection_options& options = {}) const
84 -> std::future<error>;
96 void update_collection(std::string scope_name,
97 std::string collection_name,
98 const update_collection_settings& settings,
99 const update_collection_options& options,
100 update_collection_handler&& handler) const;
101
102 [[nodiscard]] auto update_collection(std::string scope_name,
103 std::string collection_name,
104 const update_collection_settings& settings,
105 const update_collection_options& options = {}) const
106 -> std::future<error>;
107
118 void drop_collection(std::string scope_name,
119 std::string collection_name,
120 const drop_collection_options& options,
121 drop_collection_handler&& handler) const;
122
123 [[nodiscard]] auto drop_collection(std::string scope_name,
124 std::string collection_name,
125 const drop_collection_options& options = {}) const
126 -> std::future<error>;
127
137 void create_scope(std::string scope_name,
138 const create_scope_options& options,
139 create_scope_handler&& handler) const;
140
141 [[nodiscard]] auto create_scope(std::string scope_name, const create_scope_options& options = {})
142 const -> std::future<error>;
143
153 void drop_scope(std::string scope_name,
154 const drop_scope_options& options,
155 drop_scope_handler&& handler) const;
156
157 [[nodiscard]] auto drop_scope(std::string scope_name,
158 const drop_scope_options& options = {}) const -> std::future<error>;
159
160private:
161 friend class bucket;
162
163 collection_manager(core::cluster core, std::string_view bucket_name);
164
165 std::shared_ptr<collection_manager_impl> impl_;
166};
167} // namespace couchbase
Provides access to Couchbase bucket.
Definition bucket.hxx:45
Definition collection_manager.hxx:47
auto create_scope(std::string scope_name, const create_scope_options &options={}) const -> std::future< error >
void get_all_scopes(const get_all_scopes_options &options, get_all_scopes_handler &&handler) const
Get all scopes on the bucket.
void drop_collection(std::string scope_name, std::string collection_name, const drop_collection_options &options, drop_collection_handler &&handler) const
Drops a collection.
auto drop_collection(std::string scope_name, std::string collection_name, const drop_collection_options &options={}) const -> std::future< error >
void create_scope(std::string scope_name, const create_scope_options &options, create_scope_handler &&handler) const
Creates a scope on the bucket.
void create_collection(std::string scope_name, std::string collection_name, const create_collection_settings &settings, const create_collection_options &options, create_collection_handler &&handler) const
Creates a new collection.
auto drop_scope(std::string scope_name, const drop_scope_options &options={}) const -> std::future< error >
auto create_collection(std::string scope_name, std::string collection_name, const create_collection_settings &settings={}, const create_collection_options &options={}) const -> std::future< error >
auto update_collection(std::string scope_name, std::string collection_name, const update_collection_settings &settings, const update_collection_options &options={}) const -> std::future< error >
auto get_all_scopes(const get_all_scopes_options &options={}) const -> std::future< std::pair< error, std::vector< management::bucket::scope_spec > > >
void drop_scope(std::string scope_name, const drop_scope_options &options, drop_scope_handler &&handler) const
Drops a scope on the bucket.
void update_collection(std::string scope_name, std::string collection_name, const update_collection_settings &settings, const update_collection_options &options, update_collection_handler &&handler) const
Updates an existing collection.
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_collection_handler
Definition drop_collection_options.hxx:40
std::function< void(error)> create_scope_handler
Definition create_scope_options.hxx:40
std::function< void(error, std::vector< management::bucket::scope_spec >)> get_all_scopes_handler
Definition get_all_scopes_options.hxx:42
std::function< void(error)> drop_scope_handler
Definition drop_scope_options.hxx:40
std::function< void(error)> update_collection_handler
Definition update_collection_options.hxx:73
std::function< void(error)> create_collection_handler
Definition create_collection_options.hxx:73
Definition create_collection_options.hxx:28
The settings to use when creating the collection.
Definition create_collection_options.hxx:59
Definition create_scope_options.hxx:27
Definition drop_collection_options.hxx:27
Definition drop_scope_options.hxx:27
Definition get_all_scopes_options.hxx:29
Definition update_collection_options.hxx:28
The settings that should be updated for the collection.
Definition update_collection_options.hxx:59