couchbase 3.2.2 → 3.2.5
Sign up to get free protection for your applications and to get access to all the features.
- package/binding.gyp +5 -0
- package/deps/lcb/CMakeLists.txt +1 -1
- package/deps/lcb/CONTRIBUTING.md +1 -1
- package/deps/lcb/README.markdown +2 -2
- package/deps/lcb/RELEASE_NOTES.markdown +84 -17
- package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
- package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
- package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -6
- package/deps/lcb/doc/Doxyfile +1 -1
- package/deps/lcb/example/minimal/query.c +9 -7
- package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
- package/deps/lcb/gyp_config/linux/arm64/config.h +243 -0
- package/deps/lcb/include/libcouchbase/couchbase.h +55 -1
- package/deps/lcb/include/libcouchbase/error.h +6 -1
- package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
- package/deps/lcb/include/libcouchbase/tracing.h +2 -2
- package/deps/lcb/include/memcached/protocol_binary.h +21 -0
- package/deps/lcb/libcouchbase.gyp +353 -349
- package/deps/lcb/packaging/deb/control +1 -1
- package/deps/lcb/src/analytics/analytics_handle.cc +7 -5
- package/deps/lcb/src/analytics/analytics_handle.hh +28 -0
- package/deps/lcb/src/capi/cmd_counter.hh +18 -0
- package/deps/lcb/src/capi/cmd_exists.hh +18 -0
- package/deps/lcb/src/capi/cmd_get.hh +17 -0
- package/deps/lcb/src/capi/cmd_get_replica.hh +20 -1
- package/deps/lcb/src/capi/cmd_query.cc +13 -0
- package/deps/lcb/src/capi/cmd_query.hh +22 -14
- package/deps/lcb/src/capi/cmd_remove.hh +18 -0
- package/deps/lcb/src/capi/cmd_search.hh +6 -0
- package/deps/lcb/src/capi/cmd_store.hh +28 -21
- package/deps/lcb/src/capi/cmd_subdoc.hh +30 -0
- package/deps/lcb/src/capi/cmd_touch.hh +18 -0
- package/deps/lcb/src/capi/cmd_unlock.hh +18 -0
- package/deps/lcb/src/capi/cmd_view.hh +6 -0
- package/deps/lcb/src/capi/collection_qualifier.hh +6 -8
- package/deps/lcb/src/cntl.cc +42 -8
- package/deps/lcb/src/dns-srv.cc +5 -3
- package/deps/lcb/src/errmap.cc +5 -9
- package/deps/lcb/src/errmap.h +7 -3
- package/deps/lcb/src/handler.cc +24 -18
- package/deps/lcb/src/internal.h +2 -1
- package/deps/lcb/src/lcbio/ctx.cc +4 -2
- package/deps/lcb/src/mcserver/mcserver.cc +8 -5
- package/deps/lcb/src/mcserver/negotiate.cc +42 -17
- package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
- package/deps/lcb/src/n1ql/n1ql.cc +5 -1
- package/deps/lcb/src/n1ql/query_handle.cc +80 -44
- package/deps/lcb/src/n1ql/query_handle.hh +41 -3
- package/deps/lcb/src/operations/counter.cc +13 -1
- package/deps/lcb/src/operations/exists.cc +14 -2
- package/deps/lcb/src/operations/get.cc +14 -2
- package/deps/lcb/src/operations/get_replica.cc +18 -6
- package/deps/lcb/src/operations/observe.cc +1 -1
- package/deps/lcb/src/operations/remove.cc +13 -1
- package/deps/lcb/src/operations/store.cc +13 -1
- package/deps/lcb/src/operations/subdoc.cc +13 -2
- package/deps/lcb/src/operations/touch.cc +14 -2
- package/deps/lcb/src/operations/unlock.cc +14 -2
- package/deps/lcb/src/search/search_handle.cc +26 -8
- package/deps/lcb/src/search/search_handle.hh +29 -0
- package/deps/lcb/src/ssl/ssl_common.c +7 -8
- package/deps/lcb/src/tracing/span.cc +43 -10
- package/deps/lcb/src/tracing/tracing-internal.h +105 -93
- package/deps/lcb/src/utilities.cc +21 -0
- package/deps/lcb/src/utilities.h +3 -0
- package/deps/lcb/src/views/view_handle.cc +13 -5
- package/deps/lcb/src/views/view_handle.hh +29 -0
- package/deps/lcb/tests/CMakeLists.txt +21 -0
- package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
- package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
- package/deps/lcb/tests/iotests/mock-environment.cc +25 -1
- package/deps/lcb/tests/iotests/mock-environment.h +49 -1
- package/deps/lcb/tests/iotests/mock-unit-test.cc +96 -5
- package/deps/lcb/tests/iotests/mock-unit-test.h +32 -0
- package/deps/lcb/tests/iotests/serverparams.h +7 -2
- package/deps/lcb/tests/iotests/t_collections.cc +1 -1
- package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
- package/deps/lcb/tests/iotests/t_get.cc +14 -4
- package/deps/lcb/tests/iotests/t_n1ql.cc +17 -1
- package/deps/lcb/tests/iotests/t_ratelimit.cc +729 -0
- package/deps/lcb/tests/iotests/t_views.cc +1 -0
- package/deps/lcb/tests/iotests/testutil.cc +342 -0
- package/deps/lcb/tests/iotests/testutil.h +164 -0
- package/deps/lcb/tests/mocksupport/procutil.c +32 -28
- package/deps/lcb/tests/mocksupport/server.c +0 -1
- package/deps/lcb/tools/cbc.cc +7 -0
- package/dist/analyticsexecutor.js +2 -2
- package/dist/analyticsindexmanager.js +512 -524
- package/dist/binarycollection.d.ts +17 -0
- package/dist/binding.d.ts +2 -0
- package/dist/binding.js +1 -1
- package/dist/bindingutilities.js +9 -1
- package/dist/bucketmanager.d.ts +32 -23
- package/dist/bucketmanager.js +197 -189
- package/dist/cluster.js +37 -36
- package/dist/collection.js +17 -23
- package/dist/collectionmanager.js +181 -200
- package/dist/connection.js +6 -3
- package/dist/connspec.js +5 -1
- package/dist/couchbase.js +7 -14
- package/dist/datastructures.js +239 -310
- package/dist/diagnosticsexecutor.js +70 -85
- package/dist/errors.d.ts +18 -0
- package/dist/errors.js +26 -2
- package/dist/eventingfunctionmanager.js +267 -294
- package/dist/httpexecutor.js +31 -38
- package/dist/logging.js +1 -1
- package/dist/queryexecutor.js +3 -3
- package/dist/queryindexmanager.js +236 -263
- package/dist/scope.js +8 -2
- package/dist/searchexecutor.js +3 -0
- package/dist/searchindexmanager.js +240 -271
- package/dist/searchquery.d.ts +17 -0
- package/dist/searchquery.js +22 -1
- package/dist/searchtypes.d.ts +7 -2
- package/dist/searchtypes.js +2 -2
- package/dist/usermanager.js +250 -263
- package/dist/utilities.d.ts +3 -2
- package/dist/utilities.js +16 -4
- package/dist/viewexecutor.js +1 -1
- package/dist/viewindexmanager.js +131 -150
- package/package.json +1 -1
- package/src/connection.cpp +2 -0
- package/src/constants.cpp +2 -0
- package/src/instance.cpp +8 -1
- package/src/instance.h +1 -0
- package/src/uv-plugin-all.cpp +1 -0
- package/dist/cas.d.ts +0 -0
- package/dist/cas.js +0 -1
@@ -6,7 +6,7 @@ Standards-Version: 3.9.2
|
|
6
6
|
Section: libs
|
7
7
|
Homepage: http://www.couchbase.com/develop/c/current
|
8
8
|
Vcs-Browser: https://github.com/couchbase/libcouchbase
|
9
|
-
Vcs-Git:
|
9
|
+
Vcs-Git: https://github.com/couchbase/libcouchbase.git
|
10
10
|
|
11
11
|
Package: libcouchbase3-libevent
|
12
12
|
Architecture: any
|
@@ -225,7 +225,7 @@ lcb_ANALYTICS_HANDLE_::lcb_ANALYTICS_HANDLE_(lcb_INSTANCE *obj, void *user_cooki
|
|
225
225
|
query_params_ = Json::FastWriter().write(cmd->root());
|
226
226
|
|
227
227
|
if (instance_->settings->tracer) {
|
228
|
-
|
228
|
+
parent_span_ = cmd->parent_span();
|
229
229
|
}
|
230
230
|
|
231
231
|
if (ingest_options().method != LCB_INGEST_METHOD_NONE) {
|
@@ -284,8 +284,7 @@ lcb_STATUS lcb_ANALYTICS_HANDLE_::issue_htreq(const std::string &body)
|
|
284
284
|
htcmd->set_header("cb-on-behalf-of", impostor_);
|
285
285
|
}
|
286
286
|
|
287
|
-
|
288
|
-
LCBTRACE_THRESHOLD_ANALYTICS, span_);
|
287
|
+
span_ = lcb::trace::start_http_span_with_statement(instance_->settings, this, statement_);
|
289
288
|
lcb_cmdhttp_parent_span(htcmd, span_);
|
290
289
|
|
291
290
|
lcb_STATUS rc = lcb_http(instance_, this, htcmd);
|
@@ -394,7 +393,7 @@ void lcb_ANALYTICS_HANDLE_::invoke_row(lcb_RESPANALYTICS *resp, bool is_last)
|
|
394
393
|
resp->rflags |= LCB_RESP_F_EXTDATA;
|
395
394
|
}
|
396
395
|
Json::Value meta;
|
397
|
-
if (Json::Reader().parse(resp->row, resp->row + resp->nrow, meta)) {
|
396
|
+
if (Json::Reader(Json::Features::strictMode()).parse(resp->row, resp->row + resp->nrow, meta)) {
|
398
397
|
const Json::Value &errors = meta["errors"];
|
399
398
|
if (errors.isArray() && !errors.empty()) {
|
400
399
|
const Json::Value &err = errors[0];
|
@@ -456,7 +455,10 @@ void lcb_ANALYTICS_HANDLE_::invoke_row(lcb_RESPANALYTICS *resp, bool is_last)
|
|
456
455
|
}
|
457
456
|
}
|
458
457
|
|
459
|
-
|
458
|
+
if (span_ != nullptr) {
|
459
|
+
lcb::trace::finish_http_span(span_, this);
|
460
|
+
span_ = nullptr;
|
461
|
+
}
|
460
462
|
if (http_request_ != nullptr) {
|
461
463
|
http_request_->span = nullptr;
|
462
464
|
}
|
@@ -208,6 +208,32 @@ struct lcb_ANALYTICS_HANDLE_ : lcb::jsparse::Parser::Actions {
|
|
208
208
|
return last_error_;
|
209
209
|
}
|
210
210
|
|
211
|
+
static lcbtrace_THRESHOLDOPTS service()
|
212
|
+
{
|
213
|
+
return LCBTRACE_THRESHOLD_ANALYTICS;
|
214
|
+
}
|
215
|
+
|
216
|
+
static const std::string &operation_name()
|
217
|
+
{
|
218
|
+
static std::string name = LCBTRACE_OP_ANALYTICS;
|
219
|
+
return name;
|
220
|
+
}
|
221
|
+
|
222
|
+
lcbtrace_SPAN *parent_span() const
|
223
|
+
{
|
224
|
+
return parent_span_;
|
225
|
+
}
|
226
|
+
|
227
|
+
const std::string &client_context_id() const
|
228
|
+
{
|
229
|
+
return client_context_id_;
|
230
|
+
}
|
231
|
+
|
232
|
+
int retries() const
|
233
|
+
{
|
234
|
+
return retries_;
|
235
|
+
}
|
236
|
+
|
211
237
|
private:
|
212
238
|
const lcb_RESPHTTP *http_response_{nullptr};
|
213
239
|
lcb_HTTP_HANDLE *http_request_{nullptr};
|
@@ -219,6 +245,7 @@ struct lcb_ANALYTICS_HANDLE_ : lcb::jsparse::Parser::Actions {
|
|
219
245
|
lcb_U32 timeout_{0};
|
220
246
|
// How many rows were received. Used to avoid parsing the meta
|
221
247
|
size_t rows_number_{0};
|
248
|
+
int retries_{0};
|
222
249
|
|
223
250
|
/** Request body as received from the application */
|
224
251
|
Json::Value json{};
|
@@ -240,6 +267,7 @@ struct lcb_ANALYTICS_HANDLE_ : lcb::jsparse::Parser::Actions {
|
|
240
267
|
lcb::docreq::Queue *document_queue_{nullptr};
|
241
268
|
unsigned refcount{1};
|
242
269
|
|
270
|
+
lcbtrace_SPAN *parent_span_{nullptr};
|
243
271
|
lcbtrace_SPAN *span_{nullptr};
|
244
272
|
std::string impostor_{};
|
245
273
|
};
|
@@ -30,6 +30,12 @@
|
|
30
30
|
*/
|
31
31
|
struct lcb_CMDCOUNTER_ {
|
32
32
|
public:
|
33
|
+
static const std::string &operation_name()
|
34
|
+
{
|
35
|
+
static std::string name = LCBTRACE_OP_COUNTER;
|
36
|
+
return name;
|
37
|
+
}
|
38
|
+
|
33
39
|
lcb_STATUS expiry(std::uint32_t expiry)
|
34
40
|
{
|
35
41
|
if (!initialize_if_does_not_exist_) {
|
@@ -181,6 +187,17 @@ struct lcb_CMDCOUNTER_ {
|
|
181
187
|
return LCB_SUCCESS;
|
182
188
|
}
|
183
189
|
|
190
|
+
lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
|
191
|
+
{
|
192
|
+
extra_privileges_.emplace_back(std::move(privilege));
|
193
|
+
return LCB_SUCCESS;
|
194
|
+
}
|
195
|
+
|
196
|
+
const std::vector<std::string> &extra_privileges() const
|
197
|
+
{
|
198
|
+
return extra_privileges_;
|
199
|
+
}
|
200
|
+
|
184
201
|
bool want_impersonation() const
|
185
202
|
{
|
186
203
|
return !impostor_.empty();
|
@@ -204,6 +221,7 @@ struct lcb_CMDCOUNTER_ {
|
|
204
221
|
bool initialize_if_does_not_exist_{false};
|
205
222
|
lcb_DURABILITY_LEVEL durability_level_{LCB_DURABILITYLEVEL_NONE};
|
206
223
|
std::string impostor_{};
|
224
|
+
std::vector<std::string> extra_privileges_{};
|
207
225
|
};
|
208
226
|
|
209
227
|
/**
|
@@ -28,6 +28,12 @@
|
|
28
28
|
* @private
|
29
29
|
*/
|
30
30
|
struct lcb_CMDEXISTS_ {
|
31
|
+
static const std::string &operation_name()
|
32
|
+
{
|
33
|
+
static std::string name = LCBTRACE_OP_EXISTS;
|
34
|
+
return name;
|
35
|
+
}
|
36
|
+
|
31
37
|
lcb_STATUS key(std::string key)
|
32
38
|
{
|
33
39
|
key_ = std::move(key);
|
@@ -121,6 +127,17 @@ struct lcb_CMDEXISTS_ {
|
|
121
127
|
return LCB_SUCCESS;
|
122
128
|
}
|
123
129
|
|
130
|
+
lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
|
131
|
+
{
|
132
|
+
extra_privileges_.emplace_back(std::move(privilege));
|
133
|
+
return LCB_SUCCESS;
|
134
|
+
}
|
135
|
+
|
136
|
+
const std::vector<std::string> &extra_privileges() const
|
137
|
+
{
|
138
|
+
return extra_privileges_;
|
139
|
+
}
|
140
|
+
|
124
141
|
bool want_impersonation() const
|
125
142
|
{
|
126
143
|
return !impostor_.empty();
|
@@ -139,6 +156,7 @@ struct lcb_CMDEXISTS_ {
|
|
139
156
|
void *cookie_{nullptr};
|
140
157
|
std::string key_{};
|
141
158
|
std::string impostor_{};
|
159
|
+
std::vector<std::string> extra_privileges_{};
|
142
160
|
};
|
143
161
|
|
144
162
|
/**
|
@@ -34,6 +34,11 @@ enum class get_mode {
|
|
34
34
|
* @private
|
35
35
|
*/
|
36
36
|
struct lcb_CMDGET_ {
|
37
|
+
static const std::string &operation_name()
|
38
|
+
{
|
39
|
+
static std::string name = LCBTRACE_OP_GET;
|
40
|
+
return name;
|
41
|
+
}
|
37
42
|
|
38
43
|
lcb_STATUS with_touch(std::uint32_t expiry)
|
39
44
|
{
|
@@ -181,6 +186,17 @@ struct lcb_CMDGET_ {
|
|
181
186
|
return LCB_SUCCESS;
|
182
187
|
}
|
183
188
|
|
189
|
+
lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
|
190
|
+
{
|
191
|
+
extra_privileges_.emplace_back(std::move(privilege));
|
192
|
+
return LCB_SUCCESS;
|
193
|
+
}
|
194
|
+
|
195
|
+
const std::vector<std::string> &extra_privileges() const
|
196
|
+
{
|
197
|
+
return extra_privileges_;
|
198
|
+
}
|
199
|
+
|
184
200
|
bool want_impersonation() const
|
185
201
|
{
|
186
202
|
return !impostor_.empty();
|
@@ -203,6 +219,7 @@ struct lcb_CMDGET_ {
|
|
203
219
|
get_mode mode_{get_mode::normal};
|
204
220
|
bool cookie_is_callback_{false};
|
205
221
|
std::string impostor_{};
|
222
|
+
std::vector<std::string> extra_privileges_{};
|
206
223
|
};
|
207
224
|
|
208
225
|
/** @private */
|
@@ -36,6 +36,12 @@ enum class get_replica_mode {
|
|
36
36
|
* @private
|
37
37
|
*/
|
38
38
|
struct lcb_CMDGETREPLICA_ {
|
39
|
+
static const std::string &operation_name()
|
40
|
+
{
|
41
|
+
static std::string name = LCBTRACE_OP_GET_FROM_REPLICA;
|
42
|
+
return name;
|
43
|
+
}
|
44
|
+
|
39
45
|
lcb_STATUS mode(get_replica_mode mode)
|
40
46
|
{
|
41
47
|
mode_ = mode;
|
@@ -54,7 +60,8 @@ struct lcb_CMDGETREPLICA_ {
|
|
54
60
|
return LCB_SUCCESS;
|
55
61
|
}
|
56
62
|
|
57
|
-
int selected_replica_index() const
|
63
|
+
int selected_replica_index() const
|
64
|
+
{
|
58
65
|
return select_index_;
|
59
66
|
}
|
60
67
|
|
@@ -156,6 +163,17 @@ struct lcb_CMDGETREPLICA_ {
|
|
156
163
|
return LCB_SUCCESS;
|
157
164
|
}
|
158
165
|
|
166
|
+
lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
|
167
|
+
{
|
168
|
+
extra_privileges_.emplace_back(std::move(privilege));
|
169
|
+
return LCB_SUCCESS;
|
170
|
+
}
|
171
|
+
|
172
|
+
const std::vector<std::string> &extra_privileges() const
|
173
|
+
{
|
174
|
+
return extra_privileges_;
|
175
|
+
}
|
176
|
+
|
159
177
|
bool want_impersonation() const
|
160
178
|
{
|
161
179
|
return !impostor_.empty();
|
@@ -176,6 +194,7 @@ struct lcb_CMDGETREPLICA_ {
|
|
176
194
|
get_replica_mode mode_{get_replica_mode::any};
|
177
195
|
int select_index_{0};
|
178
196
|
std::string impostor_{};
|
197
|
+
std::vector<std::string> extra_privileges_{};
|
179
198
|
};
|
180
199
|
|
181
200
|
struct lcb_RESPGETREPLICA_ {
|
@@ -268,6 +268,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_on_behalf_of(lcb_CMDQUERY *cmd, const c
|
|
268
268
|
return cmd->on_behalf_of(std::string(data, data_len));
|
269
269
|
}
|
270
270
|
|
271
|
+
LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_preserve_expiry(lcb_CMDQUERY *cmd, int preserve_expiry)
|
272
|
+
{
|
273
|
+
return cmd->preserve_expiry(preserve_expiry);
|
274
|
+
}
|
275
|
+
|
271
276
|
LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_rc(const lcb_QUERY_ERROR_CONTEXT *ctx)
|
272
277
|
{
|
273
278
|
return ctx->rc;
|
@@ -287,6 +292,14 @@ LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_first_error_message(const lcb_QUERY
|
|
287
292
|
return LCB_SUCCESS;
|
288
293
|
}
|
289
294
|
|
295
|
+
LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_error_response_body(const lcb_QUERY_ERROR_CONTEXT *ctx, const char **body,
|
296
|
+
size_t *body_len)
|
297
|
+
{
|
298
|
+
*body = ctx->error_response_body;
|
299
|
+
*body_len = ctx->error_response_body_len;
|
300
|
+
return LCB_SUCCESS;
|
301
|
+
}
|
302
|
+
|
290
303
|
LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_statement(const lcb_QUERY_ERROR_CONTEXT *ctx, const char **statement,
|
291
304
|
size_t *statement_len)
|
292
305
|
{
|
@@ -30,20 +30,22 @@
|
|
30
30
|
*/
|
31
31
|
struct lcb_QUERY_ERROR_CONTEXT_ {
|
32
32
|
lcb_STATUS rc;
|
33
|
-
uint32_t first_error_code;
|
34
|
-
const char *first_error_message;
|
35
|
-
size_t first_error_message_len;
|
36
|
-
const char *
|
37
|
-
size_t
|
38
|
-
const char *
|
39
|
-
size_t
|
40
|
-
const char *
|
41
|
-
size_t
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
const char *
|
46
|
-
size_t
|
33
|
+
uint32_t first_error_code{};
|
34
|
+
const char *first_error_message{};
|
35
|
+
size_t first_error_message_len{};
|
36
|
+
const char *error_response_body{};
|
37
|
+
size_t error_response_body_len{};
|
38
|
+
const char *statement{};
|
39
|
+
size_t statement_len{};
|
40
|
+
const char *client_context_id{};
|
41
|
+
size_t client_context_id_len{};
|
42
|
+
const char *query_params{};
|
43
|
+
size_t query_params_len{};
|
44
|
+
uint32_t http_response_code{};
|
45
|
+
const char *http_response_message{};
|
46
|
+
size_t http_response_message_len{};
|
47
|
+
const char *endpoint{};
|
48
|
+
size_t endpoint_len{};
|
47
49
|
};
|
48
50
|
|
49
51
|
/**
|
@@ -203,6 +205,12 @@ struct lcb_CMDQUERY_ {
|
|
203
205
|
return LCB_SUCCESS;
|
204
206
|
}
|
205
207
|
|
208
|
+
lcb_STATUS preserve_expiry(bool preserve_expiry)
|
209
|
+
{
|
210
|
+
root_["preserve_expiry"] = preserve_expiry;
|
211
|
+
return LCB_SUCCESS;
|
212
|
+
}
|
213
|
+
|
206
214
|
lcb_STATUS callback(lcb_QUERY_CALLBACK row_callback)
|
207
215
|
{
|
208
216
|
callback_ = row_callback;
|
@@ -28,6 +28,12 @@
|
|
28
28
|
* @private
|
29
29
|
*/
|
30
30
|
struct lcb_CMDREMOVE_ {
|
31
|
+
static const std::string &operation_name()
|
32
|
+
{
|
33
|
+
static std::string name = LCBTRACE_OP_REMOVE;
|
34
|
+
return name;
|
35
|
+
}
|
36
|
+
|
31
37
|
lcb_STATUS cas(std::uint64_t cas)
|
32
38
|
{
|
33
39
|
cas_ = cas;
|
@@ -148,6 +154,17 @@ struct lcb_CMDREMOVE_ {
|
|
148
154
|
return LCB_SUCCESS;
|
149
155
|
}
|
150
156
|
|
157
|
+
lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
|
158
|
+
{
|
159
|
+
extra_privileges_.emplace_back(std::move(privilege));
|
160
|
+
return LCB_SUCCESS;
|
161
|
+
}
|
162
|
+
|
163
|
+
const std::vector<std::string> &extra_privileges() const
|
164
|
+
{
|
165
|
+
return extra_privileges_;
|
166
|
+
}
|
167
|
+
|
151
168
|
bool want_impersonation() const
|
152
169
|
{
|
153
170
|
return !impostor_.empty();
|
@@ -168,6 +185,7 @@ struct lcb_CMDREMOVE_ {
|
|
168
185
|
std::uint64_t cas_{0};
|
169
186
|
lcb_DURABILITY_LEVEL durability_level_{LCB_DURABILITYLEVEL_NONE};
|
170
187
|
std::string impostor_{};
|
188
|
+
std::vector<std::string> extra_privileges_{};
|
171
189
|
};
|
172
190
|
|
173
191
|
/**
|
@@ -70,6 +70,12 @@ struct lcb_RESPSEARCH_ {
|
|
70
70
|
* @private
|
71
71
|
*/
|
72
72
|
struct lcb_CMDSEARCH_ {
|
73
|
+
static const std::string &operation_name()
|
74
|
+
{
|
75
|
+
static std::string name = LCBTRACE_OP_SEARCH;
|
76
|
+
return name;
|
77
|
+
}
|
78
|
+
|
73
79
|
bool has_callback() const
|
74
80
|
{
|
75
81
|
return callback_ != nullptr;
|
@@ -35,6 +35,16 @@ enum class durability_mode {
|
|
35
35
|
* @private
|
36
36
|
*/
|
37
37
|
struct lcb_CMDSTORE_ {
|
38
|
+
const std::string &operation_name() const
|
39
|
+
{
|
40
|
+
static std::map<int, std::string> names{
|
41
|
+
{LCB_STORE_UPSERT, LCBTRACE_OP_UPSERT}, {LCB_STORE_REPLACE, LCBTRACE_OP_REPLACE},
|
42
|
+
{LCB_STORE_APPEND, LCBTRACE_OP_APPEND}, {LCB_STORE_PREPEND, LCBTRACE_OP_PREPEND},
|
43
|
+
{LCB_STORE_INSERT, LCBTRACE_OP_INSERT},
|
44
|
+
};
|
45
|
+
return names[operation_];
|
46
|
+
}
|
47
|
+
|
38
48
|
lcb_STATUS operation(lcb_STORE_OPERATION operation)
|
39
49
|
{
|
40
50
|
operation_ = operation;
|
@@ -123,24 +133,6 @@ struct lcb_CMDSTORE_ {
|
|
123
133
|
return false;
|
124
134
|
}
|
125
135
|
|
126
|
-
const char *operation_name() const
|
127
|
-
{
|
128
|
-
switch (operation_) {
|
129
|
-
case LCB_STORE_UPSERT:
|
130
|
-
return LCBTRACE_OP_UPSERT;
|
131
|
-
case LCB_STORE_REPLACE:
|
132
|
-
return LCBTRACE_OP_REPLACE;
|
133
|
-
case LCB_STORE_APPEND:
|
134
|
-
return LCBTRACE_OP_APPEND;
|
135
|
-
case LCB_STORE_PREPEND:
|
136
|
-
return LCBTRACE_OP_PREPEND;
|
137
|
-
case LCB_STORE_INSERT:
|
138
|
-
return LCBTRACE_OP_INSERT;
|
139
|
-
}
|
140
|
-
lcb_assert(false && "unknown operation name");
|
141
|
-
return "unknown";
|
142
|
-
}
|
143
|
-
|
144
136
|
lcb_STATUS flags(std::uint32_t flags)
|
145
137
|
{
|
146
138
|
if (operation_ == LCB_STORE_APPEND || operation_ == LCB_STORE_PREPEND) {
|
@@ -245,13 +237,16 @@ struct lcb_CMDSTORE_ {
|
|
245
237
|
|
246
238
|
lcb_STATUS value(const lcb_IOV *iov, std::size_t iov_len)
|
247
239
|
{
|
248
|
-
std::
|
240
|
+
std::size_t total_size = 0;
|
241
|
+
for (std::size_t i = 0; i < iov_len; ++i) {
|
242
|
+
total_size += iov[i].iov_len;
|
243
|
+
}
|
244
|
+
value_.reserve(total_size);
|
249
245
|
for (std::size_t i = 0; i < iov_len; ++i) {
|
250
246
|
if (iov[i].iov_len > 0 && iov[i].iov_base != nullptr) {
|
251
|
-
|
247
|
+
value_.append(static_cast<const char *>(iov[i].iov_base), iov[i].iov_len);
|
252
248
|
}
|
253
249
|
}
|
254
|
-
value_ = ss.str();
|
255
250
|
return LCB_SUCCESS;
|
256
251
|
}
|
257
252
|
|
@@ -376,6 +371,17 @@ struct lcb_CMDSTORE_ {
|
|
376
371
|
return LCB_SUCCESS;
|
377
372
|
}
|
378
373
|
|
374
|
+
lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
|
375
|
+
{
|
376
|
+
extra_privileges_.emplace_back(std::move(privilege));
|
377
|
+
return LCB_SUCCESS;
|
378
|
+
}
|
379
|
+
|
380
|
+
const std::vector<std::string> &extra_privileges() const
|
381
|
+
{
|
382
|
+
return extra_privileges_;
|
383
|
+
}
|
384
|
+
|
379
385
|
bool want_impersonation() const
|
380
386
|
{
|
381
387
|
return !impostor_.empty();
|
@@ -407,6 +413,7 @@ struct lcb_CMDSTORE_ {
|
|
407
413
|
bool cookie_is_callback_{false};
|
408
414
|
bool preserve_expiry_{false};
|
409
415
|
std::string impostor_{};
|
416
|
+
std::vector<std::string> extra_privileges_{};
|
410
417
|
};
|
411
418
|
|
412
419
|
/**
|
@@ -114,6 +114,12 @@ struct subdoc_spec_options {
|
|
114
114
|
* This structure is provided in an array to the lcb_CMDSUBDOC::specs field.
|
115
115
|
*/
|
116
116
|
struct subdoc_spec {
|
117
|
+
bool is_lookup() const
|
118
|
+
{
|
119
|
+
return opcode_ == subdoc_opcode::get || opcode_ == subdoc_opcode::get_count ||
|
120
|
+
opcode_ == subdoc_opcode::get_fulldoc || opcode_ == subdoc_opcode::exist;
|
121
|
+
}
|
122
|
+
|
117
123
|
subdoc_opcode opcode() const
|
118
124
|
{
|
119
125
|
return opcode_;
|
@@ -216,11 +222,23 @@ struct lcb_SUBDOCSPECS_ {
|
|
216
222
|
return specs_;
|
217
223
|
}
|
218
224
|
|
225
|
+
bool is_lookup() const
|
226
|
+
{
|
227
|
+
return specs_.empty() || specs_[0].is_lookup();
|
228
|
+
}
|
229
|
+
|
219
230
|
private:
|
220
231
|
std::vector<subdoc_spec> specs_{};
|
221
232
|
};
|
222
233
|
|
223
234
|
struct lcb_CMDSUBDOC_ {
|
235
|
+
const std::string &operation_name() const
|
236
|
+
{
|
237
|
+
static std::string lookup_in_name = LCBTRACE_OP_LOOKUPIN;
|
238
|
+
static std::string mutate_in_name = LCBTRACE_OP_MUTATEIN;
|
239
|
+
return specs_.is_lookup() ? lookup_in_name : mutate_in_name;
|
240
|
+
}
|
241
|
+
|
224
242
|
const subdoc_options &options() const
|
225
243
|
{
|
226
244
|
return options_;
|
@@ -427,6 +445,17 @@ struct lcb_CMDSUBDOC_ {
|
|
427
445
|
return LCB_SUCCESS;
|
428
446
|
}
|
429
447
|
|
448
|
+
lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
|
449
|
+
{
|
450
|
+
extra_privileges_.emplace_back(std::move(privilege));
|
451
|
+
return LCB_SUCCESS;
|
452
|
+
}
|
453
|
+
|
454
|
+
const std::vector<std::string> &extra_privileges() const
|
455
|
+
{
|
456
|
+
return extra_privileges_;
|
457
|
+
}
|
458
|
+
|
430
459
|
bool want_impersonation() const
|
431
460
|
{
|
432
461
|
return !impostor_.empty();
|
@@ -451,6 +480,7 @@ struct lcb_CMDSUBDOC_ {
|
|
451
480
|
lcb_SUBDOCSPECS_ specs_{};
|
452
481
|
bool preserve_expiry_{false};
|
453
482
|
std::string impostor_{};
|
483
|
+
std::vector<std::string> extra_privileges_{};
|
454
484
|
};
|
455
485
|
|
456
486
|
/**
|
@@ -28,6 +28,12 @@
|
|
28
28
|
* @private
|
29
29
|
*/
|
30
30
|
struct lcb_CMDTOUCH_ {
|
31
|
+
static const std::string &operation_name()
|
32
|
+
{
|
33
|
+
static std::string name = LCBTRACE_OP_TOUCH;
|
34
|
+
return name;
|
35
|
+
}
|
36
|
+
|
31
37
|
lcb_STATUS expiry(std::uint32_t expiry)
|
32
38
|
{
|
33
39
|
expiry_ = expiry;
|
@@ -132,6 +138,17 @@ struct lcb_CMDTOUCH_ {
|
|
132
138
|
return LCB_SUCCESS;
|
133
139
|
}
|
134
140
|
|
141
|
+
lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
|
142
|
+
{
|
143
|
+
extra_privileges_.emplace_back(std::move(privilege));
|
144
|
+
return LCB_SUCCESS;
|
145
|
+
}
|
146
|
+
|
147
|
+
const std::vector<std::string> &extra_privileges() const
|
148
|
+
{
|
149
|
+
return extra_privileges_;
|
150
|
+
}
|
151
|
+
|
135
152
|
bool want_impersonation() const
|
136
153
|
{
|
137
154
|
return !impostor_.empty();
|
@@ -151,6 +168,7 @@ struct lcb_CMDTOUCH_ {
|
|
151
168
|
void *cookie_{nullptr};
|
152
169
|
std::string key_{};
|
153
170
|
std::string impostor_{};
|
171
|
+
std::vector<std::string> extra_privileges_{};
|
154
172
|
};
|
155
173
|
|
156
174
|
/**
|
@@ -28,6 +28,12 @@
|
|
28
28
|
* @private
|
29
29
|
*/
|
30
30
|
struct lcb_CMDUNLOCK_ {
|
31
|
+
static const std::string &operation_name()
|
32
|
+
{
|
33
|
+
static std::string name = LCBTRACE_OP_UNLOCK;
|
34
|
+
return name;
|
35
|
+
}
|
36
|
+
|
31
37
|
lcb_STATUS cas(std::uint64_t cas)
|
32
38
|
{
|
33
39
|
if (cas == 0) {
|
@@ -135,6 +141,17 @@ struct lcb_CMDUNLOCK_ {
|
|
135
141
|
return LCB_SUCCESS;
|
136
142
|
}
|
137
143
|
|
144
|
+
lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
|
145
|
+
{
|
146
|
+
extra_privileges_.emplace_back(std::move(privilege));
|
147
|
+
return LCB_SUCCESS;
|
148
|
+
}
|
149
|
+
|
150
|
+
const std::vector<std::string> &extra_privileges() const
|
151
|
+
{
|
152
|
+
return extra_privileges_;
|
153
|
+
}
|
154
|
+
|
138
155
|
bool want_impersonation() const
|
139
156
|
{
|
140
157
|
return !impostor_.empty();
|
@@ -154,6 +171,7 @@ struct lcb_CMDUNLOCK_ {
|
|
154
171
|
std::string key_{};
|
155
172
|
std::uint64_t cas_{};
|
156
173
|
std::string impostor_{};
|
174
|
+
std::vector<std::string> extra_privileges_{};
|
157
175
|
};
|
158
176
|
|
159
177
|
/**
|
@@ -47,6 +47,12 @@ struct lcb_VIEW_ERROR_CONTEXT_ {
|
|
47
47
|
|
48
48
|
/** @private */
|
49
49
|
struct lcb_CMDVIEW_ {
|
50
|
+
static const std::string &operation_name()
|
51
|
+
{
|
52
|
+
static std::string name = LCBTRACE_OP_VIEW;
|
53
|
+
return name;
|
54
|
+
}
|
55
|
+
|
50
56
|
bool view_or_design_document_empty() const
|
51
57
|
{
|
52
58
|
return view_name_.empty() || design_document_name_.empty();
|
@@ -21,7 +21,6 @@
|
|
21
21
|
#include <cstddef>
|
22
22
|
#include <cstdint>
|
23
23
|
#include <string>
|
24
|
-
#include <sstream>
|
25
24
|
#include <stdexcept>
|
26
25
|
|
27
26
|
namespace lcb
|
@@ -48,11 +47,10 @@ struct collection_qualifier {
|
|
48
47
|
if (collection_name != nullptr && collection_name_len > 0) {
|
49
48
|
collection_.assign(collection_name, collection_name_len);
|
50
49
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
spec_ = ss.str();
|
50
|
+
|
51
|
+
spec_ = (scope_.empty() ? "_default" : scope_) +
|
52
|
+
'.' +
|
53
|
+
(collection_.empty() ? "_default" : collection_);
|
56
54
|
}
|
57
55
|
|
58
56
|
const std::string &scope() const
|
@@ -135,8 +133,8 @@ struct collection_qualifier {
|
|
135
133
|
return true;
|
136
134
|
}
|
137
135
|
|
138
|
-
std::string scope_{};
|
139
|
-
std::string collection_{};
|
136
|
+
std::string scope_{"_default"};
|
137
|
+
std::string collection_{"_default"};
|
140
138
|
std::string spec_{};
|
141
139
|
std::uint32_t resolved_collection_id_{0};
|
142
140
|
bool resolved_{false};
|