libcouchbase 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/README.md +1 -1
  4. data/ext/libcouchbase/CMakeLists.txt +8 -6
  5. data/ext/libcouchbase/README.markdown +2 -2
  6. data/ext/libcouchbase/RELEASE_NOTES.markdown +0 -86
  7. data/ext/libcouchbase/cmake/Modules/ConfigureDtrace.cmake +0 -11
  8. data/ext/libcouchbase/cmake/Modules/GenerateConfigDotH.cmake +0 -2
  9. data/ext/libcouchbase/cmake/Modules/GetLibcouchbaseFlags.cmake +1 -2
  10. data/ext/libcouchbase/cmake/Modules/GetVersionInfo.cmake +3 -3
  11. data/ext/libcouchbase/cmake/config-cmake.h.in +0 -2
  12. data/ext/libcouchbase/cmake/defs.mk.in +2 -0
  13. data/ext/libcouchbase/cmake/source_files.cmake +5 -21
  14. data/ext/libcouchbase/include/libcouchbase/auth.h +0 -10
  15. data/ext/libcouchbase/include/libcouchbase/cntl.h +1 -27
  16. data/ext/libcouchbase/include/libcouchbase/error.h +1 -15
  17. data/ext/libcouchbase/include/libcouchbase/n1ql.h +1 -13
  18. data/ext/libcouchbase/include/libcouchbase/plugins/io/bsdio-inl.c +1 -1
  19. data/ext/libcouchbase/include/libcouchbase/subdoc.h +0 -9
  20. data/ext/libcouchbase/include/libcouchbase/views.h +1 -7
  21. data/ext/libcouchbase/include/libcouchbase/visibility.h +0 -1
  22. data/ext/libcouchbase/include/memcached/protocol_binary.h +1131 -29
  23. data/ext/libcouchbase/include/memcached/vbucket.h +42 -0
  24. data/ext/libcouchbase/packaging/parse-git-describe.pl +1 -1
  25. data/ext/libcouchbase/plugins/io/libev/libev_io_opts.h +2 -3
  26. data/ext/libcouchbase/src/README.md +2 -0
  27. data/ext/libcouchbase/src/auth-priv.h +0 -1
  28. data/ext/libcouchbase/src/auth.cc +4 -10
  29. data/ext/libcouchbase/src/bootstrap.c +269 -0
  30. data/ext/libcouchbase/src/bootstrap.h +39 -50
  31. data/ext/libcouchbase/src/bucketconfig/bc_cccp.cc +117 -84
  32. data/ext/libcouchbase/src/bucketconfig/bc_file.c +347 -0
  33. data/ext/libcouchbase/src/bucketconfig/bc_http.c +630 -0
  34. data/ext/libcouchbase/src/bucketconfig/bc_http.h +25 -50
  35. data/ext/libcouchbase/src/bucketconfig/bc_mcraw.c +150 -0
  36. data/ext/libcouchbase/src/bucketconfig/clconfig.h +386 -407
  37. data/ext/libcouchbase/src/bucketconfig/confmon.c +474 -0
  38. data/ext/libcouchbase/src/cbft.cc +27 -22
  39. data/ext/libcouchbase/src/cntl.cc +19 -30
  40. data/ext/libcouchbase/src/connspec.cc +1 -48
  41. data/ext/libcouchbase/src/connspec.h +0 -27
  42. data/ext/libcouchbase/src/dump.cc +2 -2
  43. data/ext/libcouchbase/src/getconfig.cc +33 -7
  44. data/ext/libcouchbase/src/handler.cc +2 -0
  45. data/ext/libcouchbase/src/hostlist.cc +36 -0
  46. data/ext/libcouchbase/src/hostlist.h +62 -41
  47. data/ext/libcouchbase/src/http/http-priv.h +112 -125
  48. data/ext/libcouchbase/src/http/http.cc +30 -15
  49. data/ext/libcouchbase/src/http/http.h +34 -1
  50. data/ext/libcouchbase/src/http/http_io.cc +26 -22
  51. data/ext/libcouchbase/src/instance.cc +23 -94
  52. data/ext/libcouchbase/src/internal.h +26 -52
  53. data/ext/libcouchbase/src/jsparse/parser.cc +202 -146
  54. data/ext/libcouchbase/src/jsparse/parser.h +98 -91
  55. data/ext/libcouchbase/src/lcbht/lcbht.c +282 -0
  56. data/ext/libcouchbase/src/lcbht/lcbht.h +163 -174
  57. data/ext/libcouchbase/src/lcbio/connect.c +557 -0
  58. data/ext/libcouchbase/src/lcbio/connect.h +2 -9
  59. data/ext/libcouchbase/src/lcbio/ctx.c +1 -1
  60. data/ext/libcouchbase/src/lcbio/iotable.h +16 -61
  61. data/ext/libcouchbase/src/lcbio/ioutils.h +1 -1
  62. data/ext/libcouchbase/src/lcbio/manager.c +2 -2
  63. data/ext/libcouchbase/src/mc/mcreq.h +2 -9
  64. data/ext/libcouchbase/src/mcserver/mcserver.cc +34 -143
  65. data/ext/libcouchbase/src/mcserver/mcserver.h +12 -7
  66. data/ext/libcouchbase/src/mcserver/negotiate.cc +38 -132
  67. data/ext/libcouchbase/src/n1ql/ixmgmt.cc +2 -1
  68. data/ext/libcouchbase/src/n1ql/n1ql.cc +32 -56
  69. data/ext/libcouchbase/src/newconfig.cc +6 -6
  70. data/ext/libcouchbase/src/nodeinfo.cc +2 -2
  71. data/ext/libcouchbase/src/operations/{cbflush.cc → cbflush.c} +15 -7
  72. data/ext/libcouchbase/src/operations/{counter.cc → counter.c} +0 -0
  73. data/ext/libcouchbase/src/operations/durability.cc +26 -6
  74. data/ext/libcouchbase/src/operations/durability_internal.h +3 -6
  75. data/ext/libcouchbase/src/operations/{get.cc → get.c} +26 -24
  76. data/ext/libcouchbase/src/operations/{observe.cc → observe.c} +93 -68
  77. data/ext/libcouchbase/src/operations/{pktfwd.cc → pktfwd.c} +0 -0
  78. data/ext/libcouchbase/src/operations/{remove.cc → remove.c} +0 -0
  79. data/ext/libcouchbase/src/operations/stats.cc +8 -3
  80. data/ext/libcouchbase/src/operations/{store.cc → store.c} +32 -27
  81. data/ext/libcouchbase/src/operations/subdoc.cc +18 -38
  82. data/ext/libcouchbase/src/operations/{touch.cc → touch.c} +0 -0
  83. data/ext/libcouchbase/src/packetutils.c +37 -0
  84. data/ext/libcouchbase/src/packetutils.h +2 -2
  85. data/ext/libcouchbase/src/probes.d +1 -1
  86. data/ext/libcouchbase/src/{retrychk.cc → retrychk.c} +3 -2
  87. data/ext/libcouchbase/src/retryq.cc +4 -4
  88. data/ext/libcouchbase/src/settings.c +0 -3
  89. data/ext/libcouchbase/src/settings.h +0 -5
  90. data/ext/libcouchbase/src/simplestring.c +211 -0
  91. data/ext/libcouchbase/src/simplestring.h +228 -0
  92. data/ext/libcouchbase/src/ssl/ssl_c.c +0 -1
  93. data/ext/libcouchbase/src/ssl/ssl_common.c +0 -2
  94. data/ext/libcouchbase/src/ssl/ssl_e.c +1 -0
  95. data/ext/libcouchbase/src/ssobuf.h +82 -0
  96. data/ext/libcouchbase/src/trace.h +4 -4
  97. data/ext/libcouchbase/src/vbucket/vbucket.c +1 -0
  98. data/ext/libcouchbase/src/views/{docreq.cc → docreq.c} +54 -48
  99. data/ext/libcouchbase/src/views/docreq.h +30 -24
  100. data/ext/libcouchbase/src/views/viewreq.c +358 -0
  101. data/ext/libcouchbase/src/views/viewreq.h +13 -43
  102. data/ext/libcouchbase/tests/basic/t_connstr.cc +50 -89
  103. data/ext/libcouchbase/tests/basic/t_host.cc +75 -67
  104. data/ext/libcouchbase/tests/basic/t_jsparse.cc +78 -27
  105. data/ext/libcouchbase/tests/basic/t_string.cc +112 -0
  106. data/ext/libcouchbase/tests/htparse/t_basic.cc +78 -58
  107. data/ext/libcouchbase/tests/iotests/mock-environment.h +1 -2
  108. data/ext/libcouchbase/tests/iotests/t_confmon.cc +114 -96
  109. data/ext/libcouchbase/tests/mc/t_alloc.cc +9 -9
  110. data/ext/libcouchbase/tools/cbc-pillowfight.cc +1 -1
  111. data/lib/libcouchbase/ext/tasks.rb +6 -2
  112. data/lib/libcouchbase/query_view.rb +1 -1
  113. data/lib/libcouchbase/results_fiber.rb +6 -6
  114. data/lib/libcouchbase/version.rb +1 -1
  115. metadata +26 -26
  116. data/ext/libcouchbase/src/bootstrap.cc +0 -216
  117. data/ext/libcouchbase/src/bucketconfig/bc_file.cc +0 -281
  118. data/ext/libcouchbase/src/bucketconfig/bc_http.cc +0 -528
  119. data/ext/libcouchbase/src/bucketconfig/bc_mcraw.cc +0 -115
  120. data/ext/libcouchbase/src/bucketconfig/confmon.cc +0 -378
  121. data/ext/libcouchbase/src/dns-srv.cc +0 -142
  122. data/ext/libcouchbase/src/errmap.cc +0 -107
  123. data/ext/libcouchbase/src/errmap.h +0 -113
  124. data/ext/libcouchbase/src/lcbht/lcbht.cc +0 -177
  125. data/ext/libcouchbase/src/lcbio/connect.cc +0 -562
  126. data/ext/libcouchbase/src/lcbio/timer-cxx.h +0 -87
  127. data/ext/libcouchbase/src/mctx-helper.h +0 -51
  128. data/ext/libcouchbase/src/views/viewreq.cc +0 -318
  129. data/ext/libcouchbase/tests/iotests/t_errmap.cc +0 -97
@@ -261,15 +261,6 @@ lcb_n1p_mkcmd(lcb_N1QLPARAMS *params, lcb_CMDN1QL *cmd);
261
261
  /** @private The lcb_CMDN1QL::query member is an internal JSON structure */
262
262
  #define LCB_CMDN1QL_F_JSONQUERY 1<<17
263
263
 
264
- /**
265
- * This is an analytics query. Use the `host` field to specify the host/port
266
- * to target. When this flag is set, things like prepared queries and
267
- * parametrized statements will not work.
268
- *
269
- * @uncommited
270
- */
271
- #define LCB_CMDN1QL_F_CBASQUERY 1<<18
272
-
273
264
  /**
274
265
  * Command structure for N1QL queries. Typically an application will use the
275
266
  * lcb_N1QLPARAMS structure to populate the #query and #content_type fields.
@@ -296,10 +287,7 @@ struct lcb_CMDN1QL {
296
287
  /** Length of the query data */
297
288
  size_t nquery;
298
289
 
299
- /**
300
- * Ignored since version 2.5.3.
301
- * Starting from version 2.7.3, is used for experimental CBAS support
302
- */
290
+ /** Ignored since version 2.5.3 */
303
291
  const char *host;
304
292
 
305
293
  /** Ignored since version 2.5.3 */
@@ -284,7 +284,7 @@ cntl_getset_impl(lcb_io_opt_t io, lcb_socket_t sock, int mode, int oslevel,
284
284
  #ifndef _WIN32
285
285
  socklen_t dummy = optsize;
286
286
  #else
287
- char dummy = optsize;
287
+ int dummy = optsize;
288
288
  #endif
289
289
 
290
290
  if (mode == LCB_IO_CNTL_GET) {
@@ -180,15 +180,6 @@ typedef struct {
180
180
  /** Create document if it does not exist */
181
181
  #define LCB_SDSPEC_F_MKDOCUMENT (1<<17)
182
182
 
183
- /** Access document XATTR path */
184
- #define LCB_SDSPEC_F_XATTRPATH (1<<18)
185
-
186
- /** Access document virtual/materialized path. Implies F_XATTRPATH */
187
- #define LCB_SDSPEC_F_XATTR_MACROVALUES (1<<19)
188
-
189
- /** Access Xattrs of deleted documents */
190
- #define LCB_SDSPEC_F_XATTR_DELETED_OK (1<<20)
191
-
192
183
  /**
193
184
  * Set the path for an @ref lcb_SDSPEC structure
194
185
  * @param s pointer to spec
@@ -33,14 +33,8 @@ extern "C" {
33
33
  * @addtogroup lcb-view-api
34
34
  * @{
35
35
  */
36
- #ifdef __cplusplus
37
- namespace lcb { namespace views { struct ViewRequest; } }
38
- typedef lcb::views::ViewRequest* lcb_VIEWHANDLE;
39
- #else
40
- typedef struct lcbview_REQUEST_st *lcb_VIEWHANDLE;
41
- #endif
42
-
43
36
  typedef struct lcb_RESPVIEW_st lcb_RESPVIEWQUERY;
37
+ typedef struct lcbview_REQUEST_st *lcb_VIEWHANDLE;
44
38
 
45
39
  /**
46
40
  * Callback function invoked for each row returned from the view
@@ -20,7 +20,6 @@
20
20
  #ifdef LIBCOUCHBASE_STATIC
21
21
  #define LIBCOUCHBASE_API
22
22
  #define LCB_EXTERN_VAR extern
23
- #define LCB_CLASS_EXPORT
24
23
  #else
25
24
 
26
25
  #ifdef LIBCOUCHBASE_INTERNAL
@@ -33,12 +33,6 @@
33
33
  * Author: Trond Norbye <trond.norbye@sun.com>
34
34
  */
35
35
 
36
- /**
37
- * THIS IS A SLIMMED DOWN VERSION FOR LIBCOUCHBASE!
38
- * It only contains constants used by the library. The header in the
39
- * memcached source code contains all of the commands actually used.
40
- */
41
-
42
36
  #ifndef PROTOCOL_BINARY_H
43
37
  #define PROTOCOL_BINARY_H
44
38
 
@@ -47,6 +41,7 @@
47
41
  #else
48
42
  # include <stdint.h>
49
43
  #endif
44
+ #include <memcached/vbucket.h>
50
45
 
51
46
  /**
52
47
  * \addtogroup Protocol
@@ -99,7 +94,10 @@ extern "C"
99
94
  PROTOCOL_BINARY_RESPONSE_DELTA_BADVAL = 0x06,
100
95
  /** The server is not responsible for the requested vbucket */
101
96
  PROTOCOL_BINARY_RESPONSE_NOT_MY_VBUCKET = 0x07,
102
-
97
+ /** Not connected to a bucket */
98
+ PROTOCOL_BINARY_RESPONSE_NO_BUCKET = 0x08,
99
+ /** The authentication context is stale. You should reauthenticate*/
100
+ PROTOCOL_BINARY_RESPONSE_AUTH_STALE = 0x1f,
103
101
  /** Authentication failure (invalid user/password combination,
104
102
  * OR an internal error in the authentication library. Could
105
103
  * be a misconfigured SASL configuration. See server logs for
@@ -110,10 +108,16 @@ extern "C"
110
108
  /** The requested value is outside the legal range
111
109
  * (similar to EINVAL, but more specific) */
112
110
  PROTOCOL_BINARY_RESPONSE_ERANGE = 0x22,
113
-
111
+ /** Roll back to an earlier version of the vbucket UUID
112
+ * (_currently_ only used by DCP for agreeing on selecting a
113
+ * starting point) */
114
+ PROTOCOL_BINARY_RESPONSE_ROLLBACK = 0x23,
114
115
  /** No access (could be opcode, value, bucket etc) */
115
116
  PROTOCOL_BINARY_RESPONSE_EACCESS = 0x24,
116
-
117
+ /** The Couchbase cluster is currently initializing this
118
+ * node, and the Cluster manager has not yet granted all
119
+ * users access to the cluster. */
120
+ PROTOCOL_BINARY_RESPONSE_NOT_INITIALIZED = 0x25,
117
121
  /** The server have no idea what this command is for */
118
122
  PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81,
119
123
  /** Not enough memory */
@@ -207,32 +211,210 @@ extern "C"
207
211
  PROTOCOL_BINARY_CMD_DELETE = 0x04,
208
212
  PROTOCOL_BINARY_CMD_INCREMENT = 0x05,
209
213
  PROTOCOL_BINARY_CMD_DECREMENT = 0x06,
214
+ PROTOCOL_BINARY_CMD_QUIT = 0x07,
210
215
  PROTOCOL_BINARY_CMD_FLUSH = 0x08,
211
- PROTOCOL_BINARY_CMD_GETQ = 0x09 /* Used in tests */,
216
+ PROTOCOL_BINARY_CMD_GETQ = 0x09,
217
+ PROTOCOL_BINARY_CMD_NOOP = 0x0a,
212
218
  PROTOCOL_BINARY_CMD_VERSION = 0x0b,
219
+ PROTOCOL_BINARY_CMD_GETK = 0x0c,
220
+ PROTOCOL_BINARY_CMD_GETKQ = 0x0d,
213
221
  PROTOCOL_BINARY_CMD_APPEND = 0x0e,
214
222
  PROTOCOL_BINARY_CMD_PREPEND = 0x0f,
215
223
  PROTOCOL_BINARY_CMD_STAT = 0x10,
224
+ PROTOCOL_BINARY_CMD_SETQ = 0x11,
225
+ PROTOCOL_BINARY_CMD_ADDQ = 0x12,
226
+ PROTOCOL_BINARY_CMD_REPLACEQ = 0x13,
227
+ PROTOCOL_BINARY_CMD_DELETEQ = 0x14,
228
+ PROTOCOL_BINARY_CMD_INCREMENTQ = 0x15,
229
+ PROTOCOL_BINARY_CMD_DECREMENTQ = 0x16,
230
+ PROTOCOL_BINARY_CMD_QUITQ = 0x17,
231
+ PROTOCOL_BINARY_CMD_FLUSHQ = 0x18,
232
+ PROTOCOL_BINARY_CMD_APPENDQ = 0x19,
233
+ PROTOCOL_BINARY_CMD_PREPENDQ = 0x1a,
216
234
  PROTOCOL_BINARY_CMD_VERBOSITY = 0x1b,
217
235
  PROTOCOL_BINARY_CMD_TOUCH = 0x1c,
218
236
  PROTOCOL_BINARY_CMD_GAT = 0x1d,
237
+ PROTOCOL_BINARY_CMD_GATQ = 0x1e,
219
238
  PROTOCOL_BINARY_CMD_HELLO = 0x1f,
220
239
 
221
240
  PROTOCOL_BINARY_CMD_SASL_LIST_MECHS = 0x20,
222
241
  PROTOCOL_BINARY_CMD_SASL_AUTH = 0x21,
223
242
  PROTOCOL_BINARY_CMD_SASL_STEP = 0x22,
224
243
 
244
+ /* Control */
245
+ PROTOCOL_BINARY_CMD_IOCTL_GET = 0x23,
246
+ PROTOCOL_BINARY_CMD_IOCTL_SET = 0x24,
247
+
248
+ /* Config */
249
+ PROTOCOL_BINARY_CMD_CONFIG_VALIDATE = 0x25,
250
+ PROTOCOL_BINARY_CMD_CONFIG_RELOAD = 0x26,
251
+
252
+ /* Audit */
253
+ PROTOCOL_BINARY_CMD_AUDIT_PUT = 0x27,
254
+ PROTOCOL_BINARY_CMD_AUDIT_CONFIG_RELOAD = 0x28,
255
+
256
+ /* Shutdown the server */
257
+ PROTOCOL_BINARY_CMD_SHUTDOWN = 0x29,
258
+
259
+ /* These commands are used for range operations and exist within
260
+ * this header for use in other projects. Range operations are
261
+ * not expected to be implemented in the memcached server itself.
262
+ */
263
+ PROTOCOL_BINARY_CMD_RGET = 0x30,
264
+ PROTOCOL_BINARY_CMD_RSET = 0x31,
265
+ PROTOCOL_BINARY_CMD_RSETQ = 0x32,
266
+ PROTOCOL_BINARY_CMD_RAPPEND = 0x33,
267
+ PROTOCOL_BINARY_CMD_RAPPENDQ = 0x34,
268
+ PROTOCOL_BINARY_CMD_RPREPEND = 0x35,
269
+ PROTOCOL_BINARY_CMD_RPREPENDQ = 0x36,
270
+ PROTOCOL_BINARY_CMD_RDELETE = 0x37,
271
+ PROTOCOL_BINARY_CMD_RDELETEQ = 0x38,
272
+ PROTOCOL_BINARY_CMD_RINCR = 0x39,
273
+ PROTOCOL_BINARY_CMD_RINCRQ = 0x3a,
274
+ PROTOCOL_BINARY_CMD_RDECR = 0x3b,
275
+ PROTOCOL_BINARY_CMD_RDECRQ = 0x3c,
276
+ /* End Range operations */
277
+
278
+ /* VBucket commands */
279
+ PROTOCOL_BINARY_CMD_SET_VBUCKET = 0x3d,
280
+ PROTOCOL_BINARY_CMD_GET_VBUCKET = 0x3e,
281
+ PROTOCOL_BINARY_CMD_DEL_VBUCKET = 0x3f,
282
+ /* End VBucket commands */
283
+
284
+ /* TAP commands */
285
+ PROTOCOL_BINARY_CMD_TAP_CONNECT = 0x40,
286
+ PROTOCOL_BINARY_CMD_TAP_MUTATION = 0x41,
287
+ PROTOCOL_BINARY_CMD_TAP_DELETE = 0x42,
288
+ PROTOCOL_BINARY_CMD_TAP_FLUSH = 0x43,
289
+ PROTOCOL_BINARY_CMD_TAP_OPAQUE = 0x44,
290
+ PROTOCOL_BINARY_CMD_TAP_VBUCKET_SET = 0x45,
291
+ PROTOCOL_BINARY_CMD_TAP_CHECKPOINT_START = 0x46,
292
+ PROTOCOL_BINARY_CMD_TAP_CHECKPOINT_END = 0x47,
293
+ /* End TAP */
294
+
295
+ /* Vbucket command to get the VBUCKET sequence numbers for all
296
+ * vbuckets on the node */
297
+ PROTOCOL_BINARY_CMD_GET_ALL_VB_SEQNOS = 0x48,
298
+
299
+ /* DCP */
300
+ PROTOCOL_BINARY_CMD_DCP_OPEN = 0x50,
301
+ PROTOCOL_BINARY_CMD_DCP_ADD_STREAM = 0x51,
302
+ PROTOCOL_BINARY_CMD_DCP_CLOSE_STREAM = 0x52,
303
+ PROTOCOL_BINARY_CMD_DCP_STREAM_REQ = 0x53,
304
+ PROTOCOL_BINARY_CMD_DCP_GET_FAILOVER_LOG = 0x54,
305
+ PROTOCOL_BINARY_CMD_DCP_STREAM_END = 0x55,
306
+ PROTOCOL_BINARY_CMD_DCP_SNAPSHOT_MARKER = 0x56,
307
+ PROTOCOL_BINARY_CMD_DCP_MUTATION = 0x57,
308
+ PROTOCOL_BINARY_CMD_DCP_DELETION = 0x58,
309
+ PROTOCOL_BINARY_CMD_DCP_EXPIRATION = 0x59,
310
+ PROTOCOL_BINARY_CMD_DCP_FLUSH = 0x5a,
311
+ PROTOCOL_BINARY_CMD_DCP_SET_VBUCKET_STATE = 0x5b,
312
+ PROTOCOL_BINARY_CMD_DCP_NOOP = 0x5c,
313
+ PROTOCOL_BINARY_CMD_DCP_BUFFER_ACKNOWLEDGEMENT = 0x5d,
314
+ PROTOCOL_BINARY_CMD_DCP_CONTROL = 0x5e,
315
+ PROTOCOL_BINARY_CMD_DCP_RESERVED4 = 0x5f,
316
+ /* End DCP */
317
+
318
+ PROTOCOL_BINARY_CMD_STOP_PERSISTENCE = 0x80,
319
+ PROTOCOL_BINARY_CMD_START_PERSISTENCE = 0x81,
320
+ PROTOCOL_BINARY_CMD_SET_PARAM = 0x82,
225
321
  PROTOCOL_BINARY_CMD_GET_REPLICA = 0x83,
226
322
 
227
- PROTOCOL_BINARY_CMD_SELECT_BUCKET = 0x89,
323
+ /* Bucket engine */
324
+ PROTOCOL_BINARY_CMD_CREATE_BUCKET = 0x85,
325
+ PROTOCOL_BINARY_CMD_DELETE_BUCKET = 0x86,
326
+ PROTOCOL_BINARY_CMD_LIST_BUCKETS = 0x87,
327
+ PROTOCOL_BINARY_CMD_SELECT_BUCKET= 0x89,
328
+
329
+ PROTOCOL_BINARY_CMD_ASSUME_ROLE = 0x8a,
228
330
 
229
331
  PROTOCOL_BINARY_CMD_OBSERVE_SEQNO = 0x91,
230
332
  PROTOCOL_BINARY_CMD_OBSERVE = 0x92,
231
333
 
334
+ PROTOCOL_BINARY_CMD_EVICT_KEY = 0x93,
232
335
  PROTOCOL_BINARY_CMD_GET_LOCKED = 0x94,
233
336
  PROTOCOL_BINARY_CMD_UNLOCK_KEY = 0x95,
234
337
 
338
+ /**
339
+ * Return the last closed checkpoint Id for a given VBucket.
340
+ */
341
+ PROTOCOL_BINARY_CMD_LAST_CLOSED_CHECKPOINT = 0x97,
342
+ /**
343
+ * Close the TAP connection for the registered TAP client and
344
+ * remove the checkpoint cursors from its registered vbuckets.
345
+ */
346
+ PROTOCOL_BINARY_CMD_DEREGISTER_TAP_CLIENT = 0x9e,
347
+
348
+ /**
349
+ * Reset the replication chain from the node that receives
350
+ * this command. For example, given the replication chain,
351
+ * A->B->C, if A receives this command, it will reset all the
352
+ * replica vbuckets on B and C, which are replicated from A.
353
+ */
354
+ PROTOCOL_BINARY_CMD_RESET_REPLICATION_CHAIN = 0x9f,
355
+
356
+ /**
357
+ * CMD_GET_META is used to retrieve the meta section for an item.
358
+ */
359
+ PROTOCOL_BINARY_CMD_GET_META = 0xa0,
360
+ PROTOCOL_BINARY_CMD_GETQ_META = 0xa1,
361
+ PROTOCOL_BINARY_CMD_SET_WITH_META = 0xa2,
362
+ PROTOCOL_BINARY_CMD_SETQ_WITH_META = 0xa3,
363
+ PROTOCOL_BINARY_CMD_ADD_WITH_META = 0xa4,
364
+ PROTOCOL_BINARY_CMD_ADDQ_WITH_META = 0xa5,
365
+ PROTOCOL_BINARY_CMD_SNAPSHOT_VB_STATES = 0xa6,
366
+ PROTOCOL_BINARY_CMD_VBUCKET_BATCH_COUNT = 0xa7,
367
+ PROTOCOL_BINARY_CMD_DEL_WITH_META = 0xa8,
368
+ PROTOCOL_BINARY_CMD_DELQ_WITH_META = 0xa9,
369
+
370
+ /**
371
+ * Command to create a new checkpoint on a given vbucket by force
372
+ */
373
+ PROTOCOL_BINARY_CMD_CREATE_CHECKPOINT = 0xaa,
374
+ PROTOCOL_BINARY_CMD_NOTIFY_VBUCKET_UPDATE = 0xac,
375
+ /**
376
+ * Command to enable data traffic after completion of warm
377
+ */
378
+ PROTOCOL_BINARY_CMD_ENABLE_TRAFFIC = 0xad,
379
+ /**
380
+ * Command to disable data traffic temporarily
381
+ */
382
+ PROTOCOL_BINARY_CMD_DISABLE_TRAFFIC = 0xae,
383
+ /**
384
+ * Command to change the vbucket filter for a given TAP producer.
385
+ */
386
+ PROTOCOL_BINARY_CMD_CHANGE_VB_FILTER = 0xb0,
387
+ /**
388
+ * Command to wait for the checkpoint persistence
389
+ */
390
+ PROTOCOL_BINARY_CMD_CHECKPOINT_PERSISTENCE = 0xb1,
391
+ /**
392
+ * Command that returns meta data for typical memcached ops
393
+ */
394
+ PROTOCOL_BINARY_CMD_RETURN_META = 0xb2,
395
+ /**
396
+ * Command to trigger compaction of a vbucket
397
+ */
398
+ PROTOCOL_BINARY_CMD_COMPACT_DB = 0xb3,
399
+ /**
400
+ * Command to set cluster configuration
401
+ */
402
+ PROTOCOL_BINARY_CMD_SET_CLUSTER_CONFIG = 0xb4,
403
+ /**
404
+ * Command that returns cluster configuration
405
+ */
235
406
  PROTOCOL_BINARY_CMD_GET_CLUSTER_CONFIG = 0xb5,
407
+ PROTOCOL_BINARY_CMD_GET_RANDOM_KEY = 0xb6,
408
+ /**
409
+ * Command to wait for the dcp sequence number persistence
410
+ */
411
+ PROTOCOL_BINARY_CMD_SEQNO_PERSISTENCE = 0xb7,
412
+
413
+ /**
414
+ * Commands for GO-XDCR
415
+ */
416
+ PROTOCOL_BINARY_CMD_SET_DRIFT_COUNTER_STATE = 0xc1,
417
+ PROTOCOL_BINARY_CMD_GET_ADJUSTED_TIME = 0xc2,
236
418
 
237
419
  /**
238
420
  * Commands for the Sub-document API.
@@ -266,8 +448,20 @@ extern "C"
266
448
  /* Subdoc additions for Spock: */
267
449
  PROTOCOL_BINARY_CMD_SUBDOC_GET_COUNT = 0xd2,
268
450
 
269
- /* get error code mappings */
270
- PROTOCOL_BINARY_CMD_GET_ERROR_MAP = 0xfe,
451
+ /* Scrub the data */
452
+ PROTOCOL_BINARY_CMD_SCRUB = 0xf0,
453
+ /* Refresh the ISASL data */
454
+ PROTOCOL_BINARY_CMD_ISASL_REFRESH = 0xf1,
455
+ /* Refresh the SSL certificates */
456
+ PROTOCOL_BINARY_CMD_SSL_CERTS_REFRESH = 0xf2,
457
+ /* Internal timer ioctl */
458
+ PROTOCOL_BINARY_CMD_GET_CMD_TIMER = 0xf3,
459
+ /* ns_server - memcached session validation */
460
+ PROTOCOL_BINARY_CMD_SET_CTRL_TOKEN = 0xf4,
461
+ PROTOCOL_BINARY_CMD_GET_CTRL_TOKEN = 0xf5,
462
+
463
+ /* ns_server - memcached internal communication */
464
+ PROTOCOL_BINARY_CMD_INIT_COMPLETE = 0xf6,
271
465
 
272
466
  /* Reserved for being able to signal invalid opcode */
273
467
  PROTOCOL_BINARY_CMD_INVALID = 0xff
@@ -280,9 +474,25 @@ extern "C"
280
474
  typedef enum {
281
475
  PROTOCOL_BINARY_RAW_BYTES = 0x00,
282
476
  PROTOCOL_BINARY_DATATYPE_JSON = 0x01,
283
- PROTOCOL_BINARY_DATATYPE_COMPRESSED = 0x02
477
+ /* Compressed == snappy compression */
478
+ PROTOCOL_BINARY_DATATYPE_COMPRESSED = 0x02,
479
+ /* Compressed == snappy compression */
480
+ PROTOCOL_BINARY_DATATYPE_COMPRESSED_JSON = 0x03
284
481
  } protocol_binary_datatypes;
285
482
 
483
+ /**
484
+ * Definitions for extended (flexible) metadata
485
+ *
486
+ * @1: Flex Code to identify the number of extended metadata fields
487
+ * @2: Size of the Flex Code, set to 1 byte
488
+ * @3: Current size of extended metadata
489
+ */
490
+ typedef enum {
491
+ FLEX_META_CODE = 0x01,
492
+ FLEX_DATA_OFFSET = 1,
493
+ EXT_META_LEN = 1
494
+ } protocol_binary_flexmeta;
495
+
286
496
  /**
287
497
  * Definitions of sub-document flags.
288
498
  */
@@ -296,11 +506,7 @@ extern "C"
296
506
  /* (Mutation) Create the document if it does not exist. Implies
297
507
  * SUBDOC_FLAG_MKDIR_P.
298
508
  */
299
- SUBDOC_FLAG_MKDOC = 0x02,
300
-
301
- SUBDOC_FLAG_XATTR_PATH = 0x04,
302
- SUBDOC_FLAG_ACCESS_DELETED = 0x8,
303
- SUBDOC_FLAG_EXPAND_MACROS = 0x010
509
+ SUBDOC_FLAG_MKDOC = 0x02
304
510
  } protocol_binary_subdoc_flag;
305
511
 
306
512
  /**
@@ -361,6 +567,14 @@ extern "C"
361
567
  uint8_t bytes[sizeof(protocol_binary_response_header)];
362
568
  } protocol_binary_response_no_extras;
363
569
 
570
+ /**
571
+ * Definition of the packet used by the get, getq, getk and getkq command.
572
+ * See section 4
573
+ */
574
+ typedef protocol_binary_request_no_extras protocol_binary_request_get;
575
+ typedef protocol_binary_request_no_extras protocol_binary_request_getq;
576
+ typedef protocol_binary_request_no_extras protocol_binary_request_getk;
577
+ typedef protocol_binary_request_no_extras protocol_binary_request_getkq;
364
578
 
365
579
  /**
366
580
  * Definition of the packet returned from a successful get, getq, getk and
@@ -377,8 +591,9 @@ extern "C"
377
591
  uint8_t bytes[sizeof(protocol_binary_response_header) + 4];
378
592
  } protocol_binary_response_get;
379
593
 
380
- /* used by tests */
381
594
  typedef protocol_binary_response_get protocol_binary_response_getq;
595
+ typedef protocol_binary_response_get protocol_binary_response_getk;
596
+ typedef protocol_binary_response_get protocol_binary_response_getkq;
382
597
 
383
598
  /**
384
599
  * Definition of the packet used by the delete command
@@ -400,6 +615,32 @@ extern "C"
400
615
  */
401
616
  typedef protocol_binary_response_no_extras protocol_binary_response_delete;
402
617
 
618
+ /**
619
+ * Definition of the packet used by the flush command
620
+ * See section 4
621
+ * Please note that the expiration field is optional, so remember to see
622
+ * check the header.bodysize to see if it is present.
623
+ */
624
+ typedef union {
625
+ struct {
626
+ protocol_binary_request_header header;
627
+ struct {
628
+ /*
629
+ * Specifying a non-null expiration time is no longer
630
+ * supported
631
+ */
632
+ uint32_t expiration;
633
+ } body;
634
+ } message;
635
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
636
+ } protocol_binary_request_flush;
637
+
638
+ /**
639
+ * Definition of the packet returned by the flush command
640
+ * See section 4
641
+ */
642
+ typedef protocol_binary_response_no_extras protocol_binary_response_flush;
643
+
403
644
  /**
404
645
  * Definition of the packet used by set, add and replace
405
646
  * See section 4
@@ -414,6 +655,28 @@ extern "C"
414
655
  } message;
415
656
  uint8_t bytes[sizeof(protocol_binary_request_header) + 8];
416
657
  } protocol_binary_request_set;
658
+ typedef protocol_binary_request_set protocol_binary_request_add;
659
+ typedef protocol_binary_request_set protocol_binary_request_replace;
660
+
661
+ /**
662
+ * Definition of the packet returned by set, add and replace
663
+ * See section 4
664
+ */
665
+ typedef protocol_binary_response_no_extras protocol_binary_response_set;
666
+ typedef protocol_binary_response_no_extras protocol_binary_response_add;
667
+ typedef protocol_binary_response_no_extras protocol_binary_response_replace;
668
+
669
+ /**
670
+ * Definition of the noop packet
671
+ * See section 4
672
+ */
673
+ typedef protocol_binary_request_no_extras protocol_binary_request_noop;
674
+
675
+ /**
676
+ * Definition of the packet returned by the noop command
677
+ * See section 4
678
+ */
679
+ typedef protocol_binary_response_no_extras protocol_binary_response_noop;
417
680
 
418
681
  /**
419
682
  * Definition of the structure used by the increment and decrement
@@ -452,6 +715,38 @@ extern "C"
452
715
  typedef protocol_binary_response_no_extras protocol_binary_response_incr;
453
716
  typedef protocol_binary_response_no_extras protocol_binary_response_decr;
454
717
 
718
+ /**
719
+ * Definition of the quit
720
+ * See section 4
721
+ */
722
+ typedef protocol_binary_request_no_extras protocol_binary_request_quit;
723
+
724
+ /**
725
+ * Definition of the packet returned by the quit command
726
+ * See section 4
727
+ */
728
+ typedef protocol_binary_response_no_extras protocol_binary_response_quit;
729
+
730
+ /**
731
+ * Definition of the packet used by append and prepend command
732
+ * See section 4
733
+ */
734
+ typedef protocol_binary_request_no_extras protocol_binary_request_append;
735
+ typedef protocol_binary_request_no_extras protocol_binary_request_prepend;
736
+
737
+ /**
738
+ * Definition of the packet returned from a successful append or prepend
739
+ * See section 4
740
+ */
741
+ typedef protocol_binary_response_no_extras protocol_binary_response_append;
742
+ typedef protocol_binary_response_no_extras protocol_binary_response_prepend;
743
+
744
+ /**
745
+ * Definition of the packet used by the version command
746
+ * See section 4
747
+ */
748
+ typedef protocol_binary_request_no_extras protocol_binary_request_version;
749
+
455
750
  /**
456
751
  * Definition of the packet returned from a successful version command
457
752
  * See section 4
@@ -520,6 +815,13 @@ extern "C"
520
815
  uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
521
816
  } protocol_binary_request_gat;
522
817
 
818
+ typedef protocol_binary_request_gat protocol_binary_request_gatq;
819
+
820
+ /**
821
+ * Definition of the packet returned from the GAT(Q)
822
+ */
823
+ typedef protocol_binary_response_get protocol_binary_response_gat;
824
+ typedef protocol_binary_response_get protocol_binary_response_gatq;
523
825
 
524
826
  /**
525
827
  * Definition of the packet used by SUBDOCUMENT single-path commands.
@@ -661,6 +963,269 @@ extern "C"
661
963
  uint8_t bytes[sizeof(protocol_binary_response_header)];
662
964
  } protocol_binary_response_subdoc_multi_mutation;
663
965
 
966
+
967
+ /**
968
+ * Definition of a request for a range operation.
969
+ * See http://code.google.com/p/memcached/wiki/RangeOps
970
+ *
971
+ * These types are used for range operations and exist within
972
+ * this header for use in other projects. Range operations are
973
+ * not expected to be implemented in the memcached server itself.
974
+ */
975
+ typedef union {
976
+ struct {
977
+ protocol_binary_response_header header;
978
+ struct {
979
+ uint16_t size;
980
+ uint8_t reserved;
981
+ uint8_t flags;
982
+ uint32_t max_results;
983
+ } body;
984
+ } message;
985
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
986
+ } protocol_binary_request_rangeop;
987
+
988
+ typedef protocol_binary_request_rangeop protocol_binary_request_rget;
989
+ typedef protocol_binary_request_rangeop protocol_binary_request_rset;
990
+ typedef protocol_binary_request_rangeop protocol_binary_request_rsetq;
991
+ typedef protocol_binary_request_rangeop protocol_binary_request_rappend;
992
+ typedef protocol_binary_request_rangeop protocol_binary_request_rappendq;
993
+ typedef protocol_binary_request_rangeop protocol_binary_request_rprepend;
994
+ typedef protocol_binary_request_rangeop protocol_binary_request_rprependq;
995
+ typedef protocol_binary_request_rangeop protocol_binary_request_rdelete;
996
+ typedef protocol_binary_request_rangeop protocol_binary_request_rdeleteq;
997
+ typedef protocol_binary_request_rangeop protocol_binary_request_rincr;
998
+ typedef protocol_binary_request_rangeop protocol_binary_request_rincrq;
999
+ typedef protocol_binary_request_rangeop protocol_binary_request_rdecr;
1000
+ typedef protocol_binary_request_rangeop protocol_binary_request_rdecrq;
1001
+
1002
+
1003
+ /**
1004
+ * Definition of tap commands
1005
+ * See To be written
1006
+ *
1007
+ */
1008
+
1009
+ typedef union {
1010
+ struct {
1011
+ protocol_binary_request_header header;
1012
+ struct {
1013
+ /**
1014
+ * flags is a bitmask used to set properties for the
1015
+ * the connection. Please In order to be forward compatible
1016
+ * you should set all undefined bits to 0.
1017
+ *
1018
+ * If the bit require extra userdata, it will be stored
1019
+ * in the user-data field of the body (passed to the engine
1020
+ * as enginespeciffic). That means that when you parse the
1021
+ * flags and the engine-specific data, you have to work your
1022
+ * way from bit 0 and upwards to find the correct offset for
1023
+ * the data.
1024
+ *
1025
+ */
1026
+ uint32_t flags;
1027
+
1028
+ /**
1029
+ * Backfill age
1030
+ *
1031
+ * By using this flag you can limit the amount of data being
1032
+ * transmitted. If you don't specify a backfill age, the
1033
+ * server will transmit everything it contains.
1034
+ *
1035
+ * The first 8 bytes in the engine specific data contains
1036
+ * the oldest entry (from epoc) you're interested in.
1037
+ * Specifying a time in the future (for the server you are
1038
+ * connecting to), will cause it to start streaming current
1039
+ * changes.
1040
+ */
1041
+ #define TAP_CONNECT_FLAG_BACKFILL 0x01
1042
+ /**
1043
+ * Dump will cause the server to send the data stored on the
1044
+ * server, but disconnect when the keys stored in the server
1045
+ * are transmitted.
1046
+ */
1047
+ #define TAP_CONNECT_FLAG_DUMP 0x02
1048
+ /**
1049
+ * The body contains a list of 16 bits words in network byte
1050
+ * order specifying the vbucket ids to monitor. The first 16
1051
+ * bit word contains the number of buckets. The number of 0
1052
+ * means "all buckets"
1053
+ */
1054
+ #define TAP_CONNECT_FLAG_LIST_VBUCKETS 0x04
1055
+ /**
1056
+ * The responsibility of the vbuckets is to be transferred
1057
+ * over to the caller when all items are transferred.
1058
+ */
1059
+ #define TAP_CONNECT_FLAG_TAKEOVER_VBUCKETS 0x08
1060
+ /**
1061
+ * The tap consumer supports ack'ing of tap messages
1062
+ */
1063
+ #define TAP_CONNECT_SUPPORT_ACK 0x10
1064
+ /**
1065
+ * The tap consumer would prefer to just get the keys
1066
+ * back. If the engine supports this it will set
1067
+ * the TAP_FLAG_NO_VALUE flag in each of the
1068
+ * tap packets returned.
1069
+ */
1070
+ #define TAP_CONNECT_REQUEST_KEYS_ONLY 0x20
1071
+ /**
1072
+ * The body contains a list of (vbucket_id, last_checkpoint_id)
1073
+ * pairs. This provides the checkpoint support in TAP streams.
1074
+ * The last checkpoint id represents the last checkpoint that
1075
+ * was successfully persisted.
1076
+ */
1077
+ #define TAP_CONNECT_CHECKPOINT 0x40
1078
+ /**
1079
+ * The tap consumer is a registered tap client, which means that
1080
+ * the tap server will maintain its checkpoint cursor permanently.
1081
+ */
1082
+ #define TAP_CONNECT_REGISTERED_CLIENT 0x80
1083
+
1084
+ /**
1085
+ * The initial TAP implementation convert flags to/from network
1086
+ * byte order, but the values isn't stored in host local order
1087
+ * causing them to change if you mix platforms..
1088
+ */
1089
+ #define TAP_CONNECT_TAP_FIX_FLAG_BYTEORDER 0x100
1090
+
1091
+ } body;
1092
+ } message;
1093
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
1094
+ } protocol_binary_request_tap_connect;
1095
+
1096
+ typedef union {
1097
+ struct {
1098
+ protocol_binary_request_header header;
1099
+ struct {
1100
+ struct {
1101
+ uint16_t enginespecific_length;
1102
+ /*
1103
+ * The flag section support the following flags
1104
+ */
1105
+ /**
1106
+ * Request that the consumer send a response packet
1107
+ * for this packet. The opaque field must be preserved
1108
+ * in the response.
1109
+ */
1110
+ #define TAP_FLAG_ACK 0x01
1111
+ /**
1112
+ * The value for the key is not included in the packet
1113
+ */
1114
+ #define TAP_FLAG_NO_VALUE 0x02
1115
+ /**
1116
+ * The flags are in network byte order
1117
+ */
1118
+ #define TAP_FLAG_NETWORK_BYTE_ORDER 0x04
1119
+
1120
+ uint16_t flags;
1121
+ uint8_t ttl;
1122
+ uint8_t res1;
1123
+ uint8_t res2;
1124
+ uint8_t res3;
1125
+ } tap;
1126
+ struct {
1127
+ uint32_t flags;
1128
+ uint32_t expiration;
1129
+ } item;
1130
+ } body;
1131
+ } message;
1132
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 16];
1133
+ } protocol_binary_request_tap_mutation;
1134
+
1135
+ typedef union {
1136
+ struct {
1137
+ protocol_binary_request_header header;
1138
+ struct {
1139
+ struct {
1140
+ uint16_t enginespecific_length;
1141
+ /**
1142
+ * See the definition of the flags for
1143
+ * protocol_binary_request_tap_mutation for a description
1144
+ * of the available flags.
1145
+ */
1146
+ uint16_t flags;
1147
+ uint8_t ttl;
1148
+ uint8_t res1;
1149
+ uint8_t res2;
1150
+ uint8_t res3;
1151
+ } tap;
1152
+ } body;
1153
+ } message;
1154
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 8];
1155
+ } protocol_binary_request_tap_no_extras;
1156
+
1157
+ typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_delete;
1158
+ typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_flush;
1159
+
1160
+ /**
1161
+ * TAP OPAQUE command list
1162
+ */
1163
+ #define TAP_OPAQUE_ENABLE_AUTO_NACK 0
1164
+ #define TAP_OPAQUE_INITIAL_VBUCKET_STREAM 1
1165
+ #define TAP_OPAQUE_ENABLE_CHECKPOINT_SYNC 2
1166
+ #define TAP_OPAQUE_OPEN_CHECKPOINT 3
1167
+ #define TAP_OPAQUE_COMPLETE_VB_FILTER_CHANGE 4
1168
+ #define TAP_OPAQUE_CLOSE_TAP_STREAM 7
1169
+ #define TAP_OPAQUE_CLOSE_BACKFILL 8
1170
+
1171
+ typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_opaque;
1172
+ typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_vbucket_set;
1173
+
1174
+
1175
+ /**
1176
+ * Definition of the packet used by the scrub.
1177
+ */
1178
+ typedef protocol_binary_request_no_extras protocol_binary_request_scrub;
1179
+
1180
+ /**
1181
+ * Definition of the packet returned from scrub.
1182
+ */
1183
+ typedef protocol_binary_response_no_extras protocol_binary_response_scrub;
1184
+
1185
+
1186
+ /**
1187
+ * Definition of the packet used by set vbucket
1188
+ */
1189
+ typedef union {
1190
+ struct {
1191
+ protocol_binary_request_header header;
1192
+ struct {
1193
+ vbucket_state_t state;
1194
+ } body;
1195
+ } message;
1196
+ uint8_t bytes[sizeof(protocol_binary_request_header) + sizeof(vbucket_state_t)];
1197
+ } protocol_binary_request_set_vbucket;
1198
+ /**
1199
+ * Definition of the packet returned from set vbucket
1200
+ */
1201
+ typedef protocol_binary_response_no_extras protocol_binary_response_set_vbucket;
1202
+ /**
1203
+ * Definition of the packet used by del vbucket
1204
+ */
1205
+ typedef protocol_binary_request_no_extras protocol_binary_request_del_vbucket;
1206
+ /**
1207
+ * Definition of the packet returned from del vbucket
1208
+ */
1209
+ typedef protocol_binary_response_no_extras protocol_binary_response_del_vbucket;
1210
+
1211
+ /**
1212
+ * Definition of the packet used by get vbucket
1213
+ */
1214
+ typedef protocol_binary_request_no_extras protocol_binary_request_get_vbucket;
1215
+
1216
+ /**
1217
+ * Definition of the packet returned from get vbucket
1218
+ */
1219
+ typedef union {
1220
+ struct {
1221
+ protocol_binary_response_header header;
1222
+ struct {
1223
+ vbucket_state_t state;
1224
+ } body;
1225
+ } message;
1226
+ uint8_t bytes[sizeof(protocol_binary_response_header) + sizeof(vbucket_state_t)];
1227
+ } protocol_binary_response_get_vbucket;
1228
+
664
1229
  /**
665
1230
  * Definition of hello's features.
666
1231
  */
@@ -669,24 +1234,18 @@ extern "C"
669
1234
  PROTOCOL_BINARY_FEATURE_TLS = 0x2,
670
1235
  PROTOCOL_BINARY_FEATURE_TCPNODELAY = 0x03,
671
1236
  PROTOCOL_BINARY_FEATURE_MUTATION_SEQNO = 0x04,
672
- PROTOCOL_BINARY_FEATURE_TCPDELAY = 0x05,
673
- PROTOCOL_BINARY_FEATURE_XATTR = 0x06,
674
- PROTOCOL_BINARY_FEATURE_XERROR = 0x07,
675
- PROTOCOL_BINARY_FEATURE_SELECT_BUCKET = 0x08
1237
+ PROTOCOL_BINARY_FEATURE_TCPDELAY = 0x05
676
1238
  } protocol_binary_hello_features;
677
1239
 
678
1240
  #define MEMCACHED_FIRST_HELLO_FEATURE 0x01
679
- #define MEMCACHED_TOTAL_HELLO_FEATURES 10
1241
+ #define MEMCACHED_TOTAL_HELLO_FEATURES 0x05
680
1242
 
681
1243
  #define protocol_feature_2_text(a) \
682
1244
  (a == PROTOCOL_BINARY_FEATURE_DATATYPE) ? "Datatype" : \
683
1245
  (a == PROTOCOL_BINARY_FEATURE_TLS) ? "TLS" : \
684
1246
  (a == PROTOCOL_BINARY_FEATURE_TCPNODELAY) ? "TCP NODELAY" : \
685
1247
  (a == PROTOCOL_BINARY_FEATURE_MUTATION_SEQNO) ? "Mutation seqno" : \
686
- (a == PROTOCOL_BINARY_FEATURE_TCPDELAY) ? "TCP DELAY" : \
687
- (a == PROTOCOL_BINARY_FEATURE_XATTR) ? "XATTR" : \
688
- (a == PROTOCOL_BINARY_FEATURE_XERROR) ? "Error Map": \
689
- (a == PROTOCOL_BINARY_FEATURE_SELECT_BUCKET) ? "Select Bucket": "Unknown"
1248
+ (a == PROTOCOL_BINARY_FEATURE_TCPDELAY) ? "TCP DELAY" : "Unknown"
690
1249
 
691
1250
  /**
692
1251
  * The HELLO command is used by the client and the server to agree
@@ -723,21 +1282,518 @@ extern "C"
723
1282
  */
724
1283
  typedef protocol_binary_response_no_extras protocol_binary_response_hello;
725
1284
 
1285
+ /**
1286
+ * The SET_CTRL_TOKEN command will be used by ns_server and ns_server alone
1287
+ * to set the session cas token in memcached which will be used to
1288
+ * recognize the particular instance on ns_server. The previous token will
1289
+ * be passed in the cas section of the request header for the CAS operation,
1290
+ * and the new token will be part of ext (8B).
1291
+ *
1292
+ * The response to this request will include the cas as it were set,
1293
+ * and a SUCCESS as status, or a KEY_EEXISTS with the existing token in
1294
+ * memcached if the CAS operation were to fail.
1295
+ */
1296
+
1297
+ /**
1298
+ * Definition of the request packet for SET_CTRL_TOKEN.
1299
+ * Body: new session_cas_token of uint64_t type.
1300
+ */
1301
+ typedef union {
1302
+ struct {
1303
+ protocol_binary_request_header header;
1304
+ struct {
1305
+ uint64_t new_cas;
1306
+ } body;
1307
+ } message;
1308
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 8];
1309
+ } protocol_binary_request_set_ctrl_token;
1310
+
1311
+ /**
1312
+ * Definition of the response packet for SET_CTRL_TOKEN
1313
+ */
1314
+ typedef protocol_binary_response_no_extras protocol_binary_response_set_ctrl_token;
1315
+
1316
+ /**
1317
+ * The GET_CTRL_TOKEN command will be used by ns_server to fetch the current
1318
+ * session cas token held in memcached.
1319
+ *
1320
+ * The response to this request will include the token currently held in
1321
+ * memcached in the cas field of the header.
1322
+ */
1323
+
1324
+ /**
1325
+ * Definition of the request packet for GET_CTRL_TOKEN.
1326
+ */
1327
+ typedef protocol_binary_request_no_extras protocol_binary_request_get_ctrl_token;
1328
+
1329
+
1330
+ /**
1331
+ * Definition of the response packet for GET_CTRL_TOKEN
1332
+ */
1333
+ typedef protocol_binary_response_no_extras protocol_binary_response_get_ctrl_token;
1334
+
1335
+ /* DCP related stuff */
1336
+ typedef union {
1337
+ struct {
1338
+ protocol_binary_request_header header;
1339
+ struct {
1340
+ uint32_t seqno;
1341
+ /*
1342
+ * The following flags are defined
1343
+ */
1344
+ #define DCP_OPEN_PRODUCER 1
1345
+ #define DCP_OPEN_NOTIFIER 2
1346
+ uint32_t flags;
1347
+ } body;
1348
+ } message;
1349
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 8];
1350
+ } protocol_binary_request_dcp_open;
1351
+
1352
+ typedef protocol_binary_response_no_extras protocol_binary_response_dcp_open;
1353
+
1354
+ typedef union {
1355
+ struct {
1356
+ protocol_binary_request_header header;
1357
+ struct {
1358
+ /*
1359
+ * The following flags are defined
1360
+ */
1361
+ #define DCP_ADD_STREAM_FLAG_TAKEOVER 1
1362
+ #define DCP_ADD_STREAM_FLAG_DISKONLY 2
1363
+ #define DCP_ADD_STREAM_FLAG_LATEST 4
1364
+ uint32_t flags;
1365
+ } body;
1366
+ } message;
1367
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
1368
+ } protocol_binary_request_dcp_add_stream;
1369
+
1370
+ typedef union {
1371
+ struct {
1372
+ protocol_binary_response_header header;
1373
+ struct {
1374
+ uint32_t opaque;
1375
+ } body;
1376
+ } message;
1377
+ uint8_t bytes[sizeof(protocol_binary_response_header) + 4];
1378
+ } protocol_binary_response_dcp_add_stream;
1379
+
1380
+ typedef protocol_binary_request_no_extras protocol_binary_request_dcp_close_stream;
1381
+ typedef protocol_binary_response_no_extras protocol_binary_response_dcp_close_stream;
1382
+
1383
+ typedef union {
1384
+ struct {
1385
+ protocol_binary_request_header header;
1386
+ struct {
1387
+ uint32_t flags;
1388
+ uint32_t reserved;
1389
+ uint64_t start_seqno;
1390
+ uint64_t end_seqno;
1391
+ uint64_t vbucket_uuid;
1392
+ uint64_t snap_start_seqno;
1393
+ uint64_t snap_end_seqno;
1394
+ } body;
1395
+ /* Group ID is specified in the key */
1396
+ } message;
1397
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 48];
1398
+ } protocol_binary_request_dcp_stream_req;
1399
+
1400
+ typedef union {
1401
+ struct {
1402
+ protocol_binary_response_header header;
1403
+ } message;
1404
+ /*
1405
+ ** In case of PROTOCOL_BINARY_RESPONSE_ROLLBACK the body contains
1406
+ ** the rollback sequence number (uint64_t)
1407
+ */
1408
+ uint8_t bytes[sizeof(protocol_binary_request_header)];
1409
+ } protocol_binary_response_dcp_stream_req;
1410
+
1411
+ typedef protocol_binary_request_no_extras protocol_binary_request_dcp_get_failover_log;
1412
+
1413
+ /* The body of the message contains UUID/SEQNO pairs */
1414
+ typedef protocol_binary_response_no_extras protocol_binary_response_dcp_get_failover_log;
1415
+
1416
+ typedef union {
1417
+ struct {
1418
+ protocol_binary_request_header header;
1419
+ struct {
1420
+ /**
1421
+ * All flags set to 0 == OK,
1422
+ * 1: state changed
1423
+ */
1424
+ uint32_t flags;
1425
+ } body;
1426
+ } message;
1427
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
1428
+ } protocol_binary_request_dcp_stream_end;
1429
+ typedef protocol_binary_response_no_extras protocol_binary_response_dcp_stream_end;
1430
+
1431
+ typedef union {
1432
+ struct {
1433
+ protocol_binary_request_header header;
1434
+ struct {
1435
+ uint64_t start_seqno;
1436
+ uint64_t end_seqno;
1437
+ uint32_t flags;
1438
+ } body;
1439
+ } message;
1440
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 20];
1441
+ } protocol_binary_request_dcp_snapshot_marker;
1442
+
1443
+ typedef protocol_binary_response_no_extras protocol_binary_response_dcp_snapshot_marker;
1444
+
1445
+ typedef union {
1446
+ struct {
1447
+ protocol_binary_request_header header;
1448
+ struct {
1449
+ uint64_t by_seqno;
1450
+ uint64_t rev_seqno;
1451
+ uint32_t flags;
1452
+ uint32_t expiration;
1453
+ uint32_t lock_time;
1454
+ uint16_t nmeta;
1455
+ uint8_t nru;
1456
+ } body;
1457
+ } message;
1458
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 31];
1459
+ } protocol_binary_request_dcp_mutation;
1460
+
1461
+ typedef union {
1462
+ struct {
1463
+ protocol_binary_request_header header;
1464
+ struct {
1465
+ uint64_t by_seqno;
1466
+ uint64_t rev_seqno;
1467
+ uint16_t nmeta;
1468
+ } body;
1469
+ } message;
1470
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 18];
1471
+ } protocol_binary_request_dcp_deletion;
1472
+
1473
+ typedef protocol_binary_request_dcp_deletion protocol_binary_request_dcp_expiration;
1474
+ typedef protocol_binary_request_no_extras protocol_binary_request_dcp_flush;
1475
+
1476
+ typedef union {
1477
+ struct {
1478
+ protocol_binary_request_header header;
1479
+ struct {
1480
+ /**
1481
+ * 0x01 - Active
1482
+ * 0x02 - Replica
1483
+ * 0x03 - Pending
1484
+ * 0x04 - Dead
1485
+ */
1486
+ uint8_t state;
1487
+ } body;
1488
+ } message;
1489
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 1];
1490
+ } protocol_binary_request_dcp_set_vbucket_state;
1491
+ typedef protocol_binary_response_no_extras protocol_binary_response_dcp_set_vbucket_state;
1492
+
1493
+ typedef protocol_binary_request_no_extras protocol_binary_request_dcp_noop;
1494
+ typedef protocol_binary_response_no_extras protocol_binary_response_dcp_noop;
1495
+
1496
+ typedef union {
1497
+ struct {
1498
+ protocol_binary_request_header header;
1499
+ struct {
1500
+ uint32_t buffer_bytes;
1501
+ } body;
1502
+ } message;
1503
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
1504
+ } protocol_binary_request_dcp_buffer_acknowledgement;
1505
+ typedef protocol_binary_response_no_extras protocol_binary_response_dcp_buffer_acknowledgement;
1506
+
1507
+ typedef protocol_binary_request_no_extras protocol_binary_request_dcp_control;
1508
+ typedef protocol_binary_response_no_extras protocol_binary_response_dcp_control;
1509
+
1510
+
1511
+ /**
1512
+ * IOCTL_GET command message to get/set control parameters.
1513
+ */
1514
+ typedef protocol_binary_request_no_extras protocol_binary_request_ioctl_get;
1515
+ typedef protocol_binary_request_no_extras protocol_binary_request_ioctl_set;
1516
+
1517
+ typedef protocol_binary_request_no_extras protocol_binary_request_config_validate;
1518
+ typedef protocol_binary_request_no_extras protocol_binary_request_config_reload;
1519
+
1520
+ typedef protocol_binary_request_no_extras protocol_binary_request_ssl_refresh;
1521
+ typedef protocol_binary_response_no_extras protocol_binary_response_ssl_refresh;
1522
+
1523
+ /**
1524
+ * Request command timings for a bucket from memcached. Privileged
1525
+ * connections may specify the name of the bucket in the "key" field,
1526
+ * or the aggregated timings for the entire server by using the
1527
+ * special name <code>/all/</code>.
1528
+ *
1529
+ * The returned payload is a json document of the following format:
1530
+ * { "us" : [ x, x, x, x, ... ],
1531
+ * "ms" : [ y, y, y, ...],
1532
+ * "500ms" : [ z, z, z, ...],
1533
+ * "wayout" : nnn
1534
+ * }
1535
+ */
1536
+ typedef union {
1537
+ struct {
1538
+ protocol_binary_request_header header;
1539
+ struct {
1540
+ uint8_t opcode;
1541
+ } body;
1542
+ } message;
1543
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 1];
1544
+ } protocol_binary_request_get_cmd_timer;
1545
+
1546
+ typedef protocol_binary_response_no_extras protocol_binary_response_get_cmd_timer;
1547
+
1548
+ typedef protocol_binary_request_no_extras protocol_binary_request_create_bucket;
1549
+ typedef protocol_binary_request_no_extras protocol_binary_request_delete_bucket;
1550
+ typedef protocol_binary_request_no_extras protocol_binary_request_list_buckets;
1551
+ typedef protocol_binary_request_no_extras protocol_binary_request_select_bucket;
1552
+ typedef protocol_binary_request_no_extras protocol_binary_request_assume_role;
1553
+
1554
+ /*
1555
+ * Parameter types of CMD_SET_PARAM command.
1556
+ */
1557
+ typedef enum {
1558
+ protocol_binary_engine_param_flush = 1, /* flusher-related param type */
1559
+ protocol_binary_engine_param_tap, /* tap-related param type */
1560
+ protocol_binary_engine_param_checkpoint /* checkpoint-related param type */
1561
+ } protocol_binary_engine_param_t;
1562
+
1563
+ /**
1564
+ * CMD_SET_PARAM command message to set engine parameters.
1565
+ * flush, tap, and checkpoint parameter types are currently supported.
1566
+ */
1567
+ typedef union {
1568
+ struct {
1569
+ protocol_binary_request_header header;
1570
+ struct {
1571
+ protocol_binary_engine_param_t param_type;
1572
+ } body;
1573
+ } message;
1574
+ uint8_t bytes[sizeof(protocol_binary_request_header) + sizeof(protocol_binary_engine_param_t)];
1575
+ } protocol_binary_request_set_param;
1576
+
1577
+ typedef union {
1578
+ struct {
1579
+ protocol_binary_request_header header;
1580
+ struct {
1581
+ uint32_t size;
1582
+ } body;
1583
+ } message;
1584
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
1585
+ } protocol_binary_request_set_batch_count;
1586
+
1587
+
1588
+ /**
1589
+ * This flag is used by the setWithMeta/addWithMeta/deleteWithMeta packets
1590
+ * to specify that the conflict resolution mechanism should be skipped for
1591
+ * this operation.
1592
+ */
1593
+ #define SKIP_CONFLICT_RESOLUTION_FLAG 0x01
1594
+
1595
+ #define SET_RET_META 1
1596
+ #define ADD_RET_META 2
1597
+ #define DEL_RET_META 3
1598
+
1599
+ /**
1600
+ * This flag is used with the get meta response packet. If set it
1601
+ * specifies that the item recieved has been deleted, but that the
1602
+ * items meta data is still contained in ep-engine. Eg. the item
1603
+ * has been soft deleted.
1604
+ */
1605
+ #define GET_META_ITEM_DELETED_FLAG 0x01
1606
+
1607
+
1608
+ /**
1609
+ * The physical layout for the CMD_SET_WITH_META looks like the the normal
1610
+ * set request with the addition of a bulk of extra meta data stored
1611
+ * at the <b>end</b> of the package.
1612
+ */
1613
+ typedef union {
1614
+ struct {
1615
+ protocol_binary_request_header header;
1616
+ struct {
1617
+ uint32_t flags;
1618
+ uint32_t expiration;
1619
+ uint64_t seqno;
1620
+ uint64_t cas;
1621
+ } body;
1622
+ } message;
1623
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 24];
1624
+ } protocol_binary_request_set_with_meta;
1625
+
1626
+ /**
1627
+ * The message format for delete with meta
1628
+ */
1629
+ typedef protocol_binary_request_set_with_meta protocol_binary_request_delete_with_meta;
1630
+
726
1631
  /**
727
1632
  * The message format for getLocked engine API
728
1633
  */
729
1634
  typedef protocol_binary_request_gat protocol_binary_request_getl;
730
1635
 
1636
+ /**
1637
+ * The physical layout for a CMD_GET_META command returns the meta-data
1638
+ * section for an item:
1639
+ */
1640
+ typedef protocol_binary_request_no_extras protocol_binary_request_get_meta;
1641
+
1642
+ /**
1643
+ * The response for CMD_SET_WITH_META does not carry any user-data and the
1644
+ * status of the operation is signalled in the status bits.
1645
+ */
1646
+ typedef protocol_binary_response_no_extras protocol_binary_response_set_with_meta;
1647
+
1648
+ typedef union {
1649
+ struct {
1650
+ protocol_binary_request_header header;
1651
+ struct {
1652
+ uint64_t file_version;
1653
+ uint64_t header_offset;
1654
+ uint32_t vbucket_state_updated;
1655
+ uint32_t state;
1656
+ uint64_t checkpoint;
1657
+ } body;
1658
+ } message;
1659
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 32];
1660
+ } protocol_binary_request_notify_vbucket_update;
1661
+ typedef protocol_binary_response_no_extras protocol_binary_response_notify_vbucket_update;
1662
+
1663
+ /**
1664
+ * The physical layout for the CMD_RETURN_META
1665
+ */
1666
+ typedef union {
1667
+ struct {
1668
+ protocol_binary_request_header header;
1669
+ struct {
1670
+ uint32_t mutation_type;
1671
+ uint32_t flags;
1672
+ uint32_t expiration;
1673
+ } body;
1674
+ } message;
1675
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 12];
1676
+ } protocol_binary_request_return_meta;
1677
+
1678
+
1679
+ /**
1680
+ * Message format for CMD_INIT_COMPLETE
1681
+ */
1682
+ typedef protocol_binary_request_no_extras protocol_binary_request_init_complete;
1683
+ typedef protocol_binary_response_no_extras protocol_binary_response_init_complete;
1684
+
1685
+ /**
1686
+ * Message format for CMD_SET_CONFIG
1687
+ */
1688
+ typedef protocol_binary_request_no_extras protocol_binary_request_set_cluster_config;
1689
+
731
1690
  /**
732
1691
  * Message format for CMD_GET_CONFIG
733
1692
  */
734
1693
  typedef protocol_binary_request_no_extras protocol_binary_request_get_cluster_config;
735
1694
 
1695
+ /**
1696
+ * Message format for CMD_GET_ADJUSTED_TIME
1697
+ *
1698
+ * The PROTOCOL_BINARY_CMD_GET_ADJUSTED_TIME command will be
1699
+ * used by XDCR to retrieve the vbucket's latest adjusted_time
1700
+ * which is calculated based on the driftCounter if timeSync
1701
+ * has been enabled.
1702
+ *
1703
+ * Request:-
1704
+ *
1705
+ * Header: Contains a vbucket id.
1706
+ *
1707
+ * Response:-
1708
+ *
1709
+ * The response will contain the adjusted_time (type: int64_t)
1710
+ * as part of the body if in case of a SUCCESS, or else a NOTSUP
1711
+ * in case of timeSync not being enabled.
1712
+ *
1713
+ * The request packet's header will contain the vbucket_id.
1714
+ */
1715
+ typedef protocol_binary_request_no_extras protocol_binary_request_get_adjusted_time;
1716
+
1717
+ /**
1718
+ * Message format for CMD_SET_DRIFT_COUNTER_STATE
1719
+ *
1720
+ * The PROTOCOL_BINARY_CMD_SET_DRIFT_COUNTER_STATE command will be
1721
+ * used by GO-XDCR to set the initial drift counter and enable/disable
1722
+ * the time synchronization for the vbucket.
1723
+ *
1724
+ * Request:-
1725
+ *
1726
+ * Header: Contains a vbucket id.
1727
+ * Extras: Contains the initial drift value which is of type int64_t and
1728
+ * the time sync state (0x00 for disable, 0x01 for enable),
1729
+ *
1730
+ * Response:-
1731
+ *
1732
+ * The response will return a SUCCESS after saving the settings and
1733
+ * a NOT_MY_VBUCKET (along with cluster config) if the vbucket isn't
1734
+ * found.
1735
+ */
1736
+ typedef union {
1737
+ struct {
1738
+ protocol_binary_request_header header;
1739
+ struct {
1740
+ int64_t initial_drift;
1741
+ uint8_t time_sync;
1742
+ } body;
1743
+ } message;
1744
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 9];
1745
+ } protocol_binary_request_set_drift_counter_state;
1746
+
1747
+ /**
1748
+ * The physical layout for the CMD_COMPACT_DB
1749
+ */
1750
+ typedef union {
1751
+ struct {
1752
+ protocol_binary_request_header header;
1753
+ struct {
1754
+ uint64_t purge_before_ts;
1755
+ uint64_t purge_before_seq;
1756
+ uint8_t drop_deletes;
1757
+ uint8_t align_pad1;
1758
+ uint16_t align_pad2;
1759
+ uint32_t align_pad3;
1760
+ } body;
1761
+ } message;
1762
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 24];
1763
+ } protocol_binary_request_compact_db;
1764
+
1765
+ typedef protocol_binary_request_get protocol_binary_request_get_random;
1766
+
736
1767
  #define OBS_STATE_NOT_PERSISTED 0x00
737
1768
  #define OBS_STATE_PERSISTED 0x01
738
1769
  #define OBS_STATE_NOT_FOUND 0x80
739
1770
  #define OBS_STATE_LOGICAL_DEL 0x81
740
1771
 
1772
+ /**
1773
+ * The physical layout for the PROTOCOL_BINARY_CMD_AUDIT_PUT
1774
+ */
1775
+ typedef union {
1776
+ struct {
1777
+ protocol_binary_request_header header;
1778
+ struct {
1779
+ uint32_t id;
1780
+ } body;
1781
+ } message;
1782
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
1783
+ } protocol_binary_request_audit_put;
1784
+
1785
+ typedef protocol_binary_response_no_extras protocol_binary_response_audit_put;
1786
+
1787
+ /**
1788
+ * The shutdown message is sent from ns_server to memcached to tell
1789
+ * memcached to initiate a clean shutdown. This is a privileged
1790
+ * command and carries no payload, but the CAS field needs to be
1791
+ * set to the current session token (see GET/SET_CTRL_TOKEN)
1792
+ */
1793
+ typedef protocol_binary_request_no_extras protocol_binary_request_shutdown;
1794
+ typedef protocol_binary_response_no_extras protocol_binary_response_shutdown;
1795
+
1796
+
741
1797
  /**
742
1798
  * The PROTOCOL_BINARY_CMD_OBSERVE_SEQNO command is used by the
743
1799
  * client to retrieve information about the vbucket in order to
@@ -805,6 +1861,52 @@ extern "C"
805
1861
  */
806
1862
  typedef protocol_binary_response_no_extras protocol_binary_response_observe_seqno;
807
1863
 
1864
+ /**
1865
+ * Definition of the request packet for the command
1866
+ * PROTOCOL_BINARY_CMD_GET_ALL_VB_SEQNOS
1867
+ *
1868
+ * Header: Only opcode field is used.
1869
+ *
1870
+ * Body: Contains the vbucket state for which the vb sequence numbers are
1871
+ * requested.
1872
+ * Please note that this field is optional, header.request.extlen is
1873
+ * checked to see if it is present. If not present, it implies request
1874
+ * is for all vbucket states.
1875
+ */
1876
+ typedef union {
1877
+ struct {
1878
+ protocol_binary_request_header header;
1879
+ struct {
1880
+ vbucket_state_t state;
1881
+ } body;
1882
+ } message;
1883
+ uint8_t bytes[sizeof(protocol_binary_request_header) +
1884
+ sizeof(vbucket_state_t)];
1885
+ } protocol_binary_request_get_all_vb_seqnos;
1886
+
1887
+ /**
1888
+ * Definition of the payload in the PROTOCOL_BINARY_CMD_GET_ALL_VB_SEQNOS
1889
+ * response.
1890
+ *
1891
+ * The body contains a "list" of "vbucket id - seqno pairs" for all
1892
+ * active and replica buckets on the node in network byte order.
1893
+ *
1894
+ *
1895
+ * Byte/ 0 | 1 | 2 | 3 |
1896
+ * / | | | |
1897
+ * |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|
1898
+ * +---------------+---------------+---------------+---------------+
1899
+ * 0| VBID | VBID | SEQNO | SEQNO |
1900
+ * +---------------+---------------+---------------+---------------+
1901
+ * 4| SEQNO | SEQNO | SEQNO | SEQNO |
1902
+ * +---------------+---------------+---------------+---------------+
1903
+ * 4| SEQNO | SEQNO |
1904
+ * +---------------+---------------+
1905
+ */
1906
+ typedef protocol_binary_response_no_extras protocol_binary_response_get_all_vb_seqnos;
1907
+
1908
+
1909
+
808
1910
  /**
809
1911
  * @}
810
1912
  */