libcouchbase 1.0.4 → 1.1.0

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.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +11 -8
  3. data/ext/libcouchbase/CMakeLists.txt +1 -1
  4. data/ext/libcouchbase/README.markdown +38 -6
  5. data/ext/libcouchbase/RELEASE_NOTES.markdown +151 -0
  6. data/ext/libcouchbase/cmake/Modules/GenerateConfigDotH.cmake +2 -2
  7. data/ext/libcouchbase/cmake/Modules/GetVersionInfo.cmake +3 -3
  8. data/ext/libcouchbase/cmake/source_files.cmake +1 -0
  9. data/ext/libcouchbase/contrib/cJSON/cJSON.c +686 -288
  10. data/ext/libcouchbase/contrib/cJSON/cJSON.h +0 -0
  11. data/ext/libcouchbase/contrib/cbsasl/src/hash.c +17 -17
  12. data/ext/libcouchbase/contrib/cliopts/cliopts.c +76 -0
  13. data/ext/libcouchbase/contrib/cliopts/cliopts.h +66 -15
  14. data/ext/libcouchbase/contrib/genhash/genhash.c +1 -2
  15. data/ext/libcouchbase/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +4 -3
  16. data/ext/libcouchbase/example/instancepool/main.cc +12 -2
  17. data/ext/libcouchbase/example/libeventdirect/main.c +99 -25
  18. data/ext/libcouchbase/example/minimal/minimal.c +7 -5
  19. data/ext/libcouchbase/example/observe/durability.c +102 -0
  20. data/ext/libcouchbase/example/observe/observe.c +19 -6
  21. data/ext/libcouchbase/example/subdoc/subdoc-xattrs.c +1 -2
  22. data/ext/libcouchbase/include/libcouchbase/cntl-private.h +6 -8
  23. data/ext/libcouchbase/include/libcouchbase/cntl.h +84 -64
  24. data/ext/libcouchbase/include/libcouchbase/couchbase.h +295 -78
  25. data/ext/libcouchbase/include/libcouchbase/deprecated.h +2 -2
  26. data/ext/libcouchbase/include/libcouchbase/error.h +1 -1
  27. data/ext/libcouchbase/include/libcouchbase/iops.h +9 -9
  28. data/ext/libcouchbase/include/libcouchbase/ixmgmt.h +2 -2
  29. data/ext/libcouchbase/include/libcouchbase/n1ql.h +69 -7
  30. data/ext/libcouchbase/include/libcouchbase/vbucket.h +17 -0
  31. data/ext/libcouchbase/include/libcouchbase/views.h +3 -3
  32. data/ext/libcouchbase/include/memcached/protocol_binary.h +62 -1
  33. data/ext/libcouchbase/packaging/deb/control +1 -1
  34. data/ext/libcouchbase/packaging/rpm/libcouchbase.spec.in +37 -36
  35. data/ext/libcouchbase/src/bootstrap.cc +22 -8
  36. data/ext/libcouchbase/src/bucketconfig/bc_cccp.cc +1 -1
  37. data/ext/libcouchbase/src/bucketconfig/bc_http.cc +0 -1
  38. data/ext/libcouchbase/src/bucketconfig/confmon.cc +13 -8
  39. data/ext/libcouchbase/src/callbacks.c +2 -0
  40. data/ext/libcouchbase/src/cntl.cc +28 -17
  41. data/ext/libcouchbase/src/dns-srv.cc +1 -2
  42. data/ext/libcouchbase/src/dump.cc +4 -0
  43. data/ext/libcouchbase/src/errmap.h +89 -16
  44. data/ext/libcouchbase/src/handler.cc +28 -11
  45. data/ext/libcouchbase/src/http/http-priv.h +4 -1
  46. data/ext/libcouchbase/src/http/http.cc +3 -0
  47. data/ext/libcouchbase/src/instance.cc +1 -1
  48. data/ext/libcouchbase/src/internal.h +1 -0
  49. data/ext/libcouchbase/src/lcbio/connect.cc +2 -3
  50. data/ext/libcouchbase/src/lcbio/manager.cc +2 -2
  51. data/ext/libcouchbase/src/lcbio/ssl.h +10 -0
  52. data/ext/libcouchbase/src/mc/mcreq.c +8 -0
  53. data/ext/libcouchbase/src/mcserver/mcserver.cc +14 -1
  54. data/ext/libcouchbase/src/n1ql/ixmgmt.cc +0 -3
  55. data/ext/libcouchbase/src/n1ql/n1ql.cc +22 -29
  56. data/ext/libcouchbase/src/n1ql/params.cc +46 -1
  57. data/ext/libcouchbase/src/newconfig.cc +4 -4
  58. data/ext/libcouchbase/src/operations/durability-seqno.cc +4 -0
  59. data/ext/libcouchbase/src/operations/durability.cc +3 -0
  60. data/ext/libcouchbase/src/operations/ping.cc +315 -0
  61. data/ext/libcouchbase/src/operations/stats.cc +10 -0
  62. data/ext/libcouchbase/src/operations/subdoc.cc +13 -1
  63. data/ext/libcouchbase/src/retrychk.cc +1 -0
  64. data/ext/libcouchbase/src/settings.c +2 -0
  65. data/ext/libcouchbase/src/settings.h +13 -7
  66. data/ext/libcouchbase/src/ssl/ssl_c.c +28 -2
  67. data/ext/libcouchbase/src/ssl/ssl_common.c +3 -0
  68. data/ext/libcouchbase/src/ssl/ssl_e.c +15 -1
  69. data/ext/libcouchbase/src/ssl/ssl_iot_common.h +3 -1
  70. data/ext/libcouchbase/src/timings.c +0 -1
  71. data/ext/libcouchbase/src/vbucket/vbucket.c +49 -1
  72. data/ext/libcouchbase/tests/iotests/mock-environment.cc +58 -40
  73. data/ext/libcouchbase/tests/iotests/mock-environment.h +23 -4
  74. data/ext/libcouchbase/tests/iotests/mock-unit-test.h +8 -8
  75. data/ext/libcouchbase/tests/iotests/t_behavior.cc +5 -5
  76. data/ext/libcouchbase/tests/iotests/t_durability.cc +50 -0
  77. data/ext/libcouchbase/tests/iotests/t_eerrs.cc +4 -2
  78. data/ext/libcouchbase/tests/iotests/t_errmap.cc +6 -3
  79. data/ext/libcouchbase/tests/iotests/t_lock.cc +5 -6
  80. data/ext/libcouchbase/tests/iotests/t_misc.cc +44 -0
  81. data/ext/libcouchbase/tests/iotests/t_serverops.cc +1 -0
  82. data/ext/libcouchbase/tests/iotests/t_subdoc.cc +28 -0
  83. data/ext/libcouchbase/tests/iotests/t_views.cc +22 -10
  84. data/ext/libcouchbase/tools/CMakeLists.txt +21 -1
  85. data/ext/libcouchbase/tools/cbc-handlers.h +23 -3
  86. data/ext/libcouchbase/tools/cbc-n1qlback.cc +1 -1
  87. data/ext/libcouchbase/tools/cbc-pillowfight.cc +126 -26
  88. data/ext/libcouchbase/tools/cbc-proxy.cc +403 -0
  89. data/ext/libcouchbase/tools/cbc-subdoc.cc +826 -0
  90. data/ext/libcouchbase/tools/cbc.cc +149 -37
  91. data/ext/libcouchbase/tools/common/options.h +5 -2
  92. data/ext/libcouchbase/tools/linenoise/linenoise.c +15 -15
  93. data/lib/libcouchbase.rb +4 -0
  94. data/lib/libcouchbase/bucket.rb +51 -0
  95. data/lib/libcouchbase/connection.rb +100 -13
  96. data/lib/libcouchbase/ext/libcouchbase.rb +40 -0
  97. data/lib/libcouchbase/ext/libcouchbase/cmdsubdoc.rb +13 -1
  98. data/lib/libcouchbase/ext/libcouchbase/enums.rb +2 -1
  99. data/lib/libcouchbase/ext/libcouchbase/sdspec.rb +5 -0
  100. data/lib/libcouchbase/subdoc_request.rb +129 -0
  101. data/lib/libcouchbase/version.rb +1 -1
  102. data/spec/bucket_spec.rb +15 -1
  103. data/spec/connection_spec.rb +1 -1
  104. data/spec/subdoc_spec.rb +192 -0
  105. metadata +13 -4
  106. data/ext/libcouchbase/.travis.yml +0 -19
@@ -225,9 +225,9 @@ lcb_error_t lcb_verify_struct_size(lcb_uint32_t id, lcb_uint32_t version,
225
225
  /**@deprecated Initial connections are always attempted */
226
226
  #define LCB_CNTL_SKIP_CONFIGURATION_ERRORS_ON_CONNECT 0x13
227
227
 
228
- /**@deprecated - Use error classifiers */
228
+ /**@deprecated Use error classifiers */
229
229
  #define lcb_is_error_enomem(a) ((a == LCB_CLIENT_ENOMEM) || (a == LCB_ENOMEM))
230
- /**@deprecated - Use error classifiers */
230
+ /**@deprecated Use error classifiers */
231
231
  #define lcb_is_error_etmpfail(a) ((a == LCB_CLIENT_ETMPFAIL) || (a == LCB_ETMPFAIL))
232
232
 
233
233
  typedef enum {
@@ -532,7 +532,7 @@ typedef enum {
532
532
  LCB_MAX_ERROR = 0x1000
533
533
  } lcb_error_t;
534
534
 
535
- /** @deprecated. Use new, less ambiguous identifier (@ref LCB_CLIENT_ENOCONF) */
535
+ /** @deprecated Use new, less ambiguous identifier (@ref LCB_CLIENT_ENOCONF) */
536
536
  #define LCB_CLIENT_ETMPFAIL LCB_CLIENT_ENOCONF
537
537
 
538
538
  /** @brief If the error is a result of bad input */
@@ -1,6 +1,6 @@
1
1
  /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright 2014 Couchbase, Inc.
3
+ * Copyright 2017 Couchbase, Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -313,20 +313,20 @@ typedef int (*lcb_ioE_connect_fn)
313
313
  const struct sockaddr *dst,
314
314
  unsigned int addrlen);
315
315
 
316
- /** @private */
316
+ /** @internal */
317
317
  typedef int (*lcb_ioE_bind_fn)
318
318
  (lcb_io_opt_t iops,
319
319
  lcb_socket_t sock,
320
320
  const struct sockaddr *srcaddr,
321
321
  unsigned int addrlen);
322
322
 
323
- /** @private */
323
+ /** @internal */
324
324
  typedef int (*lcb_ioE_listen_fn)
325
325
  (lcb_io_opt_t iops,
326
326
  lcb_socket_t bound_sock,
327
327
  unsigned int queuelen);
328
328
 
329
- /** @private */
329
+ /** @internal */
330
330
  typedef lcb_socket_t (*lcb_ioE_accept_fn)
331
331
  (lcb_io_opt_t iops,
332
332
  lcb_socket_t lsnsock);
@@ -338,7 +338,7 @@ typedef void (*lcb_ioE_close_fn)
338
338
 
339
339
 
340
340
  /**
341
- * While checking the socket, treat pending data as an _erorr_.
341
+ * While checking the socket, treat pending data as an _error_.
342
342
  * This flag will be _missing_ if the socket participates in a protocol
343
343
  * where unsolicited data is possible.
344
344
  *
@@ -976,12 +976,12 @@ lcb_iops_wire_bsd_impl2(lcb_bsd_procs *procs, int version);
976
976
  * @committed
977
977
  */
978
978
  typedef enum {
979
- LCB_IO_OPS_INVALID = 0x00, /**< @private */
980
- LCB_IO_OPS_DEFAULT = 0x01, /**< @private */
979
+ LCB_IO_OPS_INVALID = 0x00, /**< @internal */
980
+ LCB_IO_OPS_DEFAULT = 0x01, /**< @internal */
981
981
 
982
982
  /** Integrate with the libevent loop. See lcb_create_libevent_io_opts() */
983
983
  LCB_IO_OPS_LIBEVENT = 0x02,
984
- LCB_IO_OPS_WINSOCK = 0x03, /**< @private */
984
+ LCB_IO_OPS_WINSOCK = 0x03, /**< @internal */
985
985
  LCB_IO_OPS_LIBEV = 0x04,
986
986
  LCB_IO_OPS_SELECT = 0x05,
987
987
  LCB_IO_OPS_WINIOCP = 0x06,
@@ -1000,7 +1000,7 @@ typedef struct { const char *sofile; const char *symbol; void *cookie; } lcb_IOC
1000
1000
  typedef struct { lcb_io_create_fn create; void *cookie; } lcb_IOCREATEOPS_FUNCTIONPOINTER;
1001
1001
  #endif
1002
1002
 
1003
- /** @uncommited */
1003
+ /** @uncommitted */
1004
1004
  struct lcb_create_io_ops_st {
1005
1005
  int version;
1006
1006
  union {
@@ -103,14 +103,14 @@ typedef struct {
103
103
  } lcb_N1XSPEC;
104
104
 
105
105
  /** Input/Output flag. The index is the primary index for the bucket */
106
- #define LCB_N1XSPEC_F_PRIMARY 1<<16
106
+ #define LCB_N1XSPEC_F_PRIMARY (1 << 16)
107
107
 
108
108
  /**
109
109
  * Input flag for creation. Defer the index building until later. This may
110
110
  * be used to accelerate the building of multiple indexes, so that the index
111
111
  * builder can construct all indexes by scanning items only once
112
112
  */
113
- #define LCB_N1XSPEC_F_DEFER 1<<17
113
+ #define LCB_N1XSPEC_F_DEFER (1 << 17)
114
114
 
115
115
  /**
116
116
  * Input for index type. It's best to just leave this value to 0 (DEFAULT)
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2015 Couchbase, Inc.
2
+ * Copyright 2017 Couchbase, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -97,7 +97,7 @@ lcb_n1p_free(lcb_N1QLPARAMS *params);
97
97
  /** Query is a statement string */
98
98
  #define LCB_N1P_QUERY_STATEMENT 1
99
99
 
100
- /** @private */
100
+ /** @internal */
101
101
  #define LCB_N1P_QUERY_PREPARED 2
102
102
 
103
103
  /**
@@ -112,6 +112,7 @@ LIBCOUCHBASE_API
112
112
  lcb_error_t
113
113
  lcb_n1p_setquery(lcb_N1QLPARAMS *params, const char *qstr, size_t nqstr, int type);
114
114
 
115
+ /** Shortcut to set NUL-terminated string as statement via @ref lcb_n1p_setquery */
115
116
  #define lcb_n1p_setstmtz(params, qstr) \
116
117
  lcb_n1p_setquery(params, qstr, -1, LCB_N1P_QUERY_STATEMENT)
117
118
 
@@ -128,6 +129,7 @@ lcb_error_t
128
129
  lcb_n1p_namedparam(lcb_N1QLPARAMS *params, const char *name, size_t n_name,
129
130
  const char *value, size_t n_value);
130
131
 
132
+ /** Shortcut to set NUL-terminated string as named param via @ref lcb_n1p_namedparam */
131
133
  #define lcb_n1p_namedparamz(params, name, value) \
132
134
  lcb_n1p_namedparam(params, name, -1, value, -1)
133
135
 
@@ -141,6 +143,66 @@ LIBCOUCHBASE_API
141
143
  lcb_error_t
142
144
  lcb_n1p_posparam(lcb_N1QLPARAMS *params, const char *value, size_t n_value);
143
145
 
146
+
147
+ /**
148
+ * Marks query as read-only.
149
+ *
150
+ * If the user knows the request is only ever a select, for security
151
+ * reasons it can make sense to tell the server this thing is readonly
152
+ * and it will prevent mutations from happening.
153
+ *
154
+ * If readonly is set, then the following statements are not allowed:
155
+ * * CREATE INDEX
156
+ * * DROP INDEX
157
+ * * INSERT
158
+ * * MERGE
159
+ * * UPDATE
160
+ * * UPSERT
161
+ * * DELETE
162
+ *
163
+ * @param params the params object
164
+ * @param readonly if non-zero, the query will be read-only
165
+ */
166
+ LIBCOUCHBASE_API
167
+ lcb_error_t
168
+ lcb_n1p_readonly(lcb_N1QLPARAMS *params, int readonly);
169
+
170
+ /**
171
+ * Sets maximum buffered channel size between the indexer client
172
+ * and the query service for index scans.
173
+ *
174
+ * This parameter controls when to use scan backfill. Use 0 or
175
+ * a negative number to disable.
176
+ *
177
+ * @param params the params object
178
+ * @param scancap channel size
179
+ */
180
+ LIBCOUCHBASE_API
181
+ lcb_error_t
182
+ lcb_n1p_scancap(lcb_N1QLPARAMS *params, int scancap);
183
+
184
+ /**
185
+ * Sets maximum number of items each execution operator can buffer
186
+ * between various operators.
187
+ *
188
+ * @param params the params object
189
+ * @param pipelinecap number of items
190
+ */
191
+ LIBCOUCHBASE_API
192
+ lcb_error_t
193
+ lcb_n1p_pipelinecap(lcb_N1QLPARAMS *params, int pipelinecap);
194
+
195
+ /**
196
+ * Sets the number of items execution operators can batch for
197
+ * fetch from the KV.
198
+ *
199
+ * @param params the params object
200
+ * @param pipelinebatch number of items
201
+ */
202
+ LIBCOUCHBASE_API
203
+ lcb_error_t
204
+ lcb_n1p_pipelinebatch(lcb_N1QLPARAMS *params, int pipelinebatch);
205
+
144
206
  /**
145
207
  * Set a query option
146
208
  * @param params the params object
@@ -256,19 +318,19 @@ lcb_n1p_mkcmd(lcb_N1QLPARAMS *params, lcb_CMDN1QL *cmd);
256
318
  * Prepare and cache the query if required. This may be used on frequently
257
319
  * issued queries, so they perform better.
258
320
  */
259
- #define LCB_CMDN1QL_F_PREPCACHE 1<<16
321
+ #define LCB_CMDN1QL_F_PREPCACHE (1 << 16)
260
322
 
261
- /** @private The lcb_CMDN1QL::query member is an internal JSON structure */
262
- #define LCB_CMDN1QL_F_JSONQUERY 1<<17
323
+ /** The lcb_CMDN1QL::query member is an internal JSON structure. @internal */
324
+ #define LCB_CMDN1QL_F_JSONQUERY (1 << 17)
263
325
 
264
326
  /**
265
327
  * This is an analytics query. Use the `host` field to specify the host/port
266
328
  * to target. When this flag is set, things like prepared queries and
267
329
  * parametrized statements will not work.
268
330
  *
269
- * @uncommited
331
+ * @uncommitted
270
332
  */
271
- #define LCB_CMDN1QL_F_CBASQUERY 1<<18
333
+ #define LCB_CMDN1QL_F_CBASQUERY (1 << 18)
272
334
 
273
335
  /**
274
336
  * Command structure for N1QL queries. Typically an application will use the
@@ -52,6 +52,7 @@ typedef enum {
52
52
  LCBVB_SVCTYPE_IXADMIN, /**< Index administration */
53
53
  LCBVB_SVCTYPE_N1QL, /**< N1QL Query */
54
54
  LCBVB_SVCTYPE_FTS, /**< Fulltext */
55
+ LCBVB_SVCTYPE_CBAS, /**< Analytics Query */
55
56
  LCBVB_SVCTYPE__MAX
56
57
  } lcbvb_SVCTYPE;
57
58
 
@@ -75,9 +76,11 @@ typedef struct {
75
76
  lcb_U16 ixadmin; /**< Indexing admin port (HTTP) */
76
77
  lcb_U16 n1ql; /**< Query port */
77
78
  lcb_U16 fts; /**< CBFT */
79
+ lcb_U16 cbas; /**< CBAS (Analytics) */
78
80
  char *views_base_; /**< Views base URL */
79
81
  char *query_base_; /**< N1QL base URL */
80
82
  char *fts_base_;
83
+ char *cbas_base_;
81
84
  char *hoststrs[LCBVB_SVCTYPE__MAX];
82
85
  } lcbvb_SERVICES;
83
86
 
@@ -96,6 +99,7 @@ typedef struct {
96
99
  char *viewpath; /**< Path prefix for view queries */
97
100
  char *querypath; /**< Path prefix for n1ql queries */
98
101
  char *ftspath; /**< Path prefix for fulltext queries */
102
+ char *cbaspath; /**< Path prefix for analytics queries */
99
103
  unsigned nvbs; /**< Total number of vbuckets the server has assigned */
100
104
  } lcbvb_SERVER;
101
105
 
@@ -117,6 +121,17 @@ typedef enum {
117
121
  LCBVB_DIST_KETAMA = 1 /**< Ketama hashing ("memcached") bucket */
118
122
  } lcbvb_DISTMODE;
119
123
 
124
+ typedef enum {
125
+ LCBVB_CAP_XATTR = 0x01,
126
+ LCBVB_CAP_CBHELLO = 0x02,
127
+ LCBVB_CAP_CCCP = 0x04,
128
+ LCBVB_CAP_COUCHAPI = 0x08,
129
+ LCBVB_CAP_DCP = 0x10,
130
+ LCBVB_CAP_NODES_EXT = 0x20,
131
+ LCBVB_CAP_TOUCH = 0x40,
132
+ LCBVB_CAP_XDCR_CHECKPOINTING = 0x80
133
+ } lcbvb_BUCKET_CAPABILITIES;
134
+
120
135
  /**@volatile. ABI/API compatibility not guaranteed between versions.
121
136
  * @brief Structure containing the configuration.*/
122
137
  typedef struct lcbvb_CONFIG_st {
@@ -136,6 +151,7 @@ typedef struct lcbvb_CONFIG_st {
136
151
  lcbvb_VBUCKET *ffvbuckets; /* fast-forward map */
137
152
  lcbvb_CONTINUUM *continuum; /* ketama continuums */
138
153
  int *randbuf; /* Used for random server selection */
154
+ long caps; /**< Server capabilities */
139
155
  } lcbvb_CONFIG;
140
156
 
141
157
 
@@ -143,6 +159,7 @@ typedef struct lcbvb_CONFIG_st {
143
159
  #define LCBVB_NDATASERVERS(cfg) (cfg)->ndatasrv
144
160
  #define LCBVB_NREPLICAS(cfg) (cfg)->nrepl
145
161
  #define LCBVB_DISTTYPE(cfg) (cfg)->dtype
162
+ #define LCBVB_CAPS(cfg) (cfg)->caps
146
163
  #define LCBVB_GET_SERVER(conf, ix) ((conf)->servers + ix)
147
164
 
148
165
  /**
@@ -57,14 +57,14 @@ typedef void (*lcb_VIEWQUERYCALLBACK)(lcb_t instance,
57
57
  int cbtype, const lcb_RESPVIEWQUERY *row);
58
58
 
59
59
  /** Set this flag to execute an actual get with each response */
60
- #define LCB_CMDVIEWQUERY_F_INCLUDE_DOCS 1 << 16
60
+ #define LCB_CMDVIEWQUERY_F_INCLUDE_DOCS (1 << 16)
61
61
 
62
62
  /**Set this flag to only parse the top level row, and not its constituent
63
63
  * parts. Note this is incompatible with `F_INCLUDE_DOCS`*/
64
- #define LCB_CMDVIEWQUERY_F_NOROWPARSE 1 << 17
64
+ #define LCB_CMDVIEWQUERY_F_NOROWPARSE (1 << 17)
65
65
 
66
66
  /**This view is spatial. Modifies how the final view path will be constructed */
67
- #define LCB_CMDVIEWQUERY_F_SPATIAL 1 << 18
67
+ #define LCB_CMDVIEWQUERY_F_SPATIAL (1 << 18)
68
68
 
69
69
  /** Command structure for querying a view */
70
70
  typedef struct {
@@ -99,7 +99,13 @@ extern "C"
99
99
  PROTOCOL_BINARY_RESPONSE_DELTA_BADVAL = 0x06,
100
100
  /** The server is not responsible for the requested vbucket */
101
101
  PROTOCOL_BINARY_RESPONSE_NOT_MY_VBUCKET = 0x07,
102
+ /** Not connected to a bucket */
103
+ PROTOCOL_BINARY_RESPONSE_NO_BUCKET = 0x08,
104
+ /** The requested resource is locked */
105
+ PROTOCOL_BINARY_RESPONSE_LOCKED = 0x09,
102
106
 
107
+ /** The authentication context is stale. You should reauthenticate*/
108
+ PROTOCOL_BINARY_RESPONSE_AUTH_STALE = 0x1f,
103
109
  /** Authentication failure (invalid user/password combination,
104
110
  * OR an internal error in the authentication library. Could
105
111
  * be a misconfigured SASL configuration. See server logs for
@@ -113,6 +119,10 @@ extern "C"
113
119
 
114
120
  /** No access (could be opcode, value, bucket etc) */
115
121
  PROTOCOL_BINARY_RESPONSE_EACCESS = 0x24,
122
+ /** The Couchbase cluster is currently initializing this
123
+ * node, and the Cluster manager has not yet granted all
124
+ * users access to the cluster. */
125
+ PROTOCOL_BINARY_RESPONSE_NOT_INITIALIZED = 0x25,
116
126
 
117
127
  /** The server have no idea what this command is for */
118
128
  PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81,
@@ -136,6 +146,11 @@ extern "C"
136
146
  * etc).
137
147
  */
138
148
  PROTOCOL_BINARY_RESPONSE_ETMPFAIL = 0x86,
149
+ /**
150
+ * There is something wrong with the syntax of the provided
151
+ * XATTR.
152
+ */
153
+ PROTOCOL_BINARY_RESPONSE_XATTR_EINVAL = 0x87,
139
154
 
140
155
  /*
141
156
  * Sub-document specific responses.
@@ -191,8 +206,53 @@ extern "C"
191
206
  * found, but one or more path operations failed. Examine the individual
192
207
  * lookup_result (MULTI_LOOKUP) / mutation_result (MULTI_MUTATION)
193
208
  * structures for details. */
194
- PROTOCOL_BINARY_RESPONSE_SUBDOC_MULTI_PATH_FAILURE = 0xcc
209
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_MULTI_PATH_FAILURE = 0xcc,
195
210
 
211
+ /**
212
+ * The operation completed successfully, but operated on a deleted
213
+ * document.
214
+ */
215
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_SUCCESS_DELETED = 0xcd,
216
+
217
+ /**
218
+ * The combination of the subdoc flags for the xattrs doesn't make
219
+ * any sense
220
+ */
221
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_XATTR_INVALID_FLAG_COMBO = 0xce,
222
+
223
+ /**
224
+ * Only a single xattr key may be accessed at the same time.
225
+ */
226
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_XATTR_INVALID_KEY_COMBO = 0xcf,
227
+
228
+ /**
229
+ * The server has no knowledge of the requested macro
230
+ */
231
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_XATTR_UNKNOWN_MACRO = 0xd0,
232
+
233
+ /**
234
+ * The server has no knowledge of the requested virtual xattr
235
+ */
236
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_XATTR_UNKNOWN_VATTR = 0xd1,
237
+
238
+ /**
239
+ * Virtual xattrs can't be modified
240
+ */
241
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_XATTR_CANT_MODIFY_VATTR = 0xd2,
242
+
243
+ /**
244
+ * [For multi-path commands only] Specified key was found as a
245
+ * Deleted document, but one or more path operations
246
+ * failed. Examine the individual lookup_result (MULTI_LOOKUP) /
247
+ * mutation_result (MULTI_MUTATION) structures for details.
248
+ */
249
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_MULTI_PATH_FAILURE_DELETED = 0xd3,
250
+
251
+ /**
252
+ * According to the spec all xattr commands should come first,
253
+ * followed by the commands for the document body
254
+ */
255
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_INVALID_XATTR_ORDER = 0xd4
196
256
  } protocol_binary_response_status;
197
257
 
198
258
  /**
@@ -209,6 +269,7 @@ extern "C"
209
269
  PROTOCOL_BINARY_CMD_DECREMENT = 0x06,
210
270
  PROTOCOL_BINARY_CMD_FLUSH = 0x08,
211
271
  PROTOCOL_BINARY_CMD_GETQ = 0x09 /* Used in tests */,
272
+ PROTOCOL_BINARY_CMD_NOOP = 0x0a,
212
273
  PROTOCOL_BINARY_CMD_VERSION = 0x0b,
213
274
  PROTOCOL_BINARY_CMD_APPEND = 0x0e,
214
275
  PROTOCOL_BINARY_CMD_PREPEND = 0x0f,
@@ -64,7 +64,7 @@ Description: library for the Couchbase protocol, development files
64
64
  Package: libcouchbase2-bin
65
65
  Section: utils
66
66
  Architecture: any
67
- Depends: libcouchbase2-core (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
67
+ Depends: libcouchbase2-core (= ${binary:Version}), libcouchbase2-libevent (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
68
68
  Conflicts: libcouchbase1-bin
69
69
  Description: library for the Couchbase protocol
70
70
  libcouchbase is a library implementing Couchbase protocol.
@@ -1,79 +1,80 @@
1
- Summary: Couchbase Client & Protocol Library
1
+ Summary: Client and protocol library for the Couchbase project
2
2
  Name: libcouchbase
3
3
  Version: @VERSION@
4
4
  Release: @RELEASE@%{?dist}
5
5
  Vendor: Couchbase, Inc.
6
6
  Packager: Couchbase SDK Team <support@couchbase.com>
7
- License: Apache-2
7
+ License: ASL 2.0
8
8
  Group: System Environment/Libraries
9
- %if %{?fedora}0 >= 180 || %{?rhel}0 >= 60
9
+ BuildRequires: gcc, gcc-c++
10
10
  BuildRequires: cmake >= 2.8.9
11
- %else
12
- BuildRequires: cmake28
13
- %endif
14
- BuildRequires: libevent-devel >= 1.4, libev-devel >= 3, openssl-devel
15
- URL: https://github.com/couchbase/libcouchbase
16
- Source: @TARREDAS@.tar.gz
11
+ BuildRequires: pkgconfig(libevent) >= 2
12
+ BuildRequires: libev-devel >= 3
13
+ BuildRequires: openssl-devel
14
+ URL: https://developer.couchbase.com/server/other-products/release-notes-archives/c-sdk
15
+ Source: https://packages.couchbase.com/clients/c/@TARREDAS@.tar.gz
17
16
  BuildRoot: %{_topdir}/build/@TARREDAS@
17
+ %if ! (0%{?rhel} && 0%{?rhel} <= 7)
18
+ Recommends: %{name}2-libevent%{_isa} = %{version}-%{release}
19
+ Suggests: %{name}2-libev%{_isa} = %{version}-%{release}
20
+ Suggests: %{name}2-tools%{_isa} = %{version}-%{release}
21
+ %endif
18
22
 
19
23
  %description
20
24
  This is the client and protocol library for Couchbase project.
21
25
 
22
26
  %package -n %{name}2-libevent
23
27
  Group: System Environment/Libraries
24
- Summary: Couchbase Client & Protocol Library (libevent backend)
25
- Requires: %{name}2-core = %{version}-%{release}, libevent >= 1.4
28
+ Summary: Couchbase client library - libevent IO back-end
29
+ Requires: %{name}2-core%{?_isa} = %{version}-%{release}
26
30
  %description -n %{name}2-libevent
27
- This package provides libevent backend for libcouchbase
31
+ This package provides libevent back-end for libcouchbase
28
32
 
29
33
  %package -n %{name}2-libev
30
34
  Group: System Environment/Libraries
31
- Summary: Couchbase Client & Protocol Library (libev backend)
32
- Requires: %{name}2-core = %{version}-%{release}, libev >= 3
35
+ Summary: Couchbase client library - libev IO back-end
36
+ Requires: %{name}2-core%{?_isa} = %{version}-%{release}
33
37
  %description -n %{name}2-libev
34
- This package provides libev backend for libcouchbase
38
+ This package provides libev back-end for libcouchbase
35
39
 
36
40
  %package -n %{name}2-core
37
41
  Group: System Environment/Libraries
38
- Summary: Couchbase Client & Protocol Library (core)
39
- Provides: %{name}2
42
+ Summary: Couchbase client library - core
43
+ Provides: %{name}2%{?_isa} = %{version}-%{release}
40
44
  %description -n %{name}2-core
41
45
  This package provides the core for libcouchbase. It contains an IO
42
46
  implementation based on select(2). If preferred, you can install one
43
- of the available backends (libcouchbase2-libevent or
47
+ of the available back-ends (libcouchbase2-libevent or
44
48
  libcouchbase2-libev). libcouchbase will automatically use the
45
- installed backend. It is also possible to integrate another IO backend
49
+ installed back-end. It is also possible to integrate another IO back-end
46
50
  or write your own.
47
51
 
48
52
  %package -n %{name}2-bin
49
53
  Group: Development/Tools
50
54
  Summary: Couchbase Client Tools
51
- Requires: %{name}2-core = %{version}-%{release}
55
+ Requires: %{name}2-core%{?_isa} = %{version}-%{release}
52
56
  %description -n %{name}2-bin
53
57
  This is the CLI tools Couchbase project.
54
58
 
55
59
  %package devel
56
60
  Group: Development/Libraries
57
61
  Summary: Couchbase Client & Protocol Library - Header files
58
- Requires: %{name}2-core = %{version}-%{release}
62
+ Requires: %{name}2-core%{?_isa} = %{version}-%{release}
59
63
  %description devel
60
64
  Development files for the Couchbase Client & Protocol Library
61
65
 
62
66
  %prep
63
- %if 0%{?rhel} > 5 || 0%{?fedora} > 7
64
- %define __lcb_cmake %cmake
65
- %else
66
- %define __lcb_cmake %cmake28
67
- %endif
68
-
69
67
  %setup -q -n @TARREDAS@
70
- %{__lcb_cmake} -DLCB_NO_TESTS=1 -DLCB_BUILD_LIBUV=OFF
68
+ %cmake -DLCB_NO_MOCK=1 -DLCB_BUILD_LIBUV=OFF
71
69
 
72
70
  %build
73
- %{__make} %{_smp_mflags}
71
+ %make_build
74
72
 
75
73
  %install
76
- %{__make} install DESTDIR="%{buildroot}" AM_INSTALL_PROGRAM_FLAGS=""
74
+ %make_install
75
+
76
+ %check
77
+ make test
77
78
 
78
79
  %clean
79
80
  %{__rm} -rf %{buildroot}
@@ -84,16 +85,16 @@ Development files for the Couchbase Client & Protocol Library
84
85
 
85
86
  %files -n %{name}2-core
86
87
  %defattr(-, root, root)
87
- %{_libdir}/libcouchbase.so.*
88
+ %{_libdir}/%{name}.so.*
88
89
  %doc README.markdown LICENSE RELEASE_NOTES.markdown
89
90
 
90
91
  %files -n %{name}2-libevent
91
92
  %defattr(-, root, root)
92
- %{_libdir}/libcouchbase_libevent.so
93
+ %{_libdir}/%{name}_libevent.so
93
94
 
94
95
  %files -n %{name}2-libev
95
96
  %defattr(-, root, root)
96
- %{_libdir}/libcouchbase_libev.so
97
+ %{_libdir}/%{name}_libev.so
97
98
 
98
99
  %files -n %{name}2-bin
99
100
  %defattr(-, root, root)
@@ -103,6 +104,6 @@ Development files for the Couchbase Client & Protocol Library
103
104
 
104
105
  %files devel
105
106
  %defattr(-, root, root)
106
- %{_includedir}/libcouchbase
107
- %{_libdir}/libcouchbase.so
108
- %{_libdir}/pkgconfig/libcouchbase.pc
107
+ %{_includedir}/%{name}
108
+ %{_libdir}/%{name}.so
109
+ %{_libdir}/pkgconfig/%{name}.pc