couchbase 4.2.6 → 4.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deps/couchbase-cxx-client/.github/workflows/windows.yml +0 -3
- package/deps/couchbase-cxx-client/CMakeLists.txt +4 -0
- package/deps/couchbase-cxx-client/bin/build-tests.rb +1 -1
- package/deps/couchbase-cxx-client/core/impl/lookup_in.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.cxx +176 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.hxx +80 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.cxx +167 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.hxx +75 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.cxx +97 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.hxx +67 -0
- package/deps/couchbase-cxx-client/core/meta/features.hxx +13 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +192 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +188 -0
- package/deps/couchbase-cxx-client/core/operations.hxx +2 -0
- package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +1 -0
- package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in_replica.cxx +107 -0
- package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in_replica.hxx +137 -0
- package/deps/couchbase-cxx-client/core/protocol/hello_feature.hxx +6 -0
- package/deps/couchbase-cxx-client/core/protocol/hello_feature_fmt.hxx +3 -0
- package/deps/couchbase-cxx-client/core/topology/capabilities.hxx +1 -0
- package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +3 -0
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +5 -0
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +2 -1
- package/deps/couchbase-cxx-client/couchbase/collection.hxx +111 -0
- package/deps/couchbase-cxx-client/couchbase/get_and_lock_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/get_and_touch_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/get_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/insert_options.hxx +3 -3
- package/deps/couchbase-cxx-client/couchbase/lookup_in_all_replicas_options.hxx +109 -0
- package/deps/couchbase-cxx-client/couchbase/lookup_in_any_replica_options.hxx +101 -0
- package/deps/couchbase-cxx-client/couchbase/lookup_in_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/lookup_in_replica_result.hxx +74 -0
- package/deps/couchbase-cxx-client/couchbase/lookup_in_result.hxx +26 -0
- package/deps/couchbase-cxx-client/couchbase/mutate_in_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/remove_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/replace_options.hxx +3 -3
- package/deps/couchbase-cxx-client/couchbase/touch_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/unlock_options.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/upsert_options.hxx +3 -3
- package/deps/couchbase-cxx-client/test/test_integration_subdoc.cxx +655 -0
- package/dist/binding.d.ts +45 -0
- package/dist/collection.d.ts +53 -1
- package/dist/collection.js +139 -1
- package/dist/crudoptypes.d.ts +24 -0
- package/dist/crudoptypes.js +14 -1
- package/package.json +13 -13
- package/src/connection.cpp +4 -0
- package/src/connection.hpp +2 -0
- package/src/connection_autogen.cpp +28 -0
- package/src/jstocbpp_autogen.hpp +262 -0
@@ -0,0 +1,137 @@
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2020-2021 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
|
+
|
20
|
+
#include "client_opcode.hxx"
|
21
|
+
#include "cmd_info.hxx"
|
22
|
+
#include "core/document_id.hxx"
|
23
|
+
#include "core/impl/subdoc/command.hxx"
|
24
|
+
#include "core/io/mcbp_message.hxx"
|
25
|
+
#include "status.hxx"
|
26
|
+
|
27
|
+
#include <gsl/assert>
|
28
|
+
|
29
|
+
namespace couchbase::core::protocol
|
30
|
+
{
|
31
|
+
|
32
|
+
class lookup_in_replica_response_body
|
33
|
+
{
|
34
|
+
public:
|
35
|
+
static const inline client_opcode opcode = client_opcode::subdoc_multi_lookup;
|
36
|
+
|
37
|
+
struct lookup_in_field {
|
38
|
+
key_value_status_code status{};
|
39
|
+
std::string value;
|
40
|
+
};
|
41
|
+
|
42
|
+
private:
|
43
|
+
std::vector<lookup_in_field> fields_{};
|
44
|
+
|
45
|
+
public:
|
46
|
+
[[nodiscard]] const std::vector<lookup_in_field>& fields() const
|
47
|
+
{
|
48
|
+
return fields_;
|
49
|
+
}
|
50
|
+
|
51
|
+
[[nodiscard]] bool parse(key_value_status_code status,
|
52
|
+
const header_buffer& header,
|
53
|
+
std::uint8_t framing_extras_size,
|
54
|
+
std::uint16_t key_size,
|
55
|
+
std::uint8_t extras_size,
|
56
|
+
const std::vector<std::byte>& body,
|
57
|
+
const cmd_info& info);
|
58
|
+
};
|
59
|
+
|
60
|
+
class lookup_in_replica_request_body
|
61
|
+
{
|
62
|
+
public:
|
63
|
+
using response_body_type = lookup_in_replica_response_body;
|
64
|
+
static const inline client_opcode opcode = client_opcode::subdoc_multi_lookup;
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Tells the server to operate on replica vbucket instead of active
|
68
|
+
*/
|
69
|
+
static const inline std::uint8_t doc_flag_replica_read = 0b0010'0000;
|
70
|
+
|
71
|
+
private:
|
72
|
+
std::vector<std::byte> key_;
|
73
|
+
std::vector<std::byte> extras_{};
|
74
|
+
std::vector<std::byte> value_{};
|
75
|
+
|
76
|
+
std::uint8_t flags_{ 0 };
|
77
|
+
std::vector<couchbase::core::impl::subdoc::command> specs_;
|
78
|
+
|
79
|
+
public:
|
80
|
+
void id(const document_id& id);
|
81
|
+
|
82
|
+
void read_replica(bool value)
|
83
|
+
{
|
84
|
+
if (value) {
|
85
|
+
flags_ = flags_ | doc_flag_replica_read;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
void specs(const std::vector<couchbase::core::impl::subdoc::command>& specs)
|
90
|
+
{
|
91
|
+
specs_ = specs;
|
92
|
+
}
|
93
|
+
|
94
|
+
[[nodiscard]] const auto& key() const
|
95
|
+
{
|
96
|
+
return key_;
|
97
|
+
}
|
98
|
+
|
99
|
+
[[nodiscard]] const auto& framing_extras() const
|
100
|
+
{
|
101
|
+
return empty_buffer;
|
102
|
+
}
|
103
|
+
|
104
|
+
[[nodiscard]] const auto& extras()
|
105
|
+
{
|
106
|
+
if (extras_.empty()) {
|
107
|
+
fill_extras();
|
108
|
+
}
|
109
|
+
return extras_;
|
110
|
+
}
|
111
|
+
|
112
|
+
[[nodiscard]] const auto& value()
|
113
|
+
{
|
114
|
+
if (value_.empty()) {
|
115
|
+
fill_value();
|
116
|
+
}
|
117
|
+
return value_;
|
118
|
+
}
|
119
|
+
|
120
|
+
[[nodiscard]] std::size_t size()
|
121
|
+
{
|
122
|
+
if (extras_.empty()) {
|
123
|
+
fill_extras();
|
124
|
+
}
|
125
|
+
if (value_.empty()) {
|
126
|
+
fill_value();
|
127
|
+
}
|
128
|
+
return key_.size() + extras_.size() + value_.size();
|
129
|
+
}
|
130
|
+
|
131
|
+
private:
|
132
|
+
void fill_extras();
|
133
|
+
|
134
|
+
void fill_value();
|
135
|
+
};
|
136
|
+
|
137
|
+
} // namespace couchbase::core::protocol
|
@@ -155,6 +155,11 @@ enum class hello_feature : std::uint16_t {
|
|
155
155
|
replace_body_with_xattr = 0x19,
|
156
156
|
|
157
157
|
resource_units = 0x1a,
|
158
|
+
|
159
|
+
/**
|
160
|
+
* Indicates support for subdoc lookup operations on replicas
|
161
|
+
*/
|
162
|
+
subdoc_replica_read = 0x1c,
|
158
163
|
};
|
159
164
|
|
160
165
|
constexpr bool
|
@@ -185,6 +190,7 @@ is_valid_hello_feature(std::uint16_t code)
|
|
185
190
|
case hello_feature::subdoc_document_macro_support:
|
186
191
|
case hello_feature::replace_body_with_xattr:
|
187
192
|
case hello_feature::resource_units:
|
193
|
+
case hello_feature::subdoc_replica_read:
|
188
194
|
return true;
|
189
195
|
}
|
190
196
|
return false;
|
@@ -106,6 +106,9 @@ struct fmt::formatter<couchbase::core::protocol::hello_feature> {
|
|
106
106
|
case couchbase::core::protocol::hello_feature::resource_units:
|
107
107
|
name = "resource_units";
|
108
108
|
break;
|
109
|
+
case couchbase::core::protocol::hello_feature::subdoc_replica_read:
|
110
|
+
name = "subdoc_replica_read";
|
111
|
+
break;
|
109
112
|
}
|
110
113
|
return format_to(ctx.out(), "{}", name);
|
111
114
|
}
|
@@ -70,6 +70,9 @@ struct fmt::formatter<couchbase::core::bucket_capability> {
|
|
70
70
|
case couchbase::core::bucket_capability::range_scan:
|
71
71
|
name = "range_scan";
|
72
72
|
break;
|
73
|
+
case couchbase::core::bucket_capability::replica_read:
|
74
|
+
name = "replica_read";
|
75
|
+
break;
|
73
76
|
}
|
74
77
|
return format_to(ctx.out(), "{}", name);
|
75
78
|
}
|
@@ -129,6 +129,11 @@ struct configuration {
|
|
129
129
|
return bucket_capabilities.count(couchbase::core::bucket_capability::couchapi) == 0;
|
130
130
|
}
|
131
131
|
|
132
|
+
[[nodiscard]] bool supports_subdoc_read_replica() const
|
133
|
+
{
|
134
|
+
return bucket_capabilities.find(bucket_capability::replica_read) != bucket_capabilities.end();
|
135
|
+
}
|
136
|
+
|
132
137
|
[[nodiscard]] std::size_t index_for_this_node() const;
|
133
138
|
[[nodiscard]] bool has_node(const std::string& network,
|
134
139
|
service_type type,
|
@@ -52,7 +52,6 @@ struct traits<couchbase::core::topology::configuration> {
|
|
52
52
|
}
|
53
53
|
if (const auto& hostname = o.find("hostname"); hostname != o.end()) {
|
54
54
|
n.hostname = hostname->second.get_string();
|
55
|
-
n.hostname = n.hostname.substr(0, n.hostname.rfind(':'));
|
56
55
|
}
|
57
56
|
const auto& s = o.at("services");
|
58
57
|
n.services_plain.key_value = s.template optional<std::uint16_t>("kv");
|
@@ -235,6 +234,8 @@ struct traits<couchbase::core::topology::configuration> {
|
|
235
234
|
result.bucket_capabilities.insert(couchbase::core::bucket_capability::xattr);
|
236
235
|
} else if (name == "rangeScan") {
|
237
236
|
result.bucket_capabilities.insert(couchbase::core::bucket_capability::range_scan);
|
237
|
+
} else if (name == "subdoc.ReplicaRead") {
|
238
|
+
result.bucket_capabilities.insert(couchbase::core::bucket_capability::replica_read);
|
238
239
|
}
|
239
240
|
}
|
240
241
|
}
|
@@ -28,6 +28,8 @@
|
|
28
28
|
#include <couchbase/get_any_replica_options.hxx>
|
29
29
|
#include <couchbase/get_options.hxx>
|
30
30
|
#include <couchbase/insert_options.hxx>
|
31
|
+
#include <couchbase/lookup_in_all_replicas_options.hxx>
|
32
|
+
#include <couchbase/lookup_in_any_replica_options.hxx>
|
31
33
|
#include <couchbase/lookup_in_options.hxx>
|
32
34
|
#include <couchbase/lookup_in_specs.hxx>
|
33
35
|
#include <couchbase/mutate_in_options.hxx>
|
@@ -856,6 +858,115 @@ class collection
|
|
856
858
|
return future;
|
857
859
|
}
|
858
860
|
|
861
|
+
/**
|
862
|
+
* Performs lookups to document fragments with default options from all replicas and the active node and returns the result as a vector.
|
863
|
+
*
|
864
|
+
* @tparam Handler type of the handler that implements @ref lookup_in_all_replicas_handler
|
865
|
+
*
|
866
|
+
* @param document_id the outer document ID
|
867
|
+
* @param specs an object that specifies the types of lookups to perform
|
868
|
+
* @param options custom options to modify the lookup options
|
869
|
+
* @param handler callable that implements @ref lookup_in_all_replicas_handler
|
870
|
+
*
|
871
|
+
* @exception errc::key_value::document_not_found the given document id is not found in the collection.
|
872
|
+
* @exception errc::common::ambiguous_timeout
|
873
|
+
* @exception errc::common::unambiguous_timeout
|
874
|
+
*
|
875
|
+
* @since 1.0.0
|
876
|
+
* @committed
|
877
|
+
*/
|
878
|
+
template<typename Handler>
|
879
|
+
void lookup_in_all_replicas(std::string document_id,
|
880
|
+
lookup_in_specs specs,
|
881
|
+
const lookup_in_all_replicas_options& options,
|
882
|
+
Handler&& handler) const
|
883
|
+
{
|
884
|
+
return core::impl::initiate_lookup_in_all_replicas_operation(
|
885
|
+
core_, bucket_name_, scope_name_, name_, std::move(document_id), specs.specs(), options.build(), std::forward<Handler>(handler));
|
886
|
+
}
|
887
|
+
|
888
|
+
/**
|
889
|
+
* Performs lookups to document fragments with default options from all replicas and the active node and returns the result as a vector.
|
890
|
+
*
|
891
|
+
* @param document_id the outer document ID
|
892
|
+
* @param specs an object that specifies the types of lookups to perform
|
893
|
+
* @param options custom options to modify the lookup options
|
894
|
+
* @return future object that carries result of the operation
|
895
|
+
*
|
896
|
+
* @exception errc::key_value::document_not_found the given document id is not found in the collection.
|
897
|
+
* @exception errc::common::ambiguous_timeout
|
898
|
+
* @exception errc::common::unambiguous_timeout
|
899
|
+
*
|
900
|
+
* @since 1.0.0
|
901
|
+
* @committed
|
902
|
+
*/
|
903
|
+
[[nodiscard]] auto lookup_in_all_replicas(std::string document_id,
|
904
|
+
lookup_in_specs specs,
|
905
|
+
const lookup_in_all_replicas_options& options = {}) const
|
906
|
+
-> std::future<std::pair<subdocument_error_context, lookup_in_all_replicas_result>>
|
907
|
+
{
|
908
|
+
auto barrier = std::make_shared<std::promise<std::pair<subdocument_error_context, lookup_in_all_replicas_result>>>();
|
909
|
+
auto future = barrier->get_future();
|
910
|
+
lookup_in_all_replicas(std::move(document_id), std::move(specs), options, [barrier](auto ctx, auto result) {
|
911
|
+
barrier->set_value({ std::move(ctx), std::move(result) });
|
912
|
+
});
|
913
|
+
return future;
|
914
|
+
}
|
915
|
+
|
916
|
+
/**
|
917
|
+
* Performs lookups to document fragments with default options from all replicas and returns the first found.
|
918
|
+
*
|
919
|
+
* @tparam Handler type of the handler that implements @ref lookup_in_any_replica_handler
|
920
|
+
*
|
921
|
+
* @param document_id the outer document ID
|
922
|
+
* @param specs an object that specifies the types of lookups to perform
|
923
|
+
* @param options custom options to modify the lookup options
|
924
|
+
*
|
925
|
+
* @exception errc::key_value::document_not_found the given document id is not found in the collection.
|
926
|
+
* @exception errc::common::ambiguous_timeout
|
927
|
+
* @exception errc::common::unambiguous_timeout
|
928
|
+
*
|
929
|
+
* @since 1.0.0
|
930
|
+
* @committed
|
931
|
+
*/
|
932
|
+
template<typename Handler>
|
933
|
+
void lookup_in_any_replica(std::string document_id,
|
934
|
+
lookup_in_specs specs,
|
935
|
+
const lookup_in_any_replica_options& options,
|
936
|
+
Handler&& handler) const
|
937
|
+
{
|
938
|
+
return core::impl::initiate_lookup_in_any_replica_operation(
|
939
|
+
core_, bucket_name_, scope_name_, name_, std::move(document_id), specs.specs(), options.build(), std::forward<Handler>(handler));
|
940
|
+
}
|
941
|
+
|
942
|
+
/**
|
943
|
+
* Performs lookups to document fragments with default options from all replicas and returns the first found.
|
944
|
+
*
|
945
|
+
* @param document_id the outer document ID
|
946
|
+
* @param specs an object that specifies the types of lookups to perform
|
947
|
+
* @param options custom options to modify the lookup options
|
948
|
+
* @return future object that carries result of the operation
|
949
|
+
*
|
950
|
+
* @exception errc::key_value::document_not_found the given document id is not found in the collection.
|
951
|
+
* @exception errc::common::ambiguous_timeout
|
952
|
+
* @exception errc::common::unambiguous_timeout
|
953
|
+
*
|
954
|
+
* @since 1.0.0
|
955
|
+
* @committed
|
956
|
+
*/
|
957
|
+
[[nodiscard]] auto lookup_in_any_replica(std::string document_id,
|
958
|
+
lookup_in_specs specs,
|
959
|
+
const lookup_in_any_replica_options& options = {}) const
|
960
|
+
-> std::future<std::pair<subdocument_error_context, lookup_in_replica_result>>
|
961
|
+
{
|
962
|
+
auto barrier = std::make_shared<std::promise<std::pair<subdocument_error_context, lookup_in_replica_result>>>();
|
963
|
+
auto future = barrier->get_future();
|
964
|
+
lookup_in_any_replica(std::move(document_id), std::move(specs), options, [barrier](auto ctx, auto result) {
|
965
|
+
barrier->set_value({ std::move(ctx), std::move(result) });
|
966
|
+
});
|
967
|
+
return future;
|
968
|
+
}
|
969
|
+
|
859
970
|
/**
|
860
971
|
* Gets a document for a given id and places a pessimistic lock on it for mutations
|
861
972
|
*
|
@@ -86,8 +86,8 @@ initiate_get_and_lock_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
86
86
|
std::string collection_name,
|
87
87
|
std::string document_key,
|
88
88
|
std::chrono::seconds lock_duration,
|
89
|
-
get_and_lock_options::built options,
|
90
|
-
get_and_lock_handler&& handler);
|
89
|
+
couchbase::get_and_lock_options::built options,
|
90
|
+
couchbase::get_and_lock_handler&& handler);
|
91
91
|
#endif
|
92
92
|
} // namespace impl
|
93
93
|
} // namespace core
|
@@ -86,8 +86,8 @@ initiate_get_and_touch_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
86
86
|
std::string collection_name,
|
87
87
|
std::string document_key,
|
88
88
|
std::uint32_t expiry,
|
89
|
-
get_and_touch_options::built options,
|
90
|
-
get_and_touch_handler&& handler);
|
89
|
+
couchbase::get_and_touch_options::built options,
|
90
|
+
couchbase::get_and_touch_handler&& handler);
|
91
91
|
#endif
|
92
92
|
} // namespace impl
|
93
93
|
} // namespace core
|
@@ -129,8 +129,8 @@ initiate_get_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
129
129
|
std::string scope_name,
|
130
130
|
std::string collection_name,
|
131
131
|
std::string document_key,
|
132
|
-
get_options::built options,
|
133
|
-
get_handler&& handler);
|
132
|
+
couchbase::get_options::built options,
|
133
|
+
couchbase::get_handler&& handler);
|
134
134
|
#endif
|
135
135
|
} // namespace impl
|
136
136
|
} // namespace core
|
@@ -127,9 +127,9 @@ initiate_insert_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
127
127
|
std::string scope_name,
|
128
128
|
std::string collection_name,
|
129
129
|
std::string document_key,
|
130
|
-
codec::encoded_value encoded,
|
131
|
-
insert_options::built options,
|
132
|
-
insert_handler&& handler);
|
130
|
+
couchbase::codec::encoded_value encoded,
|
131
|
+
couchbase::insert_options::built options,
|
132
|
+
couchbase::insert_handler&& handler);
|
133
133
|
#endif
|
134
134
|
} // namespace impl
|
135
135
|
} // namespace core
|
@@ -0,0 +1,109 @@
|
|
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
|
+
|
20
|
+
#include <couchbase/subdoc/fwd/command_bundle.hxx>
|
21
|
+
|
22
|
+
#include <core/impl/subdoc/command.hxx>
|
23
|
+
#include <couchbase/codec/encoded_value.hxx>
|
24
|
+
#include <couchbase/common_options.hxx>
|
25
|
+
#include <couchbase/expiry.hxx>
|
26
|
+
#include <couchbase/lookup_in_replica_result.hxx>
|
27
|
+
#include <couchbase/store_semantics.hxx>
|
28
|
+
#include <couchbase/subdocument_error_context.hxx>
|
29
|
+
|
30
|
+
#include <chrono>
|
31
|
+
#include <functional>
|
32
|
+
#include <memory>
|
33
|
+
#include <optional>
|
34
|
+
#include <vector>
|
35
|
+
|
36
|
+
namespace couchbase
|
37
|
+
{
|
38
|
+
/**
|
39
|
+
* Options for @ref collection#lookup_in_all_replicas().
|
40
|
+
*
|
41
|
+
* @since 1.0.0
|
42
|
+
* @committed
|
43
|
+
*/
|
44
|
+
struct lookup_in_all_replicas_options : common_options<lookup_in_all_replicas_options> {
|
45
|
+
/**
|
46
|
+
* Immutable value object representing consistent options.
|
47
|
+
*
|
48
|
+
* @since 1.0.0
|
49
|
+
* @internal
|
50
|
+
*/
|
51
|
+
struct built : public common_options<lookup_in_all_replicas_options>::built {
|
52
|
+
};
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Validates options and returns them as an immutable value.
|
56
|
+
*
|
57
|
+
* @return consistent options as an immutable value
|
58
|
+
*
|
59
|
+
* @exception std::system_error with code errc::common::invalid_argument if the options are not valid
|
60
|
+
*
|
61
|
+
* @since 1.0.0
|
62
|
+
* @internal
|
63
|
+
*/
|
64
|
+
[[nodiscard]] auto build() const -> built
|
65
|
+
{
|
66
|
+
return { build_common_options() };
|
67
|
+
}
|
68
|
+
};
|
69
|
+
|
70
|
+
/**
|
71
|
+
* The result for the @ref collection#lookup_in_all_replicas() operation
|
72
|
+
*
|
73
|
+
* @since 1.0.0
|
74
|
+
* @uncommitted
|
75
|
+
*/
|
76
|
+
using lookup_in_all_replicas_result = std::vector<lookup_in_replica_result>;
|
77
|
+
|
78
|
+
/**
|
79
|
+
* The signature for the handler of the @ref collection#lookup_in_all_replicas() operation
|
80
|
+
*
|
81
|
+
* @since 1.0.0
|
82
|
+
* @uncommitted
|
83
|
+
*/
|
84
|
+
using lookup_in_all_replicas_handler = std::function<void(couchbase::subdocument_error_context, lookup_in_all_replicas_result)>;
|
85
|
+
|
86
|
+
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
87
|
+
namespace core
|
88
|
+
{
|
89
|
+
class cluster;
|
90
|
+
namespace impl
|
91
|
+
{
|
92
|
+
|
93
|
+
/**
|
94
|
+
* @since 1.0.0
|
95
|
+
* @internal
|
96
|
+
*/
|
97
|
+
void
|
98
|
+
initiate_lookup_in_all_replicas_operation(std::shared_ptr<couchbase::core::cluster> core,
|
99
|
+
const std::string& bucket_name,
|
100
|
+
const std::string& scope_name,
|
101
|
+
const std::string& collection_name,
|
102
|
+
std::string document_key,
|
103
|
+
const std::vector<couchbase::core::impl::subdoc::command>& specs,
|
104
|
+
lookup_in_all_replicas_options::built options,
|
105
|
+
lookup_in_all_replicas_handler&& handler);
|
106
|
+
#endif
|
107
|
+
} // namespace impl
|
108
|
+
} // namespace core
|
109
|
+
} // namespace couchbase
|
@@ -0,0 +1,101 @@
|
|
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
|
+
|
20
|
+
#include <couchbase/subdoc/fwd/command_bundle.hxx>
|
21
|
+
|
22
|
+
#include <core/impl/subdoc/command.hxx>
|
23
|
+
#include <couchbase/codec/encoded_value.hxx>
|
24
|
+
#include <couchbase/common_options.hxx>
|
25
|
+
#include <couchbase/expiry.hxx>
|
26
|
+
#include <couchbase/lookup_in_replica_result.hxx>
|
27
|
+
#include <couchbase/store_semantics.hxx>
|
28
|
+
#include <couchbase/subdocument_error_context.hxx>
|
29
|
+
|
30
|
+
#include <chrono>
|
31
|
+
#include <functional>
|
32
|
+
#include <memory>
|
33
|
+
#include <optional>
|
34
|
+
#include <vector>
|
35
|
+
|
36
|
+
namespace couchbase
|
37
|
+
{
|
38
|
+
/**
|
39
|
+
* Options for @ref collection#lookup_in_any_replica().
|
40
|
+
*
|
41
|
+
* @since 1.0.0
|
42
|
+
* @committed
|
43
|
+
*/
|
44
|
+
struct lookup_in_any_replica_options : common_options<lookup_in_any_replica_options> {
|
45
|
+
/**
|
46
|
+
* Immutable value object representing consistent options.
|
47
|
+
*
|
48
|
+
* @since 1.0.0
|
49
|
+
* @internal
|
50
|
+
*/
|
51
|
+
struct built : public common_options<lookup_in_any_replica_options>::built {
|
52
|
+
};
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Validates options and returns them as an immutable value.
|
56
|
+
*
|
57
|
+
* @return consistent options as an immutable value
|
58
|
+
*
|
59
|
+
* @exception std::system_error with code errc::common::invalid_argument if the options are not valid
|
60
|
+
*
|
61
|
+
* @since 1.0.0
|
62
|
+
* @internal
|
63
|
+
*/
|
64
|
+
[[nodiscard]] auto build() const -> built
|
65
|
+
{
|
66
|
+
return { build_common_options() };
|
67
|
+
}
|
68
|
+
};
|
69
|
+
|
70
|
+
/**
|
71
|
+
* The signature for the handler of the @ref collection#lookup_in_any_replica() operation
|
72
|
+
*
|
73
|
+
* @since 1.0.0
|
74
|
+
* @uncommitted
|
75
|
+
*/
|
76
|
+
using lookup_in_any_replica_handler = std::function<void(couchbase::subdocument_error_context, lookup_in_replica_result)>;
|
77
|
+
|
78
|
+
#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
|
79
|
+
namespace core
|
80
|
+
{
|
81
|
+
class cluster;
|
82
|
+
namespace impl
|
83
|
+
{
|
84
|
+
|
85
|
+
/**
|
86
|
+
* @since 1.0.0
|
87
|
+
* @internal
|
88
|
+
*/
|
89
|
+
void
|
90
|
+
initiate_lookup_in_any_replica_operation(std::shared_ptr<couchbase::core::cluster> core,
|
91
|
+
const std::string& bucket_name,
|
92
|
+
const std::string& scope_name,
|
93
|
+
const std::string& collection_name,
|
94
|
+
std::string document_key,
|
95
|
+
const std::vector<couchbase::core::impl::subdoc::command>& specs,
|
96
|
+
lookup_in_any_replica_options::built options,
|
97
|
+
lookup_in_any_replica_handler&& handler);
|
98
|
+
#endif
|
99
|
+
} // namespace impl
|
100
|
+
} // namespace core
|
101
|
+
} // namespace couchbase
|
@@ -111,8 +111,8 @@ initiate_lookup_in_operation(std::shared_ptr<couchbase::core::cluster> core,
|
|
111
111
|
std::string collection_name,
|
112
112
|
std::string document_key,
|
113
113
|
const std::vector<couchbase::core::impl::subdoc::command>& specs,
|
114
|
-
lookup_in_options::built options,
|
115
|
-
lookup_in_handler&& handler);
|
114
|
+
couchbase::lookup_in_options::built options,
|
115
|
+
couchbase::lookup_in_handler&& handler);
|
116
116
|
#endif
|
117
117
|
} // namespace impl
|
118
118
|
} // namespace core
|