libcouchbase 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +2 -2
  3. data/ext/libcouchbase/CMakeLists.txt +51 -25
  4. data/ext/libcouchbase/CONTRIBUTING.md +46 -65
  5. data/ext/libcouchbase/RELEASE_NOTES.markdown +163 -0
  6. data/ext/libcouchbase/cmake/Modules/DownloadLcbDep.cmake +9 -11
  7. data/ext/libcouchbase/cmake/Modules/FindProfiler.cmake +16 -0
  8. data/ext/libcouchbase/cmake/Modules/GetVersionInfo.cmake +6 -6
  9. data/ext/libcouchbase/cmake/config-cmake.h.in +2 -0
  10. data/ext/libcouchbase/cmake/configure +16 -0
  11. data/ext/libcouchbase/example/CMakeLists.txt +17 -2
  12. data/ext/libcouchbase/example/analytics/.gitignore +1 -0
  13. data/ext/libcouchbase/example/analytics/analytics.c +158 -0
  14. data/ext/libcouchbase/example/analytics/build-queries.rb +34 -0
  15. data/ext/libcouchbase/example/analytics/cJSON.c +1 -0
  16. data/ext/libcouchbase/example/analytics/cJSON.h +1 -0
  17. data/ext/libcouchbase/example/analytics/queries.h +113 -0
  18. data/ext/libcouchbase/example/analytics/queries/00-show-dataverse.json +5 -0
  19. data/ext/libcouchbase/example/analytics/queries/01-setup-dataset-breweries.json +6 -0
  20. data/ext/libcouchbase/example/analytics/queries/02-setup-dataset-beers.json +6 -0
  21. data/ext/libcouchbase/example/analytics/queries/03-initiate-shadow.json +6 -0
  22. data/ext/libcouchbase/example/analytics/queries/04-list-datasets.json +7 -0
  23. data/ext/libcouchbase/example/analytics/queries/05-count-breweries.json +5 -0
  24. data/ext/libcouchbase/example/analytics/queries/06-first-brewery.json +6 -0
  25. data/ext/libcouchbase/example/analytics/queries/07-key-based-lookup.json +6 -0
  26. data/ext/libcouchbase/example/analytics/queries/08-exact-match-lookup.json +7 -0
  27. data/ext/libcouchbase/example/analytics/queries/09-exact-match-lookup-different-shape.json +6 -0
  28. data/ext/libcouchbase/example/analytics/queries/10-other-query-filters.json +6 -0
  29. data/ext/libcouchbase/example/analytics/queries/11-equijoin.json +9 -0
  30. data/ext/libcouchbase/example/analytics/queries/12-equijoin-select-star.json +10 -0
  31. data/ext/libcouchbase/example/analytics/queries/13-ansi-join.json +8 -0
  32. data/ext/libcouchbase/example/analytics/queries/14-join-select-values.json +8 -0
  33. data/ext/libcouchbase/example/analytics/queries/15-nested-outer-join.json +7 -0
  34. data/ext/libcouchbase/example/analytics/queries/16-theta-join.json +8 -0
  35. data/ext/libcouchbase/example/analytics/queries/17-existential-quantification.json +9 -0
  36. data/ext/libcouchbase/example/analytics/queries/18-universal-quantification.json +7 -0
  37. data/ext/libcouchbase/example/analytics/queries/19-simple-aggregation.json +6 -0
  38. data/ext/libcouchbase/example/analytics/queries/20-simple-aggregation-unwrapped-value.json +6 -0
  39. data/ext/libcouchbase/example/analytics/queries/21-simple-aggregation-explicit.json +6 -0
  40. data/ext/libcouchbase/example/analytics/queries/22-grouping-and-aggregation.json +6 -0
  41. data/ext/libcouchbase/example/analytics/queries/23-grouping-and-aggregation-with-hint.json +7 -0
  42. data/ext/libcouchbase/example/analytics/queries/24-grouping-and-limits.json +7 -0
  43. data/ext/libcouchbase/example/analytics/queries/25-named-parameters.json +7 -0
  44. data/ext/libcouchbase/example/analytics/queries/26-positional-parameters.json +7 -0
  45. data/ext/libcouchbase/example/crypto/common_provider.c +2 -0
  46. data/ext/libcouchbase/example/crypto/common_provider.h +2 -0
  47. data/ext/libcouchbase/example/crypto/openssl_symmetric_decrypt.c +5 -0
  48. data/ext/libcouchbase/example/crypto/openssl_symmetric_encrypt.c +0 -1
  49. data/ext/libcouchbase/example/crypto/openssl_symmetric_provider.c +16 -26
  50. data/ext/libcouchbase/example/db/db.c +10 -6
  51. data/ext/libcouchbase/example/fts/.gitignore +1 -0
  52. data/ext/libcouchbase/example/fts/build-queries.rb +33 -0
  53. data/ext/libcouchbase/example/fts/fts.c +142 -0
  54. data/ext/libcouchbase/example/fts/queries.h +61 -0
  55. data/ext/libcouchbase/example/fts/queries/00-simple-text-query.json +12 -0
  56. data/ext/libcouchbase/example/fts/queries/01-simple-text-query-on-non-default-index.json +9 -0
  57. data/ext/libcouchbase/example/fts/queries/02-simple-text-query-on-stored-field.json +13 -0
  58. data/ext/libcouchbase/example/fts/queries/03-match-query-with-facet.json +19 -0
  59. data/ext/libcouchbase/example/fts/queries/04-docid-query.json +11 -0
  60. data/ext/libcouchbase/example/fts/queries/05-unanalyzed-term-query-with-fuzziness-level-of-0.json +13 -0
  61. data/ext/libcouchbase/example/fts/queries/06-unanalyzed-term-query-with-fuzziness-level-of-2.json +14 -0
  62. data/ext/libcouchbase/example/fts/queries/07-match-phrase-query.json +13 -0
  63. data/ext/libcouchbase/example/fts/queries/08-phrase-query.json +16 -0
  64. data/ext/libcouchbase/example/fts/queries/09-query-string-query.json +9 -0
  65. data/ext/libcouchbase/example/fts/queries/10-conjunction-query.json +21 -0
  66. data/ext/libcouchbase/example/fts/queries/11-wild-card-query.json +13 -0
  67. data/ext/libcouchbase/example/fts/queries/12-numeric-range-query.json +11 -0
  68. data/ext/libcouchbase/example/fts/queries/13-regexp-query.json +13 -0
  69. data/ext/libcouchbase/example/minimal/.gitignore +1 -0
  70. data/ext/libcouchbase/example/minimal/query.c +185 -0
  71. data/ext/libcouchbase/example/subdoc/subdoc-xattrs.c +2 -2
  72. data/ext/libcouchbase/example/tracing/cJSON.c +1 -1
  73. data/ext/libcouchbase/example/tracing/cJSON.h +1 -1
  74. data/ext/libcouchbase/include/libcouchbase/cbft.h +38 -4
  75. data/ext/libcouchbase/include/libcouchbase/cntl-private.h +8 -97
  76. data/ext/libcouchbase/include/libcouchbase/cntl.h +288 -8
  77. data/ext/libcouchbase/include/libcouchbase/couchbase.h +47 -10
  78. data/ext/libcouchbase/include/libcouchbase/crypto.h +214 -48
  79. data/ext/libcouchbase/include/libcouchbase/deprecated.h +12 -0
  80. data/ext/libcouchbase/include/libcouchbase/error.h +33 -2
  81. data/ext/libcouchbase/include/libcouchbase/ixmgmt.h +1 -1
  82. data/ext/libcouchbase/include/libcouchbase/n1ql.h +87 -13
  83. data/ext/libcouchbase/include/libcouchbase/subdoc.h +3 -7
  84. data/ext/libcouchbase/include/libcouchbase/tracing.h +174 -56
  85. data/ext/libcouchbase/include/libcouchbase/vbucket.h +21 -1
  86. data/ext/libcouchbase/include/libcouchbase/views.h +49 -4
  87. data/ext/libcouchbase/packaging/deb/control +2 -3
  88. data/ext/libcouchbase/packaging/parse-git-describe.pl +1 -1
  89. data/ext/libcouchbase/plugins/io/libev/CMakeLists.txt +7 -5
  90. data/ext/libcouchbase/plugins/io/libevent/CMakeLists.txt +7 -5
  91. data/ext/libcouchbase/plugins/io/libuv/CMakeLists.txt +14 -12
  92. data/ext/libcouchbase/plugins/io/libuv/libuv_compat.h +3 -0
  93. data/ext/libcouchbase/plugins/io/libuv/plugin-libuv.c +14 -6
  94. data/ext/libcouchbase/plugins/io/select/CMakeLists.txt +7 -5
  95. data/ext/libcouchbase/src/bootstrap.cc +6 -1
  96. data/ext/libcouchbase/src/bucketconfig/bc_cccp.cc +2 -7
  97. data/ext/libcouchbase/src/bucketconfig/bc_file.cc +1 -1
  98. data/ext/libcouchbase/src/bucketconfig/bc_http.cc +4 -11
  99. data/ext/libcouchbase/src/bucketconfig/clconfig.h +29 -36
  100. data/ext/libcouchbase/src/bucketconfig/confmon.cc +4 -2
  101. data/ext/libcouchbase/src/cntl.cc +181 -151
  102. data/ext/libcouchbase/src/config_static.h +1 -1
  103. data/ext/libcouchbase/src/connspec.cc +5 -1
  104. data/ext/libcouchbase/src/connspec.h +3 -1
  105. data/ext/libcouchbase/src/crypto.cc +93 -80
  106. data/ext/libcouchbase/src/dns-srv.cc +1 -1
  107. data/ext/libcouchbase/src/handler.cc +0 -1
  108. data/ext/libcouchbase/src/http/http-priv.h +1 -0
  109. data/ext/libcouchbase/src/http/http.cc +1 -2
  110. data/ext/libcouchbase/src/instance.cc +21 -2
  111. data/ext/libcouchbase/src/internal.h +1 -0
  112. data/ext/libcouchbase/src/lcbio/ctx.c +24 -3
  113. data/ext/libcouchbase/src/lcbio/ioutils.cc +1 -1
  114. data/ext/libcouchbase/src/lcbio/rw-inl.h +22 -1
  115. data/ext/libcouchbase/src/lcbio/ssl.h +2 -0
  116. data/ext/libcouchbase/src/mc/compress.cc +18 -11
  117. data/ext/libcouchbase/src/mc/mcreq.c +2 -0
  118. data/ext/libcouchbase/src/mc/mcreq.h +1 -1
  119. data/ext/libcouchbase/src/mcserver/mcserver.cc +163 -6
  120. data/ext/libcouchbase/src/mcserver/negotiate.cc +17 -7
  121. data/ext/libcouchbase/src/n1ql/n1ql.cc +12 -3
  122. data/ext/libcouchbase/src/newconfig.cc +4 -3
  123. data/ext/libcouchbase/src/nodeinfo.cc +1 -7
  124. data/ext/libcouchbase/src/operations/observe.cc +1 -0
  125. data/ext/libcouchbase/src/operations/ping.cc +5 -3
  126. data/ext/libcouchbase/src/retryq.cc +22 -0
  127. data/ext/libcouchbase/src/retryq.h +2 -1
  128. data/ext/libcouchbase/src/rnd.cc +5 -12
  129. data/ext/libcouchbase/src/settings.c +4 -7
  130. data/ext/libcouchbase/src/settings.h +6 -2
  131. data/ext/libcouchbase/src/strcodecs/base64.c +59 -0
  132. data/ext/libcouchbase/src/strcodecs/strcodecs.h +2 -0
  133. data/ext/libcouchbase/src/trace.h +2 -2
  134. data/ext/libcouchbase/src/tracing/span.cc +177 -45
  135. data/ext/libcouchbase/src/tracing/threshold_logging_tracer.cc +70 -28
  136. data/ext/libcouchbase/src/tracing/tracing-internal.h +33 -48
  137. data/ext/libcouchbase/src/vbucket/vbucket.c +146 -30
  138. data/ext/libcouchbase/src/wait.cc +1 -1
  139. data/ext/libcouchbase/tests/CMakeLists.txt +13 -4
  140. data/ext/libcouchbase/tests/iotests/mock-environment.cc +1 -1
  141. data/ext/libcouchbase/tests/iotests/t_misc.cc +2 -2
  142. data/ext/libcouchbase/tests/iotests/t_views.cc +1 -1
  143. data/ext/libcouchbase/tests/iotests/testutil.cc +3 -2
  144. data/ext/libcouchbase/tests/vbucket/confdata/map_node_present_nodesext_missing_nodes.json +94 -0
  145. data/ext/libcouchbase/tests/vbucket/t_config.cc +15 -0
  146. data/ext/libcouchbase/tools/CMakeLists.txt +11 -6
  147. data/ext/libcouchbase/tools/cbc-handlers.h +9 -0
  148. data/ext/libcouchbase/tools/cbc-proxy.cc +1 -1
  149. data/ext/libcouchbase/tools/cbc.cc +33 -5
  150. data/ext/libcouchbase/tools/common/options.cc +1 -1
  151. data/ext/libcouchbase/tools/extract-packets.rb +110 -0
  152. data/lib/libcouchbase/connection.rb +13 -5
  153. data/lib/libcouchbase/ext/tasks.rb +1 -1
  154. data/lib/libcouchbase/version.rb +1 -1
  155. metadata +62 -7
@@ -294,6 +294,18 @@ typedef enum {
294
294
  LCB_HTTP_STATUS_INSUFFICIENT_STORAGE = 507
295
295
  } lcb_http_status_t;
296
296
 
297
+ /**
298
+ * @deprecated
299
+ */
300
+ typedef enum {
301
+ /* encryption (e.g. private key for assymetric ciphers) */
302
+ LCBCRYPTO_KEY_ENCRYPT = 0,
303
+ /* decryption (e.g. private key for assymetric ciphers) */
304
+ LCBCRYPTO_KEY_DECRYPT = 1,
305
+ LCBCRYPTO_KEY__MAX
306
+ } lcbcrypto_KEYTYPE;
307
+
308
+
297
309
  #ifdef __cplusplus
298
310
  }
299
311
  #endif
@@ -460,87 +460,118 @@ typedef enum {
460
460
  X(LCB_MUTATION_LOST, 0x3E, LCB_ERRTYPE_SRVGEN,\
461
461
  "The given mutation has been permanently lost due to the node failing " \
462
462
  "before replication") \
463
+ /** Sub-document path does not exist */ \
463
464
  X(LCB_SUBDOC_PATH_ENOENT, 0x3F, \
464
465
  LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
465
466
  "Sub-document path does not exist") \
467
+ /** Type of element in sub-document path conflicts with type in document */ \
466
468
  X(LCB_SUBDOC_PATH_MISMATCH, 0x40,\
467
469
  LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
468
470
  "Type of element in sub-document path conflicts with type in document") \
471
+ /** Malformed sub-document path */ \
469
472
  X(LCB_SUBDOC_PATH_EINVAL, 0x41, \
470
473
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
471
474
  "Malformed sub-document path") \
475
+ /** Sub-document contains too many components */ \
472
476
  X(LCB_SUBDOC_PATH_E2BIG, 0x42, \
473
477
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
474
478
  "Sub-document contains too many components") \
479
+ /** Existing document contains too many levels of nesting */ \
475
480
  X(LCB_SUBDOC_DOC_E2DEEP, 0x43,\
476
481
  LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
477
482
  "Existing document contains too many levels of nesting") \
483
+ /** Subdocument operation would invalidate the JSON */ \
478
484
  X(LCB_SUBDOC_VALUE_CANTINSERT, 0x44, \
479
485
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
480
486
  "Subdocument operation would invalidate the JSON") \
487
+ /** Existing document is not valid JSON */ \
481
488
  X(LCB_SUBDOC_DOC_NOTJSON, 0x45,\
482
489
  LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
483
490
  "Existing document is not valid JSON") \
491
+ /** The existing numeric value is too large */ \
484
492
  X(LCB_SUBDOC_NUM_ERANGE, 0x46, \
485
493
  LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
486
494
  "The existing numeric value is too large") \
495
+ /** Delta must be numeric, within the 64 bit signed range, and non-zero */ \
487
496
  X(LCB_SUBDOC_BAD_DELTA, 0x47,\
488
497
  LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
489
498
  "Delta must be numeric, within the 64 bit signed range, and non-zero") \
499
+ /** The given path already exists in the document */ \
490
500
  X(LCB_SUBDOC_PATH_EEXISTS, 0x48,\
491
501
  LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
492
502
  "The given path already exists in the document") \
503
+ /** Could not execute one or more multi lookups or mutations */ \
493
504
  X(LCB_SUBDOC_MULTI_FAILURE, 0x49,\
494
505
  LCB_ERRTYPE_DATAOP|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
495
506
  "Could not execute one or more multi lookups or mutations") \
507
+ /** Value is too deep to insert */ \
496
508
  X(LCB_SUBDOC_VALUE_E2DEEP, 0x4A,\
497
509
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
498
510
  "Value is too deep to insert") \
511
+ /** A badly formatted packet was sent to the server. Please report this in a bug */ \
499
512
  X(LCB_EINVAL_MCD, 0x4B, LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_INTERNAL, \
500
513
  "A badly formatted packet was sent to the server. Please report this in a bug") \
514
+ /** Missing subdocument path */ \
501
515
  X(LCB_EMPTY_PATH, 0x4C, LCB_ERRTYPE_INPUT, "Missing subdocument path") \
516
+ /** Unknown subdocument command */ \
502
517
  X(LCB_UNKNOWN_SDCMD, 0x4D, LCB_ERRTYPE_INPUT, "Unknown subdocument command") \
518
+ /** No commands specified */ \
503
519
  X(LCB_ENO_COMMANDS, 0x4E, LCB_ERRTYPE_INPUT, "No commands specified") \
520
+ /** Query execution failed. Inspect raw response object for information */ \
504
521
  X(LCB_QUERY_ERROR, 0x4F, LCB_ERRTYPE_SRVGEN, \
505
522
  "Query execution failed. Inspect raw response object for information") \
506
- \
523
+ /** Generic temporary error received from server*/ \
507
524
  X(LCB_GENERIC_TMPERR, 0x50, LCB_ERRTYPE_TRANSIENT|LCB_ERRTYPE_SRVGEN, \
508
525
  "Generic temporary error received from server") \
526
+ /** Generic subdocument error received from server*/ \
509
527
  X(LCB_GENERIC_SUBDOCERR, 0x51, LCB_ERRTYPE_SUBDOC|LCB_ERRTYPE_SRVGEN, \
510
528
  "Generic subdocument error received from server") \
529
+ /** Generic constraint error received from server*/ \
511
530
  X(LCB_GENERIC_CONSTRAINT_ERR, 0x52, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN, \
512
531
  "Generic constraint error received from server") \
532
+ /** Invalid reply received from nameserver*/ \
513
533
  X(LCB_NAMESERVER_ERROR, 0x53, LCB_ERRTYPE_NETWORK, \
514
534
  "Invalid reply received from nameserver") \
535
+ /** Not authorized for operation*/ \
515
536
  X(LCB_NOT_AUTHORIZED, 0x54, LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN, \
516
537
  "Not authorized for operation") \
538
+ /** An invalid combination of commands was specified*/ \
517
539
  X(LCB_SUBDOC_INVALID_COMBO, 0x55, \
518
540
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
519
541
  "An invalid combination of commands was specified") \
542
+ /** Specified key was successfully found, but one or more path operations failed*/ \
520
543
  X(LCB_SUBDOC_MULTI_PATH_FAILURE, 0x56, \
521
544
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
522
545
  "Specified key was successfully found, but one or more path operations failed") \
546
+ /** The operation completed successfully, but operated on a deleted document*/ \
523
547
  X(LCB_SUBDOC_SUCCESS_DELETED, 0x57, \
524
548
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
525
549
  "The operation completed successfully, but operated on a deleted document") \
550
+ /** The combination of the subdoc flags for the xattrs is not valid*/ \
526
551
  X(LCB_SUBDOC_XATTR_INVALID_FLAG_COMBO, 0x58, \
527
552
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
528
553
  "The combination of the subdoc flags for the xattrs is not valid") \
554
+ /** Only a single xattr key may be accessed at the same time*/ \
529
555
  X(LCB_SUBDOC_XATTR_INVALID_KEY_COMBO, 0x59, \
530
556
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
531
557
  "Only a single xattr key may be accessed at the same time") \
558
+ /** The server has no knowledge of the requested macro*/ \
532
559
  X(LCB_SUBDOC_XATTR_UNKNOWN_MACRO, 0x5a, \
533
560
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
534
561
  "The server has no knowledge of the requested macro") \
562
+ /** The server has no knowledge of the requested virtual xattr */ \
535
563
  X(LCB_SUBDOC_XATTR_UNKNOWN_VATTR, 0x5b, \
536
564
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
537
565
  "The server has no knowledge of the requested virtual xattr") \
566
+ /** Virtual xattrs cannot be modified */ \
538
567
  X(LCB_SUBDOC_XATTR_CANT_MODIFY_VATTR, 0x5c, \
539
568
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
540
569
  "Virtual xattrs cannot be modified") \
570
+ /** Specified key was found as a deleted document, but one or more path operations failed*/ \
541
571
  X(LCB_SUBDOC_MULTI_PATH_FAILURE_DELETED, 0x5d, \
542
572
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
543
573
  "Specified key was found as a deleted document, but one or more path operations failed") \
574
+ /** According to the spec all xattr commands should come first, followed by the commands for the document body */ \
544
575
  X(LCB_SUBDOC_INVALID_XATTR_ORDER, 0x5e, \
545
576
  LCB_ERRTYPE_INPUT|LCB_ERRTYPE_SRVGEN|LCB_ERRTYPE_SUBDOC, \
546
577
  "According to the spec all xattr commands should come first, followed by the commands for the document body")
@@ -558,7 +589,7 @@ typedef enum {
558
589
  LCB_MAX_ERROR_VAL,
559
590
  #endif
560
591
 
561
- /* The errors below this value reserver for libcouchbase usage. */
592
+ /** The errors below this value reserved for libcouchbase usage. */
562
593
  LCB_MAX_ERROR = 0x1000
563
594
  } lcb_error_t;
564
595
 
@@ -43,7 +43,7 @@ typedef struct {
43
43
  * populate the internal equivalents of the fields in this structure.
44
44
  *
45
45
  * Note that when using this field as an input for creating indexes, you
46
- * should still set the ::flags field if you wish to set flags (e.g. in
46
+ * should still set the @ref flags field if you wish to set flags (e.g. in
47
47
  * order to create a deferred-build index).
48
48
  */
49
49
  const char *rawjson;
@@ -25,8 +25,48 @@ extern "C" {
25
25
 
26
26
  /**
27
27
  * @ingroup lcb-public-api
28
- * @defgroup lcb-n1ql-api N1QL
29
- * @brief Execute N1QL queries and receive resultant rows
28
+ * @defgroup lcb-n1ql-api N1QL/Analytics
29
+ * @brief Execute N1QL/Analytics queries.
30
+ *
31
+ * Query language based on SQL, but designed for structured and flexible JSON
32
+ * documents. Querying can solve typical programming tasks such as finding a
33
+ * user profile by email address, performing aggregations etc.
34
+ *
35
+ * @code{.c}
36
+ * const char *query = "{\"statement\":\"SELECT * FROM breweries LIMIT 10\"}";
37
+ * lcb_CMDN1QL cmd = {0};
38
+ * int idx = 0;
39
+ * // NOTE: with this flag, the request will be issued to Analytics service
40
+ * cmd.cmdflags = LCB_CMDN1QL_F_ANALYTICSQUERY;
41
+ * cmd.callback = row_callback;
42
+ * cmd.query = query;
43
+ * cmd.nquery = strlen(query);
44
+ * lcb_n1ql_query(instance, &idx, &cmd);
45
+ * lcb_wait(instance);
46
+ * @endcode
47
+ *
48
+ * Where row_callback might be implemented like this:
49
+ *
50
+ * @code{.c}
51
+ * static void row_callback(lcb_t instance, int type, const lcb_RESPN1QL *resp)
52
+ * {
53
+ * int *idx = (int *)resp->cookie;
54
+ * if (resp->rc != LCB_SUCCESS) {
55
+ * printf("failed to execute query: %s\n", lcb_strerror_short(resp->rc));
56
+ * exit(EXIT_FAILURE);
57
+ * }
58
+ * if (resp->rflags & LCB_RESP_F_FINAL) {
59
+ * printf("META: ");
60
+ * } else {
61
+ * printf("ROW #%d: ", (*idx)++);
62
+ * }
63
+ * printf("%.*s\n", (int)resp->nrow, (char *)resp->row);
64
+ * }
65
+ * @endcode
66
+ *
67
+ * @see more details on @ref lcb_n1ql_query and @ref lcb_CMDN1QL.
68
+ *
69
+ * Also there is a query builder available for N1QL queries: @ref lcb_n1p_new/@ref lcb_n1p_mkcmd.
30
70
  */
31
71
 
32
72
  /**
@@ -35,6 +75,9 @@ extern "C" {
35
75
  */
36
76
  typedef struct lcb_RESPN1QL lcb_RESPN1QL;
37
77
  typedef struct lcb_CMDN1QL lcb_CMDN1QL;
78
+ /**
79
+ * Pointer for request instance
80
+ */
38
81
  typedef struct lcb_N1QLREQ* lcb_N1QLHANDLE;
39
82
 
40
83
  /**
@@ -324,13 +367,13 @@ lcb_n1p_mkcmd(lcb_N1QLPARAMS *params, lcb_CMDN1QL *cmd);
324
367
  #define LCB_CMDN1QL_F_JSONQUERY (1 << 17)
325
368
 
326
369
  /**
327
- * This is an analytics query. Use the `host` field to specify the host/port
328
- * to target. When this flag is set, things like prepared queries and
329
- * parametrized statements will not work.
370
+ * This is an Analytics query.
330
371
  *
331
- * @uncommitted
372
+ * @committed
332
373
  */
333
- #define LCB_CMDN1QL_F_CBASQUERY (1 << 18)
374
+ #define LCB_CMDN1QL_F_ANALYTICSQUERY (1 << 18)
375
+ /* @private an alias for compatibility */
376
+ #define LCB_CMDN1QL_F_CBASQUERY LCB_CMDN1QL_F_ANALYTICSQUERY
334
377
 
335
378
  /**
336
379
  * Command structure for N1QL queries. Typically an application will use the
@@ -406,6 +449,8 @@ struct lcb_RESPN1QL {
406
449
  *
407
450
  * This function will send the query to a query server in the cluster
408
451
  * and will invoke the callback (lcb_CMDN1QL::callback) for each result returned.
452
+ * By default it will run query as N1QL flavour, for Analytics set
453
+ * @ref LCB_CMDN1QL_F_ANALYTICSQUERY flag in cmdflags of @ref lcb_CMDN1QL argument.
409
454
  *
410
455
  * @param instance The instance
411
456
  * @param cookie Pointer to application data
@@ -447,18 +492,47 @@ LIBCOUCHBASE_API
447
492
  void
448
493
  lcb_n1ql_cancel(lcb_t instance, lcb_N1QLHANDLE handle);
449
494
 
495
+ /**@}*/
496
+
497
+ /**@}*/
498
+
499
+ /**
500
+ * @ingroup lcb-public-api
501
+ * @addtogroup lcb-tracing-api
502
+ * @{
503
+ */
450
504
  #ifdef LCB_TRACING
505
+
451
506
  /**
452
- * @uncommitted
507
+ * Associate parent tracing span with the N1QL request.
508
+ *
509
+ * @param instance the instance
510
+ * @param handle N1QL request handle
511
+ * @param span parent span
512
+ *
513
+ * @par Attach parent tracing span to request object.
514
+ * @code{.c}
515
+ * lcb_CMDN1QL cmd = {};
516
+ * // initialize N1QL command...
517
+ *
518
+ * lcb_N1QLHANDLE handle = NULL;
519
+ * cmd->handle = &handle;
520
+ *
521
+ * lcb_error_t err = lcb_fts_query(instance, cookie, cmd);
522
+ * if (err == LCB_SUCCESS) {
523
+ * lcb_n1ql_set_parent_span(instance, handle, span);
524
+ * }
525
+ * @endcode
526
+ *
527
+ * @committed
453
528
  */
454
529
  LIBCOUCHBASE_API
455
530
  void lcb_n1ql_set_parent_span(lcb_t instance, lcb_N1QLHANDLE handle, lcbtrace_SPAN *span);
456
- #endif
457
-
458
- /**@}*/
459
-
460
- /**@}*/
461
531
 
532
+ #endif
533
+ /**
534
+ * @} (Group: Tracing)
535
+ */
462
536
  #ifdef __cplusplus
463
537
  }
464
538
  #endif
@@ -28,10 +28,6 @@ extern "C" {
28
28
  * 4.5 release which allows access to parts of the document. These parts are
29
29
  * called _sub-documents_ and can be accessed using the sub-document API
30
30
  *
31
- * @warning
32
- * The sub-document API is experimental and subject to change and is here for
33
- * demonstration purposes only.
34
- *
35
31
  * @addtogroup lcb-subdoc
36
32
  * @{
37
33
  */
@@ -113,7 +109,7 @@ typedef enum {
113
109
  * should be placed, for example `array[2]` will cause the value(s) to be
114
110
  * the 3rd item(s) in the array.
115
111
  *
116
- * The array must already exist and the @ref LCB_SDCMD_F_MKINTERMEDIATES
112
+ * The array must already exist and the @ref LCB_SDSPEC_F_MKINTERMEDIATES
117
113
  * flag is not honored.
118
114
  */
119
115
  LCB_SDCMD_ARRAY_INSERT,
@@ -182,7 +178,7 @@ typedef struct {
182
178
  lcb_KEYBUF path;
183
179
 
184
180
  /**
185
- * @value for the operation. This should be assigned using
181
+ * Value for the operation. This should be assigned using
186
182
  * @ref LCB_SDSPEC_SET_VALUE. The contents of the value should be valid
187
183
  * until the operation is scheduled (i.e. lcb_subdoc3())
188
184
  */
@@ -307,7 +303,7 @@ typedef struct {
307
303
  * Note that #value and #nvalue are only valid if #status is ::LCB_SUCCESS
308
304
  */
309
305
  typedef struct {
310
- /** Value for the mutation (only applicable for ::LCB_SUBDOC_COUNTER, currently) */
306
+ /** Value for the mutation (only applicable for ::LCB_SDCMD_COUNTER, currently) */
311
307
  const void *value;
312
308
  /** Length of the value */
313
309
  size_t nvalue;
@@ -22,7 +22,12 @@
22
22
  * @file
23
23
  * End to end tracing
24
24
  *
25
- * @uncommitted
25
+ * @ingroup lcb-public-api
26
+ * @defgroup lcb-tracing-api End to end tracing
27
+ * @brief Tracing operations through SDK and the Cluster.
28
+ *
29
+ * @addtogroup lcb-tracing-api
30
+ * @{
26
31
  */
27
32
 
28
33
  #ifdef __cplusplus
@@ -40,40 +45,62 @@ extern "C" {
40
45
  typedef struct lcbtrace_SPAN_Cdummy lcbtrace_SPAN;
41
46
  #endif
42
47
 
48
+ /**
49
+ * Flag for @ref lcbtrace_new to request threshold logging tracer.
50
+ */
43
51
  #define LCBTRACE_F_THRESHOLD 0x01
44
52
 
45
53
  struct lcbtrace_TRACER;
54
+ /**
55
+ * Tracer interface.
56
+ */
46
57
  typedef struct lcbtrace_TRACER {
47
- lcb_U16 version;
48
- lcb_U64 flags;
49
- void *cookie;
50
- void (*destructor)(struct lcbtrace_TRACER *tracer);
58
+ lcb_U16 version; /**< version of the structure, current value is 0 */
59
+ lcb_U64 flags; /**< tracer-specific flags */
60
+ void *cookie; /**< opaque pointer (e.g. pointer to wrapper structure) */
61
+ void (*destructor)(struct lcbtrace_TRACER *tracer); /**< destructor function or NULL, if it is not necessary */
51
62
  union {
52
63
  struct {
53
- void (*report)(struct lcbtrace_TRACER *tracer, lcbtrace_SPAN *span);
64
+ void (*report)(struct lcbtrace_TRACER *tracer, lcbtrace_SPAN *span); /**< optional reporter function */
54
65
  } v0;
55
66
  } v;
56
67
  } lcbtrace_TRACER;
57
68
 
58
69
  /**
59
- * @uncommitted
70
+ * Get current tracer of the connection.
71
+ *
72
+ * @param instance current connection
60
73
  * @return tracer
74
+ *
75
+ * @committed
61
76
  */
62
77
  LIBCOUCHBASE_API lcbtrace_TRACER *lcb_get_tracer(lcb_t instance);
63
78
 
64
79
  /**
65
- * @uncommitted
66
- * @return tracer
80
+ * Set current tracer for the connection.
81
+ *
82
+ * @param instance current connection
83
+ * @param tracer tracer instance
84
+ *
85
+ * @committed
67
86
  */
68
87
  LIBCOUCHBASE_API void lcb_set_tracer(lcb_t instance, lcbtrace_TRACER *tracer);
69
88
 
70
89
  /**
71
- * @uncommitted
90
+ * Create default libcouchbase tracer instance.
91
+ *
92
+ * @param instance current connection
93
+ * @param flags pass @ref LCBTRACE_F_THRESHOLD if needed threshold logging tracer.
94
+ * @return new tracer or NULL when nothing has been created.
95
+ *
96
+ * @committed
72
97
  */
73
98
  LIBCOUCHBASE_API lcbtrace_TRACER *lcbtrace_new(lcb_t instance, lcb_U64 flags);
74
99
 
75
100
  /**
76
- * @uncommitted
101
+ * Destroy tracer object.
102
+ *
103
+ * @committed
77
104
  */
78
105
  LIBCOUCHBASE_API void lcbtrace_destroy(lcbtrace_TRACER *tracer);
79
106
 
@@ -89,55 +116,86 @@ typedef struct {
89
116
  lcbtrace_SPAN *span;
90
117
  } lcbtrace_REF;
91
118
 
92
- #define LCBTRACE_OP_GET "get"
93
-
94
119
  /** zero means the library will trigger timestamp automatically */
95
120
  #define LCBTRACE_NOW 0
96
121
 
97
122
  /**
98
- * @return time in microseconds
123
+ * Get current timestamp.
124
+ *
125
+ * @return current wall clock time in microseconds
126
+ *
127
+ * @committed
99
128
  */
100
129
  LIBCOUCHBASE_API
101
130
  lcb_U64 lcbtrace_now(void);
102
131
 
103
132
  /**
104
- * @uncommitted
105
- * @param tracer
106
- * @param operation
107
- * @param now
108
- * @param ctx
133
+ * Start span.
134
+ *
135
+ * @param tracer tracer instance
136
+ * @param operation the operation code
137
+ * @param now start timestamp or @ref LCBTRACE_NOW to let the library to record current time from the wall clock.
138
+ * @param ref reference to the other span, or NULL
139
+ *
140
+ * @committed
109
141
  */
110
142
  LIBCOUCHBASE_API
111
143
  lcbtrace_SPAN *lcbtrace_span_start(lcbtrace_TRACER *tracer, const char *operation, lcb_U64 now, lcbtrace_REF *ref);
112
144
 
113
145
  /**
114
- * @uncommitted
115
- * @param span
116
- * @param now
146
+ * Mark the span as finished.
147
+ *
148
+ * @param span span instance
149
+ * @param now finish timestamp or @ref LCBTRACE_NOW to let the library to record current time from the wall clock.
150
+ *
151
+ * @committed
117
152
  */
118
153
  LIBCOUCHBASE_API
119
154
  void lcbtrace_span_finish(lcbtrace_SPAN *span, lcb_U64 now);
120
155
 
121
156
  /**
122
- * @uncommitted
157
+ * Get start timestamp of the span.
158
+ *
159
+ * @param span span instance
160
+ * @return timestamp in microseconds when the span has been started.
161
+ *
162
+ * @committed
123
163
  */
124
164
  LIBCOUCHBASE_API
125
165
  lcb_U64 lcbtrace_span_get_start_ts(lcbtrace_SPAN *span);
126
166
 
127
167
  /**
128
- * @uncommitted
168
+ * Get finish timestamp of the span.
169
+ *
170
+ * @param span span instance
171
+ * @return timestamp in microseconds when the span has been finished.
172
+ *
173
+ * @committed
129
174
  */
130
175
  LIBCOUCHBASE_API
131
176
  lcb_U64 lcbtrace_span_get_finish_ts(lcbtrace_SPAN *span);
132
177
 
133
178
  /**
134
- * @uncommitted
179
+ * Check if the span is orphaned.
180
+ *
181
+ * Spans might be marked as orphaned, when the library has discarded
182
+ * request structure without waiting for server response (e.g. on timeout).
183
+ *
184
+ * @param span span instance
185
+ * @return non-zero if span is orphaned.
186
+ *
187
+ * @committed
135
188
  */
136
189
  LIBCOUCHBASE_API
137
190
  int lcbtrace_span_is_orphaned(lcbtrace_SPAN *span);
138
191
 
139
192
  /**
140
- * @uncomitted
193
+ * Get operation code of the span.
194
+ *
195
+ * @param span span instance
196
+ * @return operation code
197
+ *
198
+ * @committed
141
199
  */
142
200
  LIBCOUCHBASE_API
143
201
  const char *lcbtrace_span_get_operation(lcbtrace_SPAN *span);
@@ -163,11 +221,10 @@ const char *lcbtrace_span_get_operation(lcbtrace_SPAN *span);
163
221
  #define LCBTRACE_OP_UPSERT "upsert"
164
222
  #define LCBTRACE_OP_UPSERT "upsert"
165
223
 
166
- #define LCBTRACE_OP_STORE2NAME(code) \
167
- (code == LCB_ADD) ? LCBTRACE_OP_ADD : \
168
- (code == LCB_PREPEND) ? LCBTRACE_OP_PREPEND : \
169
- (code == LCB_APPEND) ? LCBTRACE_OP_APPEND : \
170
- LCBTRACE_OP_UPSERT
224
+ #define LCBTRACE_OP_STORE2NAME(code) \
225
+ (code == LCB_ADD) \
226
+ ? LCBTRACE_OP_ADD \
227
+ : (code == LCB_PREPEND) ? LCBTRACE_OP_PREPEND : (code == LCB_APPEND) ? LCBTRACE_OP_APPEND : LCBTRACE_OP_UPSERT
171
228
 
172
229
  #define LCBTRACE_TAG_DB_TYPE "db.type"
173
230
  #define LCBTRACE_TAG_SPAN_KIND "span.kind"
@@ -215,79 +272,135 @@ const char *lcbtrace_span_get_operation(lcbtrace_SPAN *span);
215
272
  #define LCBTRACE_TAG_PEER_LATENCY "peer.latency"
216
273
 
217
274
  /**
218
- * @uncommitted
275
+ * Get ID of the span.
276
+ *
277
+ * @param span span instance
278
+ * @return span ID
279
+ *
280
+ * @committed
219
281
  */
220
282
  LIBCOUCHBASE_API
221
283
  lcb_U64 lcbtrace_span_get_span_id(lcbtrace_SPAN *span);
222
284
 
223
285
  /**
224
- * @uncommitted
286
+ * Get trace ID of the span.
287
+ *
288
+ * @param span span instance
289
+ * @return trace ID
290
+ *
291
+ * @committed
225
292
  */
226
293
  LIBCOUCHBASE_API
227
294
  lcb_U64 lcbtrace_span_get_trace_id(lcbtrace_SPAN *span);
228
295
 
229
296
  /**
230
- * @uncommitted
297
+ * Get parent span of the span.
298
+ *
299
+ * @param span span instance
300
+ * @return parent span or NULL
301
+ *
302
+ * @committed
231
303
  */
232
304
  LIBCOUCHBASE_API
233
305
  lcbtrace_SPAN *lcbtrace_span_get_parent(lcbtrace_SPAN *span);
234
306
 
235
307
  /**
236
- * @uncommitted
308
+ * Get value of the string tag of the span.
309
+ *
310
+ * @param span span instance
311
+ * @param name name of the tag
312
+ * @param value pointer to result string
313
+ * @param nvalue pointer to length of the result string
314
+ * @return LCB_SUCCESS if value exists and was written to result pointer
315
+ *
316
+ * @committed
237
317
  */
238
318
  LIBCOUCHBASE_API
239
319
  lcb_error_t lcbtrace_span_get_tag_str(lcbtrace_SPAN *span, const char *name, char **value, size_t *nvalue);
240
320
 
241
321
  /**
242
- * @uncommitted
322
+ * Get value of the integer tag of the span.
323
+ *
324
+ * @param span span instance
325
+ * @param name name of the tag
326
+ * @param value pointer to result
327
+ * @return LCB_SUCCESS if value exists and was written to result pointer
328
+ *
329
+ * @committed
243
330
  */
244
331
  LIBCOUCHBASE_API
245
332
  lcb_error_t lcbtrace_span_get_tag_uint64(lcbtrace_SPAN *span, const char *name, lcb_U64 *value);
246
333
 
247
334
  /**
248
- * @uncommitted
335
+ * Get value of the double tag of the span.
336
+ *
337
+ * @param span span instance
338
+ * @param name name of the tag
339
+ * @param value pointer to result
340
+ * @return LCB_SUCCESS if value exists and was written to result pointer
341
+ *
342
+ * @committed
249
343
  */
250
344
  LIBCOUCHBASE_API
251
345
  lcb_error_t lcbtrace_span_get_tag_double(lcbtrace_SPAN *span, const char *name, double *value);
252
346
 
253
347
  /**
254
- * @uncommitted
348
+ * Get value of the boolean tag of the span.
349
+ *
350
+ * @param span span instance
351
+ * @param name name of the tag
352
+ * @param value pointer to result
353
+ * @return LCB_SUCCESS if value exists and was written to result pointer
354
+ *
355
+ * @committed
255
356
  */
256
357
  LIBCOUCHBASE_API
257
- lcb_error_t lcbtrace_span_get_tag_bool(lcbtrace_SPAN *span, const char *name, int value);
358
+ lcb_error_t lcbtrace_span_get_tag_bool(lcbtrace_SPAN *span, const char *name, int *value);
258
359
 
259
360
  /**
260
- * @uncommitted
261
- * @param span
262
- * @param name
263
- * @param value
361
+ * Add string tag to span.
362
+ *
363
+ * @param span span instance
364
+ * @param name name of the tag
365
+ * @param value value of the tag (NUL-terminated)
366
+ *
367
+ * @committed
264
368
  */
265
369
  LIBCOUCHBASE_API
266
370
  void lcbtrace_span_add_tag_str(lcbtrace_SPAN *span, const char *name, const char *value);
267
371
 
268
372
  /**
269
- * @uncommitted
270
- * @param span
271
- * @param name
272
- * @param value
373
+ * Add integer tag to span.
374
+ *
375
+ * @param span span instance
376
+ * @param name name of the tag
377
+ * @param value value of the tag
378
+ *
379
+ * @committed
273
380
  */
274
381
  LIBCOUCHBASE_API
275
382
  void lcbtrace_span_add_tag_uint64(lcbtrace_SPAN *span, const char *name, lcb_U64 value);
276
383
 
277
384
  /**
278
- * @uncommitted
279
- * @param span
280
- * @param name
281
- * @param value
385
+ * Add double tag to span.
386
+ *
387
+ * @param span span instance
388
+ * @param name name of the tag
389
+ * @param value value of the tag
390
+ *
391
+ * @committed
282
392
  */
283
393
  LIBCOUCHBASE_API
284
394
  void lcbtrace_span_add_tag_double(lcbtrace_SPAN *span, const char *name, double value);
285
395
 
286
396
  /**
287
- * @uncommitted
288
- * @param span
289
- * @param name
290
- * @param value
397
+ * Add boolean tag to span.
398
+ *
399
+ * @param span span instance
400
+ * @param name name of the tag
401
+ * @param value value of the tag. 0 if false, otherwise -- true.
402
+ *
403
+ * @committed
291
404
  */
292
405
  LIBCOUCHBASE_API
293
406
  void lcbtrace_span_add_tag_bool(lcbtrace_SPAN *span, const char *name, int value);
@@ -297,7 +410,8 @@ void lcbtrace_span_add_tag_bool(lcbtrace_SPAN *span, const char *name, int value
297
410
  *
298
411
  * @param cmd the command structure
299
412
  * @param ctx the lcbtrace_SPAN pointer
300
- * @uncommitted
413
+ *
414
+ * @committed
301
415
  */
302
416
  #define LCB_CMD_SET_TRACESPAN(cmd, span) \
303
417
  do { \
@@ -313,6 +427,10 @@ typedef struct {
313
427
  void (*report)(void *state, lcbtrace_SPAN *span);
314
428
  } ldcptrace_REPORTER;
315
429
 
430
+ /**
431
+ * @} (Group: Tracing)
432
+ */
433
+
316
434
  #ifdef __cplusplus
317
435
  }
318
436
  #endif