Couchbase C++ SDK 1.0.1 (rev. 58d46d7)
Loading...
Searching...
No Matches
collection_query_index_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 query_index_manager_impl;
39} // namespace couchbase
40#endif
41
42namespace couchbase
43{
44class collection;
45
53{
54public:
65 get_all_query_indexes_handler&& handler) const;
66
76 [[nodiscard]] auto get_all_indexes(const get_all_query_indexes_options& options) const
77 -> std::future<std::pair<error, std::vector<couchbase::management::query_index>>>;
78
90 void create_index(std::string index_name,
91 std::vector<std::string> keys,
92 const create_query_index_options& options,
93 create_query_index_handler&& handler) const;
94
106 [[nodiscard]] auto create_index(std::string index_name,
107 std::vector<std::string> keys,
108 const create_query_index_options& options) const
109 -> std::future<error>;
110
121 create_primary_query_index_handler&& handler) const;
122
132 [[nodiscard]] auto create_primary_index(const create_primary_query_index_options& options) const
133 -> std::future<error>;
134
145 drop_primary_query_index_handler&& handler) const;
146
156 [[nodiscard]] auto drop_primary_index(const drop_primary_query_index_options& options) const
157 -> std::future<error>;
158
169 void drop_index(std::string index_name,
170 const drop_query_index_options& options,
171 drop_query_index_handler&& handler) const;
172
183 [[nodiscard]] auto drop_index(std::string index_name, const drop_query_index_options& options)
184 const -> std::future<error>;
185
199
211 [[nodiscard]] auto build_deferred_indexes(const build_query_index_options& options) const
212 -> std::future<error>;
213
224 void watch_indexes(std::vector<std::string> index_names,
225 const watch_query_indexes_options& options,
226 watch_query_indexes_handler&& handler) const;
227
238 [[nodiscard]] auto watch_indexes(std::vector<std::string> index_names,
239 const watch_query_indexes_options& options) const
240 -> std::future<error>;
241
242private:
243 friend class collection;
244
245 collection_query_index_manager(couchbase::core::cluster core,
246 std::string bucket_name,
247 std::string scope_name,
248 std::string collection_name);
249
250 std::shared_ptr<query_index_manager_impl> impl_;
251 std::string bucket_name_{};
252 std::string scope_name_{};
253 std::string collection_name_{};
254};
255} // namespace couchbase
Options for query_index_manager::build_deferred_indexes().
Definition build_query_index_options.hxx:37
The Query Index Manager interface contains the means for managing indexes used for queries.
Definition collection_query_index_manager.hxx:53
auto drop_primary_index(const drop_primary_query_index_options &options) const -> std::future< error >
Drop primary index on the collection.
void drop_index(std::string index_name, const drop_query_index_options &options, drop_query_index_handler &&handler) const
Drop specified query index in the collection.
auto create_primary_index(const create_primary_query_index_options &options) const -> std::future< error >
Create a primary index on the collection.
auto get_all_indexes(const get_all_query_indexes_options &options) const -> std::future< std::pair< error, std::vector< couchbase::management::query_index > > >
Get all indexes within the collection.
void create_index(std::string index_name, std::vector< std::string > keys, const create_query_index_options &options, create_query_index_handler &&handler) const
Create an index on the collection.
void drop_primary_index(const drop_primary_query_index_options &options, drop_primary_query_index_handler &&handler) const
Drop primary index on the collection.
void watch_indexes(std::vector< std::string > index_names, const watch_query_indexes_options &options, watch_query_indexes_handler &&handler) const
Polls the state of a set of indexes, until they all are online.
auto create_index(std::string index_name, std::vector< std::string > keys, const create_query_index_options &options) const -> std::future< error >
Create an index on the collection.
void create_primary_index(const create_primary_query_index_options &options, create_primary_query_index_handler &&handler) const
Create a primary index on the collection.
auto drop_index(std::string index_name, const drop_query_index_options &options) const -> std::future< error >
Drop specified query index in the collection.
auto build_deferred_indexes(const build_query_index_options &options) const -> std::future< error >
Builds all currently deferred indexes in this collection.
void build_deferred_indexes(const build_query_index_options &options, build_deferred_query_indexes_handler &&handler) const
Builds all currently deferred indexes in this collection.
void get_all_indexes(const get_all_query_indexes_options &options, get_all_query_indexes_handler &&handler) const
Get all indexes within the collection.
auto watch_indexes(std::vector< std::string > index_names, const watch_query_indexes_options &options) const -> std::future< error >
Polls the state of a set of indexes, until they all are online.
The collection provides access to all collection APIs.
Definition collection.hxx:70
Definition create_primary_query_index_options.hxx:30
Definition create_query_index_options.hxx:30
Definition drop_primary_query_index_options.hxx:29
Definition drop_query_index_options.hxx:29
Definition get_all_query_indexes_options.hxx:33
Definition watch_query_indexes_options.hxx:29
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28
std::function< void(error)> drop_query_index_handler
The signature for the handler of the query_index_manager::get_all_indexes() operation.
Definition drop_query_index_options.hxx:84
std::function< void(error)> create_query_index_handler
The signature for the handler of the query_index_manager::get_all_indexes() operation.
Definition create_query_index_options.hxx:139
std::function< void(error)> watch_query_indexes_handler
The signature for the handler of the query_index_manager::get_all_indexes() operation.
Definition watch_query_indexes_options.hxx:83
std::function< void(error)> create_primary_query_index_handler
The signature for the handler of the query_index_manager::get_all_indexes() operation.
Definition create_primary_query_index_options.hxx:137
std::function< void(error)> build_deferred_query_indexes_handler
The signature for the handler of the query_index_manager::build_deferred_indexes() operation.
Definition build_query_index_options.hxx:68
std::function< void(error)> drop_primary_query_index_handler
The signature for the handler of the query_index_manager::get_all_indexes() operation.
Definition drop_primary_query_index_options.hxx:98
std::function< void(error, std::vector< management::query_index >)> get_all_query_indexes_handler
The signature for the handler of the query_index_manager::get_all_indexes() operation.
Definition get_all_query_indexes_options.hxx:68