libcouchbase 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (561) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +1 -0
  5. data/.travis.yml +35 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +24 -0
  8. data/README.md +389 -0
  9. data/Rakefile +75 -0
  10. data/ext/README.md +6 -0
  11. data/ext/Rakefile +20 -0
  12. data/ext/libcouchbase/.gitignore +130 -0
  13. data/ext/libcouchbase/.travis.yml +19 -0
  14. data/ext/libcouchbase/CMakeLists.txt +429 -0
  15. data/ext/libcouchbase/CONTRIBUTING.md +124 -0
  16. data/ext/libcouchbase/LICENSE +202 -0
  17. data/ext/libcouchbase/README.markdown +163 -0
  18. data/ext/libcouchbase/RELEASE_NOTES.markdown +2691 -0
  19. data/ext/libcouchbase/cmake/Modules/ConfigureDtrace.cmake +27 -0
  20. data/ext/libcouchbase/cmake/Modules/CopyPDB.cmake +42 -0
  21. data/ext/libcouchbase/cmake/Modules/DistScript.cmake +17 -0
  22. data/ext/libcouchbase/cmake/Modules/DownloadLcbDep.cmake +20 -0
  23. data/ext/libcouchbase/cmake/Modules/FindCouchbaseHdrHistogram.cmake +15 -0
  24. data/ext/libcouchbase/cmake/Modules/FindCouchbaseLibev.cmake +73 -0
  25. data/ext/libcouchbase/cmake/Modules/FindCouchbaseLibevent.cmake +52 -0
  26. data/ext/libcouchbase/cmake/Modules/FindCouchbaseLibuv.cmake +56 -0
  27. data/ext/libcouchbase/cmake/Modules/FindCouchbaseSnappy.cmake +11 -0
  28. data/ext/libcouchbase/cmake/Modules/GenerateConfigDotH.cmake +29 -0
  29. data/ext/libcouchbase/cmake/Modules/GetLibcouchbaseFlags.cmake +133 -0
  30. data/ext/libcouchbase/cmake/Modules/GetPlatformCCInfo.cmake +45 -0
  31. data/ext/libcouchbase/cmake/Modules/GetVersionInfo.cmake +70 -0
  32. data/ext/libcouchbase/cmake/config-cmake.h.in +60 -0
  33. data/ext/libcouchbase/cmake/configure +357 -0
  34. data/ext/libcouchbase/cmake/defs.mk.in +8 -0
  35. data/ext/libcouchbase/cmake/dtrace-instr-link.pl +38 -0
  36. data/ext/libcouchbase/cmake/source_files.cmake +73 -0
  37. data/ext/libcouchbase/configure.pl +1 -0
  38. data/ext/libcouchbase/contrib/cJSON/cJSON.c +624 -0
  39. data/ext/libcouchbase/contrib/cJSON/cJSON.h +158 -0
  40. data/ext/libcouchbase/contrib/cbsasl/CMakeLists.txt +9 -0
  41. data/ext/libcouchbase/contrib/cbsasl/COPYING +202 -0
  42. data/ext/libcouchbase/contrib/cbsasl/include/cbsasl/cbsasl.h +217 -0
  43. data/ext/libcouchbase/contrib/cbsasl/src/client.c +205 -0
  44. data/ext/libcouchbase/contrib/cbsasl/src/common.c +46 -0
  45. data/ext/libcouchbase/contrib/cbsasl/src/cram-md5/hmac.c +67 -0
  46. data/ext/libcouchbase/contrib/cbsasl/src/cram-md5/hmac.h +33 -0
  47. data/ext/libcouchbase/contrib/cbsasl/src/cram-md5/md5.c +296 -0
  48. data/ext/libcouchbase/contrib/cbsasl/src/cram-md5/md5.h +45 -0
  49. data/ext/libcouchbase/contrib/cbsasl/src/hash.c +573 -0
  50. data/ext/libcouchbase/contrib/cbsasl/src/hash.h +15 -0
  51. data/ext/libcouchbase/contrib/cbsasl/src/util.h +31 -0
  52. data/ext/libcouchbase/contrib/cliopts/CMakeLists.txt +2 -0
  53. data/ext/libcouchbase/contrib/cliopts/cliopts.c +747 -0
  54. data/ext/libcouchbase/contrib/cliopts/cliopts.h +493 -0
  55. data/ext/libcouchbase/contrib/genhash/genhash.c +372 -0
  56. data/ext/libcouchbase/contrib/genhash/genhash.h +235 -0
  57. data/ext/libcouchbase/contrib/gtest-1.7.0/CHANGES +157 -0
  58. data/ext/libcouchbase/contrib/gtest-1.7.0/CMakeLists.txt +252 -0
  59. data/ext/libcouchbase/contrib/gtest-1.7.0/CONTRIBUTORS +37 -0
  60. data/ext/libcouchbase/contrib/gtest-1.7.0/LICENSE +28 -0
  61. data/ext/libcouchbase/contrib/gtest-1.7.0/MINIFY.sh +15 -0
  62. data/ext/libcouchbase/contrib/gtest-1.7.0/README +435 -0
  63. data/ext/libcouchbase/contrib/gtest-1.7.0/cmake/internal_utils.cmake +227 -0
  64. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-death-test.h +294 -0
  65. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-message.h +250 -0
  66. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-param-test.h +1421 -0
  67. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-param-test.h.pump +487 -0
  68. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-printers.h +855 -0
  69. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-spi.h +232 -0
  70. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-test-part.h +179 -0
  71. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-typed-test.h +259 -0
  72. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest.h +2291 -0
  73. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest_pred_impl.h +358 -0
  74. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest_prod.h +58 -0
  75. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-death-test-internal.h +319 -0
  76. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-filepath.h +206 -0
  77. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-internal.h +1158 -0
  78. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-linked_ptr.h +233 -0
  79. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-param-util-generated.h +5143 -0
  80. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-param-util-generated.h.pump +301 -0
  81. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-param-util.h +619 -0
  82. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-port.h +1947 -0
  83. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-string.h +167 -0
  84. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-tuple.h +1012 -0
  85. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-tuple.h.pump +339 -0
  86. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-type-util.h +3331 -0
  87. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-type-util.h.pump +297 -0
  88. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-all.cc +48 -0
  89. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-death-test.cc +1344 -0
  90. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-filepath.cc +382 -0
  91. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-internal-inl.h +1218 -0
  92. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-port.cc +805 -0
  93. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-printers.cc +363 -0
  94. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-test-part.cc +110 -0
  95. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-typed-test.cc +110 -0
  96. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest.cc +5015 -0
  97. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest_main.cc +38 -0
  98. data/ext/libcouchbase/contrib/http_parser/LICENSE-MIT +23 -0
  99. data/ext/libcouchbase/contrib/http_parser/README.md +178 -0
  100. data/ext/libcouchbase/contrib/http_parser/http_parser.c +2060 -0
  101. data/ext/libcouchbase/contrib/http_parser/http_parser.h +321 -0
  102. data/ext/libcouchbase/contrib/jsonsl/LICENSE +20 -0
  103. data/ext/libcouchbase/contrib/jsonsl/jsonsl.c +1452 -0
  104. data/ext/libcouchbase/contrib/jsonsl/jsonsl.h +971 -0
  105. data/ext/libcouchbase/contrib/lcb-jsoncpp/CMakeLists.txt +6 -0
  106. data/ext/libcouchbase/contrib/lcb-jsoncpp/LICENSE +55 -0
  107. data/ext/libcouchbase/contrib/lcb-jsoncpp/lcb-jsoncpp-forwards.h +255 -0
  108. data/ext/libcouchbase/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +4892 -0
  109. data/ext/libcouchbase/contrib/lcb-jsoncpp/lcb-jsoncpp.h +1961 -0
  110. data/ext/libcouchbase/contrib/snappy/CMakeLists.txt +8 -0
  111. data/ext/libcouchbase/contrib/snappy/COPYING +28 -0
  112. data/ext/libcouchbase/contrib/snappy/snappy-c.cc +90 -0
  113. data/ext/libcouchbase/contrib/snappy/snappy-c.h +138 -0
  114. data/ext/libcouchbase/contrib/snappy/snappy-internal.h +150 -0
  115. data/ext/libcouchbase/contrib/snappy/snappy-lcb-msvc.h +5 -0
  116. data/ext/libcouchbase/contrib/snappy/snappy-sinksource.cc +71 -0
  117. data/ext/libcouchbase/contrib/snappy/snappy-sinksource.h +137 -0
  118. data/ext/libcouchbase/contrib/snappy/snappy-stubs-internal.cc +42 -0
  119. data/ext/libcouchbase/contrib/snappy/snappy-stubs-internal.h +491 -0
  120. data/ext/libcouchbase/contrib/snappy/snappy-stubs-public.h +98 -0
  121. data/ext/libcouchbase/contrib/snappy/snappy.cc +1307 -0
  122. data/ext/libcouchbase/contrib/snappy/snappy.h +184 -0
  123. data/ext/libcouchbase/contrib/win32-defs/iocpdefs.h +133 -0
  124. data/ext/libcouchbase/contrib/win32-defs/mingwdefs.h +4396 -0
  125. data/ext/libcouchbase/contrib/win32-defs/win_stdint.h +258 -0
  126. data/ext/libcouchbase/example/CMakeLists.txt +37 -0
  127. data/ext/libcouchbase/example/README.markdown +47 -0
  128. data/ext/libcouchbase/example/db/db.c +167 -0
  129. data/ext/libcouchbase/example/db/vb.c +227 -0
  130. data/ext/libcouchbase/example/instancepool/main.cc +102 -0
  131. data/ext/libcouchbase/example/instancepool/pool.cc +102 -0
  132. data/ext/libcouchbase/example/instancepool/pool.h +69 -0
  133. data/ext/libcouchbase/example/libeventdirect/main.c +148 -0
  134. data/ext/libcouchbase/example/mcc/mcc.cc +246 -0
  135. data/ext/libcouchbase/example/minimal/minimal.c +130 -0
  136. data/ext/libcouchbase/example/observe/observe.c +146 -0
  137. data/ext/libcouchbase/example/subdoc/subdoc-multi.cc +132 -0
  138. data/ext/libcouchbase/example/subdoc/subdoc-simple.cc +191 -0
  139. data/ext/libcouchbase/example/tick/tick.c +119 -0
  140. data/ext/libcouchbase/example/views/views-example.cc +83 -0
  141. data/ext/libcouchbase/include/libcouchbase/_cxxwrap.h +150 -0
  142. data/ext/libcouchbase/include/libcouchbase/api-legacy.h +1689 -0
  143. data/ext/libcouchbase/include/libcouchbase/api3.h +2 -0
  144. data/ext/libcouchbase/include/libcouchbase/assert.h +44 -0
  145. data/ext/libcouchbase/include/libcouchbase/cbft.h +109 -0
  146. data/ext/libcouchbase/include/libcouchbase/cntl-private.h +356 -0
  147. data/ext/libcouchbase/include/libcouchbase/cntl.h +937 -0
  148. data/ext/libcouchbase/include/libcouchbase/configuration.h.in +23 -0
  149. data/ext/libcouchbase/include/libcouchbase/couchbase.h +3677 -0
  150. data/ext/libcouchbase/include/libcouchbase/deprecated.h +300 -0
  151. data/ext/libcouchbase/include/libcouchbase/error.h +595 -0
  152. data/ext/libcouchbase/include/libcouchbase/http.h +1 -0
  153. data/ext/libcouchbase/include/libcouchbase/iops.h +1050 -0
  154. data/ext/libcouchbase/include/libcouchbase/ixmgmt.h +263 -0
  155. data/ext/libcouchbase/include/libcouchbase/kvbuf.h +132 -0
  156. data/ext/libcouchbase/include/libcouchbase/n1ql.h +364 -0
  157. data/ext/libcouchbase/include/libcouchbase/pktfwd.h +270 -0
  158. data/ext/libcouchbase/include/libcouchbase/plugins/io/bsdio-inl.c +367 -0
  159. data/ext/libcouchbase/include/libcouchbase/plugins/io/wsaerr-inl.c +76 -0
  160. data/ext/libcouchbase/include/libcouchbase/plugins/io/wsaerr.h +199 -0
  161. data/ext/libcouchbase/include/libcouchbase/subdoc.h +312 -0
  162. data/ext/libcouchbase/include/libcouchbase/sysdefs.h +98 -0
  163. data/ext/libcouchbase/include/libcouchbase/vbucket.h +643 -0
  164. data/ext/libcouchbase/include/libcouchbase/views.h +298 -0
  165. data/ext/libcouchbase/include/libcouchbase/visibility.h +65 -0
  166. data/ext/libcouchbase/include/memcached/COPYING +30 -0
  167. data/ext/libcouchbase/include/memcached/README +10 -0
  168. data/ext/libcouchbase/include/memcached/protocol_binary.h +1916 -0
  169. data/ext/libcouchbase/include/memcached/vbucket.h +42 -0
  170. data/ext/libcouchbase/packaging/README +7 -0
  171. data/ext/libcouchbase/packaging/abicheck/.gitignore +4 -0
  172. data/ext/libcouchbase/packaging/abicheck/Makefile +17 -0
  173. data/ext/libcouchbase/packaging/abicheck/README.md +27 -0
  174. data/ext/libcouchbase/packaging/abicheck/template.xml +3 -0
  175. data/ext/libcouchbase/packaging/deb/compat +1 -0
  176. data/ext/libcouchbase/packaging/deb/control +73 -0
  177. data/ext/libcouchbase/packaging/deb/copyright +10 -0
  178. data/ext/libcouchbase/packaging/deb/libcouchbase-dev.docs +3 -0
  179. data/ext/libcouchbase/packaging/deb/package.mk +31 -0
  180. data/ext/libcouchbase/packaging/deb/rules +46 -0
  181. data/ext/libcouchbase/packaging/deb/source/format +1 -0
  182. data/ext/libcouchbase/packaging/distinfo/README +1 -0
  183. data/ext/libcouchbase/packaging/distinfo/distinfo.cmake.in +4 -0
  184. data/ext/libcouchbase/packaging/dllversion.rc.in +39 -0
  185. data/ext/libcouchbase/packaging/libcouchbase.pc.in +10 -0
  186. data/ext/libcouchbase/packaging/nuget/libcouchbase.autopkg +76 -0
  187. data/ext/libcouchbase/packaging/parse-git-describe.pl +166 -0
  188. data/ext/libcouchbase/packaging/rpm/libcouchbase.spec.in +108 -0
  189. data/ext/libcouchbase/packaging/rpm/package.mk +40 -0
  190. data/ext/libcouchbase/plugins/io/iocp/CMakeLists.txt +9 -0
  191. data/ext/libcouchbase/plugins/io/iocp/iocp_iops.c +466 -0
  192. data/ext/libcouchbase/plugins/io/iocp/iocp_iops.h +217 -0
  193. data/ext/libcouchbase/plugins/io/iocp/iocp_loop.c +295 -0
  194. data/ext/libcouchbase/plugins/io/iocp/iocp_timer.c +79 -0
  195. data/ext/libcouchbase/plugins/io/iocp/iocp_util.c +229 -0
  196. data/ext/libcouchbase/plugins/io/libev/CMakeLists.txt +29 -0
  197. data/ext/libcouchbase/plugins/io/libev/libev_io_opts.h +65 -0
  198. data/ext/libcouchbase/plugins/io/libev/plugin-libev.c +289 -0
  199. data/ext/libcouchbase/plugins/io/libevent/CMakeLists.txt +29 -0
  200. data/ext/libcouchbase/plugins/io/libevent/libevent_io_opts.h +67 -0
  201. data/ext/libcouchbase/plugins/io/libevent/plugin-libevent.c +292 -0
  202. data/ext/libcouchbase/plugins/io/libuv/CMakeLists.txt +42 -0
  203. data/ext/libcouchbase/plugins/io/libuv/libuv_compat.h +212 -0
  204. data/ext/libcouchbase/plugins/io/libuv/libuv_io_opts.h +118 -0
  205. data/ext/libcouchbase/plugins/io/libuv/plugin-internal.h +148 -0
  206. data/ext/libcouchbase/plugins/io/libuv/plugin-libuv.c +648 -0
  207. data/ext/libcouchbase/plugins/io/select/CMakeLists.txt +11 -0
  208. data/ext/libcouchbase/plugins/io/select/plugin-select.c +448 -0
  209. data/ext/libcouchbase/plugins/io/select/select_io_opts.h +39 -0
  210. data/ext/libcouchbase/src/README.md +103 -0
  211. data/ext/libcouchbase/src/aspend.h +106 -0
  212. data/ext/libcouchbase/src/auth.cc +74 -0
  213. data/ext/libcouchbase/src/auth.h +54 -0
  214. data/ext/libcouchbase/src/bootstrap.c +269 -0
  215. data/ext/libcouchbase/src/bootstrap.h +129 -0
  216. data/ext/libcouchbase/src/bucketconfig/bc_cccp.c +495 -0
  217. data/ext/libcouchbase/src/bucketconfig/bc_file.c +347 -0
  218. data/ext/libcouchbase/src/bucketconfig/bc_http.c +630 -0
  219. data/ext/libcouchbase/src/bucketconfig/bc_http.h +82 -0
  220. data/ext/libcouchbase/src/bucketconfig/bc_mcraw.c +150 -0
  221. data/ext/libcouchbase/src/bucketconfig/clconfig.h +681 -0
  222. data/ext/libcouchbase/src/bucketconfig/confmon.c +474 -0
  223. data/ext/libcouchbase/src/callbacks.c +378 -0
  224. data/ext/libcouchbase/src/cbft.cc +210 -0
  225. data/ext/libcouchbase/src/cntl.cc +847 -0
  226. data/ext/libcouchbase/src/config_static.h +159 -0
  227. data/ext/libcouchbase/src/connspec.cc +462 -0
  228. data/ext/libcouchbase/src/connspec.h +105 -0
  229. data/ext/libcouchbase/src/ctx-log-inl.h +27 -0
  230. data/ext/libcouchbase/src/dump.c +98 -0
  231. data/ext/libcouchbase/src/getconfig.c +100 -0
  232. data/ext/libcouchbase/src/gethrtime.c +109 -0
  233. data/ext/libcouchbase/src/handler.c +922 -0
  234. data/ext/libcouchbase/src/hashset.c +164 -0
  235. data/ext/libcouchbase/src/hashset.h +86 -0
  236. data/ext/libcouchbase/src/hashtable.c +75 -0
  237. data/ext/libcouchbase/src/hdr_timings.c +92 -0
  238. data/ext/libcouchbase/src/hostlist.cc +301 -0
  239. data/ext/libcouchbase/src/hostlist.h +171 -0
  240. data/ext/libcouchbase/src/http/http-priv.h +307 -0
  241. data/ext/libcouchbase/src/http/http.cc +633 -0
  242. data/ext/libcouchbase/src/http/http.h +34 -0
  243. data/ext/libcouchbase/src/http/http_io.cc +307 -0
  244. data/ext/libcouchbase/src/instance.cc +722 -0
  245. data/ext/libcouchbase/src/internal.h +244 -0
  246. data/ext/libcouchbase/src/iofactory.c +575 -0
  247. data/ext/libcouchbase/src/jsparse/parser.cc +519 -0
  248. data/ext/libcouchbase/src/jsparse/parser.h +173 -0
  249. data/ext/libcouchbase/src/lcbht/lcbht.c +282 -0
  250. data/ext/libcouchbase/src/lcbht/lcbht.h +199 -0
  251. data/ext/libcouchbase/src/lcbio/connect.c +557 -0
  252. data/ext/libcouchbase/src/lcbio/connect.h +364 -0
  253. data/ext/libcouchbase/src/lcbio/ctx.c +611 -0
  254. data/ext/libcouchbase/src/lcbio/ctx.h +405 -0
  255. data/ext/libcouchbase/src/lcbio/iotable.c +290 -0
  256. data/ext/libcouchbase/src/lcbio/iotable.h +84 -0
  257. data/ext/libcouchbase/src/lcbio/ioutils.c +350 -0
  258. data/ext/libcouchbase/src/lcbio/ioutils.h +203 -0
  259. data/ext/libcouchbase/src/lcbio/lcbio.h +51 -0
  260. data/ext/libcouchbase/src/lcbio/manager.c +584 -0
  261. data/ext/libcouchbase/src/lcbio/manager.h +156 -0
  262. data/ext/libcouchbase/src/lcbio/protoctx.c +84 -0
  263. data/ext/libcouchbase/src/lcbio/rw-inl.h +115 -0
  264. data/ext/libcouchbase/src/lcbio/ssl.h +149 -0
  265. data/ext/libcouchbase/src/lcbio/timer-ng.h +179 -0
  266. data/ext/libcouchbase/src/lcbio/timer.c +132 -0
  267. data/ext/libcouchbase/src/legacy.c +430 -0
  268. data/ext/libcouchbase/src/list.c +144 -0
  269. data/ext/libcouchbase/src/list.h +127 -0
  270. data/ext/libcouchbase/src/logging.c +244 -0
  271. data/ext/libcouchbase/src/logging.h +86 -0
  272. data/ext/libcouchbase/src/mc/compress.c +90 -0
  273. data/ext/libcouchbase/src/mc/compress.h +61 -0
  274. data/ext/libcouchbase/src/mc/forward.c +186 -0
  275. data/ext/libcouchbase/src/mc/forward.h +90 -0
  276. data/ext/libcouchbase/src/mc/iovcursor-inl.h +279 -0
  277. data/ext/libcouchbase/src/mc/iovcursor.h +66 -0
  278. data/ext/libcouchbase/src/mc/mcreq-flush-inl.h +111 -0
  279. data/ext/libcouchbase/src/mc/mcreq.c +954 -0
  280. data/ext/libcouchbase/src/mc/mcreq.h +977 -0
  281. data/ext/libcouchbase/src/mcserver/mcserver.c +784 -0
  282. data/ext/libcouchbase/src/mcserver/mcserver.h +121 -0
  283. data/ext/libcouchbase/src/mcserver/negotiate.c +656 -0
  284. data/ext/libcouchbase/src/mcserver/negotiate.h +119 -0
  285. data/ext/libcouchbase/src/n1ql/ixmgmt.cc +860 -0
  286. data/ext/libcouchbase/src/n1ql/n1ql-internal.h +22 -0
  287. data/ext/libcouchbase/src/n1ql/n1ql.cc +729 -0
  288. data/ext/libcouchbase/src/n1ql/params.cc +215 -0
  289. data/ext/libcouchbase/src/netbuf/netbuf-defs.h +89 -0
  290. data/ext/libcouchbase/src/netbuf/netbuf-mblock.h +235 -0
  291. data/ext/libcouchbase/src/netbuf/netbuf.c +929 -0
  292. data/ext/libcouchbase/src/netbuf/netbuf.h +452 -0
  293. data/ext/libcouchbase/src/newconfig.c +385 -0
  294. data/ext/libcouchbase/src/nodeinfo.cc +194 -0
  295. data/ext/libcouchbase/src/operations/cbflush.c +71 -0
  296. data/ext/libcouchbase/src/operations/counter.c +116 -0
  297. data/ext/libcouchbase/src/operations/durability-cas.c +224 -0
  298. data/ext/libcouchbase/src/operations/durability-seqno.c +157 -0
  299. data/ext/libcouchbase/src/operations/durability.c +668 -0
  300. data/ext/libcouchbase/src/operations/durability_internal.h +199 -0
  301. data/ext/libcouchbase/src/operations/get.c +409 -0
  302. data/ext/libcouchbase/src/operations/observe-seqno.c +96 -0
  303. data/ext/libcouchbase/src/operations/observe.c +340 -0
  304. data/ext/libcouchbase/src/operations/pktfwd.c +86 -0
  305. data/ext/libcouchbase/src/operations/remove.c +83 -0
  306. data/ext/libcouchbase/src/operations/stats.c +461 -0
  307. data/ext/libcouchbase/src/operations/store.c +360 -0
  308. data/ext/libcouchbase/src/operations/subdoc.cc +510 -0
  309. data/ext/libcouchbase/src/operations/touch.c +81 -0
  310. data/ext/libcouchbase/src/packetutils.c +60 -0
  311. data/ext/libcouchbase/src/packetutils.h +147 -0
  312. data/ext/libcouchbase/src/probes.d +211 -0
  313. data/ext/libcouchbase/src/rdb/bigalloc.c +225 -0
  314. data/ext/libcouchbase/src/rdb/bigalloc.h +73 -0
  315. data/ext/libcouchbase/src/rdb/chunkalloc.c +174 -0
  316. data/ext/libcouchbase/src/rdb/libcalloc.c +94 -0
  317. data/ext/libcouchbase/src/rdb/rope.c +419 -0
  318. data/ext/libcouchbase/src/rdb/rope.h +488 -0
  319. data/ext/libcouchbase/src/retrychk.c +113 -0
  320. data/ext/libcouchbase/src/retryq.c +424 -0
  321. data/ext/libcouchbase/src/retryq.h +157 -0
  322. data/ext/libcouchbase/src/ringbuffer.c +442 -0
  323. data/ext/libcouchbase/src/ringbuffer.h +100 -0
  324. data/ext/libcouchbase/src/settings.c +95 -0
  325. data/ext/libcouchbase/src/settings.h +188 -0
  326. data/ext/libcouchbase/src/simplestring.c +211 -0
  327. data/ext/libcouchbase/src/simplestring.h +228 -0
  328. data/ext/libcouchbase/src/sllist-inl.h +197 -0
  329. data/ext/libcouchbase/src/sllist.h +76 -0
  330. data/ext/libcouchbase/src/ssl/CMakeLists.txt +23 -0
  331. data/ext/libcouchbase/src/ssl/ssl_c.c +415 -0
  332. data/ext/libcouchbase/src/ssl/ssl_common.c +454 -0
  333. data/ext/libcouchbase/src/ssl/ssl_e.c +408 -0
  334. data/ext/libcouchbase/src/ssl/ssl_iot_common.h +180 -0
  335. data/ext/libcouchbase/src/ssobuf.h +82 -0
  336. data/ext/libcouchbase/src/strcodecs/base64.c +123 -0
  337. data/ext/libcouchbase/src/strcodecs/strcodecs.h +285 -0
  338. data/ext/libcouchbase/src/timings.c +208 -0
  339. data/ext/libcouchbase/src/trace.h +105 -0
  340. data/ext/libcouchbase/src/utilities.c +171 -0
  341. data/ext/libcouchbase/src/vbucket/CMakeLists.txt +2 -0
  342. data/ext/libcouchbase/src/vbucket/aliases.h +35 -0
  343. data/ext/libcouchbase/src/vbucket/crc32.h +83 -0
  344. data/ext/libcouchbase/src/vbucket/hash.h +30 -0
  345. data/ext/libcouchbase/src/vbucket/json-inl.h +112 -0
  346. data/ext/libcouchbase/src/vbucket/ketama.c +66 -0
  347. data/ext/libcouchbase/src/vbucket/rfc1321/global.h +32 -0
  348. data/ext/libcouchbase/src/vbucket/rfc1321/md5.h +35 -0
  349. data/ext/libcouchbase/src/vbucket/rfc1321/md5c-inl.h +335 -0
  350. data/ext/libcouchbase/src/vbucket/vbucket.c +1543 -0
  351. data/ext/libcouchbase/src/views/docreq.c +194 -0
  352. data/ext/libcouchbase/src/views/docreq.h +83 -0
  353. data/ext/libcouchbase/src/views/viewreq.c +358 -0
  354. data/ext/libcouchbase/src/views/viewreq.h +36 -0
  355. data/ext/libcouchbase/src/wait.c +161 -0
  356. data/ext/libcouchbase/tests/CMakeLists.txt +140 -0
  357. data/ext/libcouchbase/tests/basic/t_base64.cc +81 -0
  358. data/ext/libcouchbase/tests/basic/t_ccbc103.cc +95 -0
  359. data/ext/libcouchbase/tests/basic/t_connstr.cc +404 -0
  360. data/ext/libcouchbase/tests/basic/t_creds.cc +32 -0
  361. data/ext/libcouchbase/tests/basic/t_ctlcodes.cc +92 -0
  362. data/ext/libcouchbase/tests/basic/t_hashset.cc +262 -0
  363. data/ext/libcouchbase/tests/basic/t_host.cc +198 -0
  364. data/ext/libcouchbase/tests/basic/t_jsparse.cc +137 -0
  365. data/ext/libcouchbase/tests/basic/t_jsparse.h +589 -0
  366. data/ext/libcouchbase/tests/basic/t_list.cc +155 -0
  367. data/ext/libcouchbase/tests/basic/t_logger.cc +65 -0
  368. data/ext/libcouchbase/tests/basic/t_misc.cc +24 -0
  369. data/ext/libcouchbase/tests/basic/t_n1qlstrings.cc +18 -0
  370. data/ext/libcouchbase/tests/basic/t_netbuf.cc +446 -0
  371. data/ext/libcouchbase/tests/basic/t_packet.cc +222 -0
  372. data/ext/libcouchbase/tests/basic/t_ringbuffer.cc +278 -0
  373. data/ext/libcouchbase/tests/basic/t_slist.cc +429 -0
  374. data/ext/libcouchbase/tests/basic/t_strerror.cc +64 -0
  375. data/ext/libcouchbase/tests/basic/t_string.cc +112 -0
  376. data/ext/libcouchbase/tests/basic/t_urlencode.cc +132 -0
  377. data/ext/libcouchbase/tests/check-all.cc +608 -0
  378. data/ext/libcouchbase/tests/htparse/t_basic.cc +193 -0
  379. data/ext/libcouchbase/tests/ioserver/connection.cc +166 -0
  380. data/ext/libcouchbase/tests/ioserver/future.cc +50 -0
  381. data/ext/libcouchbase/tests/ioserver/ioserver.cc +104 -0
  382. data/ext/libcouchbase/tests/ioserver/ioserver.h +478 -0
  383. data/ext/libcouchbase/tests/ioserver/socket.cc +88 -0
  384. data/ext/libcouchbase/tests/ioserver/ssl_connection.cc +145 -0
  385. data/ext/libcouchbase/tests/ioserver/threads-pthreads.cc +119 -0
  386. data/ext/libcouchbase/tests/ioserver/threads-win32.cc +117 -0
  387. data/ext/libcouchbase/tests/ioserver/threads.h +66 -0
  388. data/ext/libcouchbase/tests/iotests/iotests.h +15 -0
  389. data/ext/libcouchbase/tests/iotests/mock-environment.cc +524 -0
  390. data/ext/libcouchbase/tests/iotests/mock-environment.h +385 -0
  391. data/ext/libcouchbase/tests/iotests/mock-unit-test.cc +67 -0
  392. data/ext/libcouchbase/tests/iotests/mock-unit-test.h +61 -0
  393. data/ext/libcouchbase/tests/iotests/serverparams.h +76 -0
  394. data/ext/libcouchbase/tests/iotests/t_arithmetic.cc +143 -0
  395. data/ext/libcouchbase/tests/iotests/t_behavior.cc +226 -0
  396. data/ext/libcouchbase/tests/iotests/t_configcache.cc +117 -0
  397. data/ext/libcouchbase/tests/iotests/t_confmon.cc +241 -0
  398. data/ext/libcouchbase/tests/iotests/t_durability.cc +1059 -0
  399. data/ext/libcouchbase/tests/iotests/t_forward.cc +110 -0
  400. data/ext/libcouchbase/tests/iotests/t_get.cc +512 -0
  401. data/ext/libcouchbase/tests/iotests/t_http.cc +438 -0
  402. data/ext/libcouchbase/tests/iotests/t_iops.cc +175 -0
  403. data/ext/libcouchbase/tests/iotests/t_lock.cc +275 -0
  404. data/ext/libcouchbase/tests/iotests/t_misc.cc +713 -0
  405. data/ext/libcouchbase/tests/iotests/t_mutate.cc +609 -0
  406. data/ext/libcouchbase/tests/iotests/t_n1ql.cc +270 -0
  407. data/ext/libcouchbase/tests/iotests/t_netfail.cc +654 -0
  408. data/ext/libcouchbase/tests/iotests/t_obseqno.cc +157 -0
  409. data/ext/libcouchbase/tests/iotests/t_regression.cc +321 -0
  410. data/ext/libcouchbase/tests/iotests/t_sched.cc +88 -0
  411. data/ext/libcouchbase/tests/iotests/t_serverops.cc +230 -0
  412. data/ext/libcouchbase/tests/iotests/t_smoke.cc +528 -0
  413. data/ext/libcouchbase/tests/iotests/t_subdoc.cc +822 -0
  414. data/ext/libcouchbase/tests/iotests/t_syncmode.cc +64 -0
  415. data/ext/libcouchbase/tests/iotests/t_views.cc +405 -0
  416. data/ext/libcouchbase/tests/iotests/testutil.cc +250 -0
  417. data/ext/libcouchbase/tests/iotests/testutil.h +163 -0
  418. data/ext/libcouchbase/tests/mc/mctest.h +119 -0
  419. data/ext/libcouchbase/tests/mc/pktmaker.h +101 -0
  420. data/ext/libcouchbase/tests/mc/t_alloc.cc +269 -0
  421. data/ext/libcouchbase/tests/mc/t_context.cc +100 -0
  422. data/ext/libcouchbase/tests/mc/t_flush.cc +185 -0
  423. data/ext/libcouchbase/tests/mc/t_forward.cc +239 -0
  424. data/ext/libcouchbase/tests/mc/t_ioflush.cc +102 -0
  425. data/ext/libcouchbase/tests/mc/t_iovcursor.cc +173 -0
  426. data/ext/libcouchbase/tests/mocksupport/procutil.c +305 -0
  427. data/ext/libcouchbase/tests/mocksupport/procutil.h +89 -0
  428. data/ext/libcouchbase/tests/mocksupport/server.c +391 -0
  429. data/ext/libcouchbase/tests/mocksupport/server.h +72 -0
  430. data/ext/libcouchbase/tests/mocksupport/timeout.c +69 -0
  431. data/ext/libcouchbase/tests/nonio_tests.cc +23 -0
  432. data/ext/libcouchbase/tests/rdb/rdbtest.h +133 -0
  433. data/ext/libcouchbase/tests/rdb/t_basic.cc +128 -0
  434. data/ext/libcouchbase/tests/rdb/t_bigalloc.cc +93 -0
  435. data/ext/libcouchbase/tests/rdb/t_refs.cc +112 -0
  436. data/ext/libcouchbase/tests/socktests/socktest.cc +347 -0
  437. data/ext/libcouchbase/tests/socktests/socktest.h +448 -0
  438. data/ext/libcouchbase/tests/socktests/t_basic.cc +143 -0
  439. data/ext/libcouchbase/tests/socktests/t_ctx.cc +73 -0
  440. data/ext/libcouchbase/tests/socktests/t_manager.cc +179 -0
  441. data/ext/libcouchbase/tests/socktests/t_putex.cc +256 -0
  442. data/ext/libcouchbase/tests/socktests/t_read.cc +187 -0
  443. data/ext/libcouchbase/tests/socktests/t_reentrant.cc +143 -0
  444. data/ext/libcouchbase/tests/socktests/t_ssl.cc +80 -0
  445. data/ext/libcouchbase/tests/socktests/t_write.cc +95 -0
  446. data/ext/libcouchbase/tests/start_mock.bat +15 -0
  447. data/ext/libcouchbase/tests/start_mock.sh +42 -0
  448. data/ext/libcouchbase/tests/unit_tests.cc +43 -0
  449. data/ext/libcouchbase/tests/vbucket/confdata/bad.json +101 -0
  450. data/ext/libcouchbase/tests/vbucket/confdata/full_25.json +363 -0
  451. data/ext/libcouchbase/tests/vbucket/confdata/memd_25.json +90 -0
  452. data/ext/libcouchbase/tests/vbucket/confdata/memd_30.json +1 -0
  453. data/ext/libcouchbase/tests/vbucket/confdata/memd_45.json +1 -0
  454. data/ext/libcouchbase/tests/vbucket/confdata/terse_25.json +291 -0
  455. data/ext/libcouchbase/tests/vbucket/confdata/terse_30.json +1 -0
  456. data/ext/libcouchbase/tests/vbucket/t_config.cc +341 -0
  457. data/ext/libcouchbase/tools/CMakeLists.txt +51 -0
  458. data/ext/libcouchbase/tools/cbc-handlers.h +462 -0
  459. data/ext/libcouchbase/tools/cbc-n1qlback.cc +439 -0
  460. data/ext/libcouchbase/tools/cbc-pillowfight.cc +822 -0
  461. data/ext/libcouchbase/tools/cbc.cc +1541 -0
  462. data/ext/libcouchbase/tools/common/histogram.cc +43 -0
  463. data/ext/libcouchbase/tools/common/histogram.h +23 -0
  464. data/ext/libcouchbase/tools/common/my_inttypes.h +22 -0
  465. data/ext/libcouchbase/tools/common/options.cc +420 -0
  466. data/ext/libcouchbase/tools/common/options.h +81 -0
  467. data/ext/libcouchbase/tools/docgen/docgen.h +469 -0
  468. data/ext/libcouchbase/tools/docgen/loc.h +210 -0
  469. data/ext/libcouchbase/tools/docgen/placeholders.h +211 -0
  470. data/ext/libcouchbase/tools/docgen/seqgen.h +94 -0
  471. data/lib/libcouchbase.rb +36 -0
  472. data/lib/libcouchbase/bucket.rb +819 -0
  473. data/lib/libcouchbase/callbacks.rb +72 -0
  474. data/lib/libcouchbase/connection.rb +790 -0
  475. data/lib/libcouchbase/design_docs.rb +86 -0
  476. data/lib/libcouchbase/error.rb +68 -0
  477. data/lib/libcouchbase/ext/libcouchbase.rb +1135 -0
  478. data/lib/libcouchbase/ext/libcouchbase/cmdbase.rb +23 -0
  479. data/lib/libcouchbase/ext/libcouchbase/cmdcounter.rb +36 -0
  480. data/lib/libcouchbase/ext/libcouchbase/cmdendure.rb +26 -0
  481. data/lib/libcouchbase/ext/libcouchbase/cmdfts.rb +24 -0
  482. data/lib/libcouchbase/ext/libcouchbase/cmdget.rb +30 -0
  483. data/lib/libcouchbase/ext/libcouchbase/cmdgetreplica.rb +49 -0
  484. data/lib/libcouchbase/ext/libcouchbase/cmdhttp.rb +58 -0
  485. data/lib/libcouchbase/ext/libcouchbase/cmdn1ql.rb +40 -0
  486. data/lib/libcouchbase/ext/libcouchbase/cmdobseqno.rb +33 -0
  487. data/lib/libcouchbase/ext/libcouchbase/cmdobserve.rb +30 -0
  488. data/lib/libcouchbase/ext/libcouchbase/cmdstore.rb +40 -0
  489. data/lib/libcouchbase/ext/libcouchbase/cmdstoredur.rb +45 -0
  490. data/lib/libcouchbase/ext/libcouchbase/cmdsubdoc.rb +49 -0
  491. data/lib/libcouchbase/ext/libcouchbase/cmdverbosity.rb +29 -0
  492. data/lib/libcouchbase/ext/libcouchbase/cmdviewquery.rb +61 -0
  493. data/lib/libcouchbase/ext/libcouchbase/contigbuf.rb +14 -0
  494. data/lib/libcouchbase/ext/libcouchbase/create_st.rb +15 -0
  495. data/lib/libcouchbase/ext/libcouchbase/create_st0.rb +23 -0
  496. data/lib/libcouchbase/ext/libcouchbase/create_st1.rb +26 -0
  497. data/lib/libcouchbase/ext/libcouchbase/create_st2.rb +32 -0
  498. data/lib/libcouchbase/ext/libcouchbase/create_st3.rb +26 -0
  499. data/lib/libcouchbase/ext/libcouchbase/crst_u.rb +20 -0
  500. data/lib/libcouchbase/ext/libcouchbase/durability_opts_st_v.rb +11 -0
  501. data/lib/libcouchbase/ext/libcouchbase/durability_opts_t.rb +14 -0
  502. data/lib/libcouchbase/ext/libcouchbase/durabilityopt_sv0.rb +63 -0
  503. data/lib/libcouchbase/ext/libcouchbase/enums.rb +991 -0
  504. data/lib/libcouchbase/ext/libcouchbase/fragbuf.rb +18 -0
  505. data/lib/libcouchbase/ext/libcouchbase/ftshandle.rb +7 -0
  506. data/lib/libcouchbase/ext/libcouchbase/histogram.rb +34 -0
  507. data/lib/libcouchbase/ext/libcouchbase/http_request_t.rb +7 -0
  508. data/lib/libcouchbase/ext/libcouchbase/keybuf.rb +20 -0
  509. data/lib/libcouchbase/ext/libcouchbase/multicmd_ctx.rb +30 -0
  510. data/lib/libcouchbase/ext/libcouchbase/mutation_token.rb +17 -0
  511. data/lib/libcouchbase/ext/libcouchbase/n1qlhandle.rb +7 -0
  512. data/lib/libcouchbase/ext/libcouchbase/n1qlparams.rb +7 -0
  513. data/lib/libcouchbase/ext/libcouchbase/respbase.rb +29 -0
  514. data/lib/libcouchbase/ext/libcouchbase/respcounter.rb +32 -0
  515. data/lib/libcouchbase/ext/libcouchbase/respendure.rb +49 -0
  516. data/lib/libcouchbase/ext/libcouchbase/respfts.rb +40 -0
  517. data/lib/libcouchbase/ext/libcouchbase/respget.rb +44 -0
  518. data/lib/libcouchbase/ext/libcouchbase/resphttp.rb +48 -0
  519. data/lib/libcouchbase/ext/libcouchbase/respmcversion.rb +38 -0
  520. data/lib/libcouchbase/ext/libcouchbase/respn1ql.rb +41 -0
  521. data/lib/libcouchbase/ext/libcouchbase/respobseqno.rb +52 -0
  522. data/lib/libcouchbase/ext/libcouchbase/respobserve.rb +41 -0
  523. data/lib/libcouchbase/ext/libcouchbase/respserverbase.rb +32 -0
  524. data/lib/libcouchbase/ext/libcouchbase/respstats.rb +38 -0
  525. data/lib/libcouchbase/ext/libcouchbase/respstore.rb +32 -0
  526. data/lib/libcouchbase/ext/libcouchbase/respstoredur.rb +38 -0
  527. data/lib/libcouchbase/ext/libcouchbase/respsubdoc.rb +35 -0
  528. data/lib/libcouchbase/ext/libcouchbase/respviewquery.rb +67 -0
  529. data/lib/libcouchbase/ext/libcouchbase/sdentry.rb +22 -0
  530. data/lib/libcouchbase/ext/libcouchbase/sdspec.rb +26 -0
  531. data/lib/libcouchbase/ext/libcouchbase/t.rb +7 -0
  532. data/lib/libcouchbase/ext/libcouchbase/valbuf.rb +22 -0
  533. data/lib/libcouchbase/ext/libcouchbase/valbuf_u_buf.rb +14 -0
  534. data/lib/libcouchbase/ext/libcouchbase/viewhandle.rb +7 -0
  535. data/lib/libcouchbase/ext/libcouchbase_iocp.rb +26 -0
  536. data/lib/libcouchbase/ext/libcouchbase_libuv.rb +18 -0
  537. data/lib/libcouchbase/ext/tasks.rb +87 -0
  538. data/lib/libcouchbase/n1ql.rb +73 -0
  539. data/lib/libcouchbase/query_full_text.rb +147 -0
  540. data/lib/libcouchbase/query_n1ql.rb +121 -0
  541. data/lib/libcouchbase/query_view.rb +129 -0
  542. data/lib/libcouchbase/results_fiber.rb +262 -0
  543. data/lib/libcouchbase/results_native.rb +211 -0
  544. data/lib/libcouchbase/version.rb +5 -0
  545. data/libcouchbase.gemspec +61 -0
  546. data/spec/bucket_spec.rb +270 -0
  547. data/spec/connection_spec.rb +277 -0
  548. data/spec/design_docs_spec.rb +23 -0
  549. data/spec/error_spec.rb +26 -0
  550. data/spec/fts_spec.rb +129 -0
  551. data/spec/n1ql_spec.rb +201 -0
  552. data/spec/results_libuv_spec.rb +229 -0
  553. data/spec/results_native_spec.rb +259 -0
  554. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/design.json +1 -0
  555. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/data-0000.cbb +0 -0
  556. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/failover.json +1 -0
  557. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/meta.json +1 -0
  558. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/seqno.json +1 -0
  559. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/snapshot_markers.json +1 -0
  560. data/spec/view_spec.rb +195 -0
  561. metadata +775 -0
@@ -0,0 +1,298 @@
1
+ /*
2
+ * Copyright 2015 Couchbase, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ **/
16
+
17
+ #ifndef LCB_VIEWS_API_H
18
+ #define LCB_VIEWS_API_H
19
+ #include <libcouchbase/couchbase.h>
20
+ #include <libcouchbase/api3.h>
21
+
22
+ #ifdef __cplusplus
23
+ extern "C" {
24
+ #endif
25
+
26
+ /**
27
+ * @ingroup lcb-public-api
28
+ * @defgroup lcb-view-api Views (Map-Reduce)
29
+ * @brief Higher level API which splits view results into rows
30
+ */
31
+
32
+ /**
33
+ * @addtogroup lcb-view-api
34
+ * @{
35
+ */
36
+ typedef struct lcb_RESPVIEW_st lcb_RESPVIEWQUERY;
37
+ typedef struct lcbview_REQUEST_st *lcb_VIEWHANDLE;
38
+
39
+ /**
40
+ * Callback function invoked for each row returned from the view
41
+ * @param instance the library handle
42
+ * @param cbtype the callback type. This is set to @ref LCB_CALLBACK_VIEWQUERY
43
+ * @param row Information about the current row
44
+ *
45
+ * Note that this callback's `row->rflags` will contain the @ref LCB_RESP_F_FINAL
46
+ * flag set after all rows have been returned. Applications should check for
47
+ * the presence of this flag. If this flag is present, the row itself will
48
+ * contain the raw response metadata in its lcb_RESPVIEWQUERY::value field.
49
+ */
50
+ typedef void (*lcb_VIEWQUERYCALLBACK)(lcb_t instance,
51
+ int cbtype, const lcb_RESPVIEWQUERY *row);
52
+
53
+ /** Set this flag to execute an actual get with each response */
54
+ #define LCB_CMDVIEWQUERY_F_INCLUDE_DOCS 1 << 16
55
+
56
+ /**Set this flag to only parse the top level row, and not its constituent
57
+ * parts. Note this is incompatible with `F_INCLUDE_DOCS`*/
58
+ #define LCB_CMDVIEWQUERY_F_NOROWPARSE 1 << 17
59
+
60
+ /**This view is spatial. Modifies how the final view path will be constructed */
61
+ #define LCB_CMDVIEWQUERY_F_SPATIAL 1 << 18
62
+
63
+ /** Command structure for querying a view */
64
+ typedef struct {
65
+ /** Common command flags; e.g. @ref LCB_CMDVIEWQUERY_F_INCLUDE_DOCS */
66
+ lcb_U32 cmdflags;
67
+
68
+ /** The design document as a string; e.g. `"beer"` */
69
+ const char *ddoc;
70
+ /** Length of design document name */
71
+ size_t nddoc;
72
+
73
+ /** The name of the view as a string; e.g. `"brewery_beers"` */
74
+ const char *view;
75
+ /** Length of the view name */
76
+ size_t nview;
77
+
78
+ /**Any URL parameters to be passed to the view should be specified here.
79
+ * The library will internally insert a `?` character before the options
80
+ * (if specified), so do not place one yourself.
81
+ *
82
+ * The format of the options follows the standard for passing parameters
83
+ * via HTTP requests; thus e.g. `key1=value1&key2=value2`. This string
84
+ * is itself not parsed by the library but simply appended to the URL. */
85
+ const char *optstr;
86
+
87
+ /** Length of the option string */
88
+ size_t noptstr;
89
+
90
+ /**Some query parameters (in particular; 'keys') may be send via a POST
91
+ * request within the request body, since it might be too long for the
92
+ * URI itself. If you have such data, place it here. */
93
+ const char *postdata;
94
+ size_t npostdata;
95
+
96
+ /**
97
+ * The maximum number of internal get requests to issue concurrently for
98
+ * @c F_INCLUDE_DOCS. This is useful for large view responses where
99
+ * there is a potential for a large number of responses resulting in a large
100
+ * number of get requests; increasing memory usage.
101
+ *
102
+ * Setting this value will attempt to throttle the number of get requests,
103
+ * so that no more than this number of requests will be in progress at any
104
+ * given time.
105
+ */
106
+ unsigned docs_concurrent_max;
107
+
108
+ /**Callback to invoke for each row. If not provided, @ref LCB_EINVAL will
109
+ * be returned from lcb_view_query() */
110
+ lcb_VIEWQUERYCALLBACK callback;
111
+
112
+ /**If not NULL, this will be set to a handle which may be passed to
113
+ * lcb_view_cancel(). See that function for more details */
114
+ lcb_VIEWHANDLE *handle;
115
+ } lcb_CMDVIEWQUERY;
116
+
117
+ /**@brief Response structure representing a row.
118
+ *
119
+ * This is provided for each invocation of the
120
+ * lcb_CMDVIEWQUERY::callback invocation. The `key` and `nkey` fields here
121
+ * refer to the first argument passed to the `emit` function by the
122
+ * `map` function.
123
+ *
124
+ * This response structure may be used as-is, in case the values are simple,
125
+ * or may be relayed over to a more advanced JSON parser to decode the
126
+ * individual key and value properties.
127
+ *
128
+ * @note
129
+ * The #key and #value fields are JSON encoded. This means that if they are
130
+ * bare strings, they will be surrounded by quotes. On the other hand, the
131
+ * #docid is _not_ JSON encoded and is provided with any surrounding quotes
132
+ * stripped out (this is because the document ID is always a string). Please
133
+ * take note of this if doing any form of string comparison/processing.
134
+ *
135
+ * @note
136
+ * If the @ref LCB_CMDVIEWQUERY_F_NOROWPARSE flag has been set, the #value
137
+ * field will contain the raw row contents, rather than the constituent
138
+ * elements.
139
+ *
140
+ */
141
+ struct lcb_RESPVIEW_st {
142
+ #ifndef __LCB_DOXYGEN__ /* Doxygen fails to substitute the base fields for some reason */
143
+ LCB_RESP_BASE
144
+ #else
145
+ void *cookie; /**< User data associated with request */
146
+ const void *key; /**< Emitted key */
147
+ lcb_SIZE nkey; /**< Length of emitted key */
148
+ lcb_cas_t cas; /**< unused */
149
+ lcb_error_t rc; /**< Status code */
150
+ lcb_U16 version; /**< unused */
151
+ lcb_U16 rflags; /**< Response specific flags. see lcb_RESPFLAGS */
152
+ #endif
153
+
154
+ const char *docid; /**< Document ID (i.e. memcached key) associated with this row */
155
+ size_t ndocid; /**< Length of document ID */
156
+
157
+ /**Emitted value. If `rflags & LCB_RESP_F_FINAL` is true then this will
158
+ * contain the _metadata_ of the view response itself. This includes the
159
+ * `total_rows` field among other things, and should be parsed as JSON */
160
+ const char *value;
161
+
162
+ size_t nvalue; /**< Length of emitted value */
163
+
164
+ /**If this is a spatial view, the GeoJSON geometry fields will be here */
165
+ const char *geometry;
166
+ size_t ngeometry;
167
+
168
+ /**If the request failed, this will contain the raw underlying request.
169
+ * You may inspect this request and perform some other processing on
170
+ * the underlying HTTP data. Note that this may not necessarily contain
171
+ * the entire response body; just the chunk at which processing failed.*/
172
+ const lcb_RESPHTTP *htresp;
173
+
174
+ /**If @ref LCB_CMDVIEWQUERY_F_INCLUDE_DOCS was specified in the request,
175
+ * this will contain the response for the _GET_ command. This is the same
176
+ * response as would be received in the `LCB_CALLBACK_GET` for
177
+ * lcb_get3().
178
+ *
179
+ * Note that this field should be checked for various errors as well, as it
180
+ * is remotely possible the get request did not succeed.
181
+ *
182
+ * If the @ref LCB_CMDVIEWQUERY_F_INCLUDE_DOCS flag was not specified, this
183
+ * field will be `NULL`.
184
+ */
185
+ const lcb_RESPGET *docresp;
186
+ };
187
+
188
+ /**
189
+ * @volatile
190
+ *
191
+ * Initiate a view query. This will execute a view (MapReduce) request against
192
+ * a view endpoint within the cluster. For each row emitted by the view
193
+ * functions (i.e. the `map`, and possibly `reduce` functions) the
194
+ * callback specified in the lcb_CMDVIEWQUERY::callback field will be invoked.
195
+ *
196
+ * Here is a functional example:
197
+ *
198
+ * @code{.c}
199
+ * static void rowCallback(lcb_t instance, int ignoreme, const lcb_RESPVIEWQUERY *response) {
200
+ * if (response->rflags & LCB_RESP_F_FINAL) {
201
+ * printf("View is done!\n");
202
+ * if (response->nvalue) {
203
+ * printf("Raw JSON metadata: %.*s\n", (int)response->nvalue, response->value);
204
+ * }
205
+ * if (response->rc != LCB_SUCCESS) {
206
+ * printf("Query failed: %s\n", lcb_sterror(instance, response->rc));
207
+ * }
208
+ * return;
209
+ * }
210
+ *
211
+ * // Key and value always exist:
212
+ * printf("Emitted key: %.*s\n", (int)resp->nkey, resp-key);
213
+ * printf("Emitted value: %s.*s\n", (int)resp->nvalue, resp->value);
214
+ *
215
+ * // Document IDs are only present for non-reduce queries
216
+ * if (resp->docid) {
217
+ * printf("Document ID: %.*s\n", (int)resp->docid, resp->ndocid);
218
+ * // If LCB_CMDVIEWQUERY_F_INCLUDE_DOCS was specified, this might
219
+ * // contain the actual document value
220
+ * if (resp->docresp) {
221
+ * const lcb_RESPGET *rg = resp->docresp;
222
+ * if (rg->rc == LCB_SUCCESS) {
223
+ * printf("Document contents: %.*s\n", (int)rg->value, rg->nvalue);
224
+ * printf("CAS: 0x%lx\n", rg->cas);
225
+ * } else {
226
+ * printf("Couldn't fetch document: %s\n", lcb_strerror(instance, rg->rc));
227
+ * }
228
+ * }
229
+ * }
230
+ * }
231
+ *
232
+ * static void doViewRequest(lcb_t instance) {
233
+ * lcb_CMDVIEWQUERY cmd = { 0 };
234
+ * vq.ddoc = "beer";
235
+ * vq.nddoc = strlen(vq.ddoc);
236
+ * vq.view = "brewery_beers";
237
+ * vq.nview = strlen(vq.view);
238
+ * vq.optstr = "limit=10&descending=true";
239
+ * vq.noptstr = strlen(vq.optstr);
240
+ * vq.callback = rowCallback;
241
+ *
242
+ * // If you want to perform an implicit lcb_get3() on each row's `docid`
243
+ * if (includeDocs) {
244
+ * vq.cmdflags |= LCB_CMDVIEWQUERY_F_INCLUDE_DOCS;
245
+ * }
246
+ *
247
+ * lcb_error_t rc = lcb_view_query(instance, NULL, &cmd);
248
+ * // handle error
249
+ * lcb_wait(instance);
250
+ * }
251
+ * @endcode
252
+ *
253
+ * @param instance The library handle
254
+ * @param cookie user pointer included in every response
255
+ * @param cmd the command detailing the type of query to perform
256
+ * @return LCB_SUCCESS on scheduling success, or an error code on scheduling
257
+ * failure.
258
+ */
259
+ LIBCOUCHBASE_API
260
+ lcb_error_t
261
+ lcb_view_query(lcb_t instance, const void *cookie, const lcb_CMDVIEWQUERY *cmd);
262
+
263
+ /**
264
+ * @volatile
265
+ *
266
+ * Initialize a command object. This is a convenience function.
267
+ * @param vq the command to initialize
268
+ * @param design the name of the design. Required and should be NUL-terminated
269
+ * @param view the name of the view. Required and should be NUL-terminated
270
+ * @param options a string of options. Optional. If provided, should be
271
+ * NUL-terminated
272
+ * @param callback the callback to invoke. Required
273
+ */
274
+ LIBCOUCHBASE_API
275
+ void
276
+ lcb_view_query_initcmd(lcb_CMDVIEWQUERY *vq,
277
+ const char *design, const char *view, const char *options,
278
+ lcb_VIEWQUERYCALLBACK callback);
279
+
280
+ /**
281
+ * @volatile
282
+ *
283
+ * Cancels the ongoing request. This ensures the callback will never be invoked.
284
+ * This should be used only in situations where the lcb_t itself may be
285
+ * destroyed to avoid leaking any application allocated memory. This does not
286
+ * guarantee the view internals will not leak, however.
287
+ */
288
+ LIBCOUCHBASE_API
289
+ void
290
+ lcb_view_cancel(lcb_t instance, lcb_VIEWHANDLE handle);
291
+
292
+ /**@}*/
293
+
294
+ #ifdef __cplusplus
295
+ }
296
+ #endif
297
+
298
+ #endif
@@ -0,0 +1,65 @@
1
+ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Couchbase, Inc
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ #ifndef LIBCOUCHBASE_VISIBILITY_H
18
+ #define LIBCOUCHBASE_VISIBILITY_H
19
+
20
+ #ifdef LIBCOUCHBASE_STATIC
21
+ #define LIBCOUCHBASE_API
22
+ #define LCB_EXTERN_VAR extern
23
+ #else
24
+
25
+ #ifdef LIBCOUCHBASE_INTERNAL
26
+ #ifdef __SUNPRO_C
27
+ #define LIBCOUCHBASE_API __global
28
+ #define LCB_CLASS_EXPORT LIBCOUCHBASE_API
29
+ #elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
30
+ #define LIBCOUCHBASE_API __attribute__ ((visibility("default")))
31
+ #define LCB_CLASS_EXPORT LIBCOUCHBASE_API
32
+ #elif defined(_MSC_VER)
33
+ #define LIBCOUCHBASE_API extern __declspec(dllexport)
34
+ #define LCB_CLASS_EXPORT __declspec(dllexport)
35
+ #else
36
+ #define LIBCOUCHBASE_API
37
+ #define LCB_CLASS_EXPORT
38
+ #endif /* compiler version */
39
+
40
+ #else /* !LIBCOUCHBASE_INTERNAL */
41
+ #ifdef _MSC_VER
42
+ #define LIBCOUCHBASE_API extern __declspec(dllimport)
43
+ #define LCB_CLASS_EXPORT __declspec(dllimport)
44
+ #else
45
+ #define LIBCOUCHBASE_API
46
+ #define LCB_CLASS_EXPORT
47
+ #endif
48
+ #endif /* LIBCOUCHBASE_INTERNAL */
49
+
50
+ /* Define LCB_EXTERN_VAR only if !LIBCOUCHBASE_STATIC */
51
+ #ifdef _MSC_VER
52
+ /* Already includes 'extern' in LIBCOUCHBASE_API def, don't use it twice! */
53
+ #define LCB_EXTERN_VAR
54
+ #else
55
+ #define LCB_EXTERN_VAR extern
56
+ #endif /* _MSC_VER */
57
+ #endif /* !LIBCOUCHBASE_STATIC */
58
+
59
+ /**
60
+ * This symbol declares internal APIs as accessible from other modules.
61
+ * It should still not be used.
62
+ */
63
+ #define LCB_INTERNAL_API LIBCOUCHBASE_API
64
+
65
+ #endif
@@ -0,0 +1,30 @@
1
+ Copyright (c) 2003, Danga Interactive, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are
6
+ met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above
12
+ copyright notice, this list of conditions and the following disclaimer
13
+ in the documentation and/or other materials provided with the
14
+ distribution.
15
+
16
+ * Neither the name of the Danga Interactive nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,10 @@
1
+ This directory contains headerfiles copied from
2
+ git://github.com/memcached/memcached.git. They are only included to
3
+ make it easier to build the software without having to download these
4
+ headers separately. Please do not change the files in this directory, but
5
+ rather copy a new set from the repository if you need to upgrade the
6
+ content.
7
+
8
+ Cheers,
9
+
10
+ Trond Norbye
@@ -0,0 +1,1916 @@
1
+ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (c) <2008>, Sun Microsystems, Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ * * Redistributions of source code must retain the above copyright
9
+ * notice, this list of conditions and the following disclaimer.
10
+ * * Redistributions in binary form must reproduce the above copyright
11
+ * notice, this list of conditions and the following disclaimer in the
12
+ * documentation and/or other materials provided with the distribution.
13
+ * * Neither the name of the nor the
14
+ * names of its contributors may be used to endorse or promote products
15
+ * derived from this software without specific prior written permission.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY SUN MICROSYSTEMS, INC. ``AS IS'' AND ANY
18
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ * DISCLAIMED. IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY
21
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ */
28
+ /*
29
+ * Summary: Constants used by to implement the binary protocol.
30
+ *
31
+ * Copy: See Copyright for the status of this software.
32
+ *
33
+ * Author: Trond Norbye <trond.norbye@sun.com>
34
+ */
35
+
36
+ #ifndef PROTOCOL_BINARY_H
37
+ #define PROTOCOL_BINARY_H
38
+
39
+ #if !defined HAVE_STDINT_H && defined _WIN32 && defined(_MSC_VER)
40
+ # include "win_stdint.h"
41
+ #else
42
+ # include <stdint.h>
43
+ #endif
44
+ #include <memcached/vbucket.h>
45
+
46
+ /**
47
+ * \addtogroup Protocol
48
+ * @{
49
+ */
50
+
51
+ /**
52
+ * This file contains definitions of the constants and packet formats
53
+ * defined in the binary specification. Please note that you _MUST_ remember
54
+ * to convert each multibyte field to / from network byte order to / from
55
+ * host order.
56
+ */
57
+ #ifdef __cplusplus
58
+ extern "C"
59
+ {
60
+ #endif
61
+
62
+ /**
63
+ * Definition of the legal "magic" values used in a packet.
64
+ * See section 3.1 Magic byte
65
+ */
66
+ typedef enum {
67
+ PROTOCOL_BINARY_REQ = 0x80,
68
+ PROTOCOL_BINARY_RES = 0x81
69
+ } protocol_binary_magic;
70
+
71
+ /**
72
+ * Definition of the valid response status numbers.
73
+ *
74
+ * A well written client should be "future proof" by handling new
75
+ * error codes to be defined. Note that new error codes means that
76
+ * the requested operation wasn't performed.
77
+ */
78
+ typedef enum {
79
+ /** The operation completed successfully */
80
+ PROTOCOL_BINARY_RESPONSE_SUCCESS = 0x00,
81
+ /** The key does not exists */
82
+ PROTOCOL_BINARY_RESPONSE_KEY_ENOENT = 0x01,
83
+ /** The key exists in the cluster (with another CAS value) */
84
+ PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS = 0x02,
85
+ /** The document exceeds the maximum size */
86
+ PROTOCOL_BINARY_RESPONSE_E2BIG = 0x03,
87
+ /** Invalid request */
88
+ PROTOCOL_BINARY_RESPONSE_EINVAL = 0x04,
89
+ /** The document was not stored for some reason. This is
90
+ * currently a "catch all" for number or error situations, and
91
+ * should be split into multiple error codes. */
92
+ PROTOCOL_BINARY_RESPONSE_NOT_STORED = 0x05,
93
+ /** Non-numeric server-side value for incr or decr */
94
+ PROTOCOL_BINARY_RESPONSE_DELTA_BADVAL = 0x06,
95
+ /** The server is not responsible for the requested vbucket */
96
+ PROTOCOL_BINARY_RESPONSE_NOT_MY_VBUCKET = 0x07,
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,
101
+ /** Authentication failure (invalid user/password combination,
102
+ * OR an internal error in the authentication library. Could
103
+ * be a misconfigured SASL configuration. See server logs for
104
+ * more information.) */
105
+ PROTOCOL_BINARY_RESPONSE_AUTH_ERROR = 0x20,
106
+ /** Authentication OK so far, please continue */
107
+ PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE = 0x21,
108
+ /** The requested value is outside the legal range
109
+ * (similar to EINVAL, but more specific) */
110
+ PROTOCOL_BINARY_RESPONSE_ERANGE = 0x22,
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,
115
+ /** No access (could be opcode, value, bucket etc) */
116
+ PROTOCOL_BINARY_RESPONSE_EACCESS = 0x24,
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,
121
+ /** The server have no idea what this command is for */
122
+ PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81,
123
+ /** Not enough memory */
124
+ PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82,
125
+ /** The server does not support this command */
126
+ PROTOCOL_BINARY_RESPONSE_NOT_SUPPORTED = 0x83,
127
+ /** An internal error in the server */
128
+ PROTOCOL_BINARY_RESPONSE_EINTERNAL = 0x84,
129
+ /** The system is currently too busy to handle the request.
130
+ * it is _currently_ only being used by the scrubber in
131
+ * default_engine to run a task there may only be one of
132
+ * (subsequent requests to start it would return ebusy until
133
+ * it's done). */
134
+ PROTOCOL_BINARY_RESPONSE_EBUSY = 0x85,
135
+ /** A temporary error condition occurred. Retrying the
136
+ * operation may resolve the problem. This could be that the
137
+ * server is in a degraded situation (like running warmup on
138
+ * the node), the vbucket could be in an "incorrect" state, a
139
+ * temporary failure from the underlying persistence layer,
140
+ * etc).
141
+ */
142
+ PROTOCOL_BINARY_RESPONSE_ETMPFAIL = 0x86,
143
+
144
+ /*
145
+ * Sub-document specific responses.
146
+ */
147
+
148
+ /** The provided path does not exist in the document. */
149
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_PATH_ENOENT = 0xc0,
150
+
151
+ /** One of path components treats a non-dictionary as a dictionary, or
152
+ * a non-array as an array.
153
+ * [Arithmetic operations only] The value the path points to is not
154
+ * a number. */
155
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_PATH_MISMATCH = 0xc1,
156
+
157
+ /** The path’s syntax was incorrect. */
158
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_PATH_EINVAL = 0xc2,
159
+
160
+ /** The path provided is too large; either the string is too long,
161
+ * or it contains too many components. */
162
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_PATH_E2BIG = 0xc3,
163
+
164
+ /** The document has too many levels to parse. */
165
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_DOC_E2DEEP = 0xc4,
166
+
167
+ /** [For mutations only] The value provided will invalidate the JSON if
168
+ * inserted. */
169
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_VALUE_CANTINSERT = 0xc5,
170
+
171
+ /** The existing document is not valid JSON. */
172
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_DOC_NOTJSON = 0xc6,
173
+
174
+ /** [For arithmetic ops] The existing number is out of the valid range
175
+ * for arithmetic ops (cannot be represented as an int64_t). */
176
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_NUM_ERANGE = 0xc7,
177
+
178
+ /** [For arithmetic ops] The operation would result in a number
179
+ * outside the valid range (cannot be represented as an int64_t). */
180
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_DELTA_ERANGE = 0xc8,
181
+
182
+ /** [For mutations only] The requested operation requires the path to
183
+ * not already exist, but it exists. */
184
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_PATH_EEXISTS = 0xc9,
185
+
186
+ /** [For mutations only] Inserting the value would cause the document
187
+ * to be too deep. */
188
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_VALUE_ETOODEEP = 0xca,
189
+
190
+ /** [For multi-path commands only] An invalid combination of commands
191
+ * was specified. */
192
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_INVALID_COMBO = 0xcb,
193
+
194
+ /** [For multi-path commands only] Specified key was successfully
195
+ * found, but one or more path operations failed. Examine the individual
196
+ * lookup_result (MULTI_LOOKUP) / mutation_result (MULTI_MUTATION)
197
+ * structures for details. */
198
+ PROTOCOL_BINARY_RESPONSE_SUBDOC_MULTI_PATH_FAILURE = 0xcc
199
+
200
+ } protocol_binary_response_status;
201
+
202
+ /**
203
+ * Defintion of the different command opcodes.
204
+ * See section 3.3 Command Opcodes
205
+ */
206
+ typedef enum {
207
+ PROTOCOL_BINARY_CMD_GET = 0x00,
208
+ PROTOCOL_BINARY_CMD_SET = 0x01,
209
+ PROTOCOL_BINARY_CMD_ADD = 0x02,
210
+ PROTOCOL_BINARY_CMD_REPLACE = 0x03,
211
+ PROTOCOL_BINARY_CMD_DELETE = 0x04,
212
+ PROTOCOL_BINARY_CMD_INCREMENT = 0x05,
213
+ PROTOCOL_BINARY_CMD_DECREMENT = 0x06,
214
+ PROTOCOL_BINARY_CMD_QUIT = 0x07,
215
+ PROTOCOL_BINARY_CMD_FLUSH = 0x08,
216
+ PROTOCOL_BINARY_CMD_GETQ = 0x09,
217
+ PROTOCOL_BINARY_CMD_NOOP = 0x0a,
218
+ PROTOCOL_BINARY_CMD_VERSION = 0x0b,
219
+ PROTOCOL_BINARY_CMD_GETK = 0x0c,
220
+ PROTOCOL_BINARY_CMD_GETKQ = 0x0d,
221
+ PROTOCOL_BINARY_CMD_APPEND = 0x0e,
222
+ PROTOCOL_BINARY_CMD_PREPEND = 0x0f,
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,
234
+ PROTOCOL_BINARY_CMD_VERBOSITY = 0x1b,
235
+ PROTOCOL_BINARY_CMD_TOUCH = 0x1c,
236
+ PROTOCOL_BINARY_CMD_GAT = 0x1d,
237
+ PROTOCOL_BINARY_CMD_GATQ = 0x1e,
238
+ PROTOCOL_BINARY_CMD_HELLO = 0x1f,
239
+
240
+ PROTOCOL_BINARY_CMD_SASL_LIST_MECHS = 0x20,
241
+ PROTOCOL_BINARY_CMD_SASL_AUTH = 0x21,
242
+ PROTOCOL_BINARY_CMD_SASL_STEP = 0x22,
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,
321
+ PROTOCOL_BINARY_CMD_GET_REPLICA = 0x83,
322
+
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,
330
+
331
+ PROTOCOL_BINARY_CMD_OBSERVE_SEQNO = 0x91,
332
+ PROTOCOL_BINARY_CMD_OBSERVE = 0x92,
333
+
334
+ PROTOCOL_BINARY_CMD_EVICT_KEY = 0x93,
335
+ PROTOCOL_BINARY_CMD_GET_LOCKED = 0x94,
336
+ PROTOCOL_BINARY_CMD_UNLOCK_KEY = 0x95,
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
+ */
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,
418
+
419
+ /**
420
+ * Commands for the Sub-document API.
421
+ */
422
+
423
+ /* Retrieval commands */
424
+ PROTOCOL_BINARY_CMD_SUBDOC_GET = 0xc5,
425
+ PROTOCOL_BINARY_CMD_SUBDOC_EXISTS = 0xc6,
426
+
427
+ /* Dictionary commands */
428
+ PROTOCOL_BINARY_CMD_SUBDOC_DICT_ADD = 0xc7,
429
+ PROTOCOL_BINARY_CMD_SUBDOC_DICT_UPSERT = 0xc8,
430
+
431
+ /* Generic modification commands */
432
+ PROTOCOL_BINARY_CMD_SUBDOC_DELETE = 0xc9,
433
+ PROTOCOL_BINARY_CMD_SUBDOC_REPLACE = 0xca,
434
+
435
+ /* Array commands */
436
+ PROTOCOL_BINARY_CMD_SUBDOC_ARRAY_PUSH_LAST = 0xcb,
437
+ PROTOCOL_BINARY_CMD_SUBDOC_ARRAY_PUSH_FIRST = 0xcc,
438
+ PROTOCOL_BINARY_CMD_SUBDOC_ARRAY_INSERT = 0xcd,
439
+ PROTOCOL_BINARY_CMD_SUBDOC_ARRAY_ADD_UNIQUE = 0xce,
440
+
441
+ /* Arithmetic commands */
442
+ PROTOCOL_BINARY_CMD_SUBDOC_COUNTER = 0xcf,
443
+
444
+ /* Multi-Path commands */
445
+ PROTOCOL_BINARY_CMD_SUBDOC_MULTI_LOOKUP = 0xd0,
446
+ PROTOCOL_BINARY_CMD_SUBDOC_MULTI_MUTATION = 0xd1,
447
+
448
+ /* Subdoc additions for Spock: */
449
+ PROTOCOL_BINARY_CMD_SUBDOC_GET_COUNT = 0xd2,
450
+
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,
465
+
466
+ /* Reserved for being able to signal invalid opcode */
467
+ PROTOCOL_BINARY_CMD_INVALID = 0xff
468
+ } protocol_binary_command;
469
+
470
+ /**
471
+ * Definition of the data types in the packet
472
+ * See section 3.4 Data Types
473
+ */
474
+ typedef enum {
475
+ PROTOCOL_BINARY_RAW_BYTES = 0x00,
476
+ PROTOCOL_BINARY_DATATYPE_JSON = 0x01,
477
+ /* Compressed == snappy compression */
478
+ PROTOCOL_BINARY_DATATYPE_COMPRESSED = 0x02,
479
+ /* Compressed == snappy compression */
480
+ PROTOCOL_BINARY_DATATYPE_COMPRESSED_JSON = 0x03
481
+ } protocol_binary_datatypes;
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
+
496
+ /**
497
+ * Definitions of sub-document flags.
498
+ */
499
+ typedef enum {
500
+ /* No flags set */
501
+ SUBDOC_FLAG_NONE = 0x0,
502
+
503
+ /* (Mutation) Should non-existent intermediate paths be created? */
504
+ SUBDOC_FLAG_MKDIR_P = 0x01,
505
+
506
+ /* (Mutation) Create the document if it does not exist. Implies
507
+ * SUBDOC_FLAG_MKDIR_P.
508
+ */
509
+ SUBDOC_FLAG_MKDOC = 0x02
510
+ } protocol_binary_subdoc_flag;
511
+
512
+ /**
513
+ * Definition of the header structure for a request packet.
514
+ * See section 2
515
+ */
516
+ typedef union {
517
+ struct {
518
+ uint8_t magic;
519
+ uint8_t opcode;
520
+ uint16_t keylen;
521
+ uint8_t extlen;
522
+ uint8_t datatype;
523
+ uint16_t vbucket;
524
+ uint32_t bodylen;
525
+ uint32_t opaque;
526
+ uint64_t cas;
527
+ } request;
528
+ uint8_t bytes[24];
529
+ } protocol_binary_request_header;
530
+
531
+ /**
532
+ * Definition of the header structure for a response packet.
533
+ * See section 2
534
+ */
535
+ typedef union {
536
+ struct {
537
+ uint8_t magic;
538
+ uint8_t opcode;
539
+ uint16_t keylen;
540
+ uint8_t extlen;
541
+ uint8_t datatype;
542
+ uint16_t status;
543
+ uint32_t bodylen;
544
+ uint32_t opaque;
545
+ uint64_t cas;
546
+ } response;
547
+ uint8_t bytes[24];
548
+ } protocol_binary_response_header;
549
+
550
+ /**
551
+ * Definition of a request-packet containing no extras
552
+ */
553
+ typedef union {
554
+ struct {
555
+ protocol_binary_request_header header;
556
+ } message;
557
+ uint8_t bytes[sizeof(protocol_binary_request_header)];
558
+ } protocol_binary_request_no_extras;
559
+
560
+ /**
561
+ * Definition of a response-packet containing no extras
562
+ */
563
+ typedef union {
564
+ struct {
565
+ protocol_binary_response_header header;
566
+ } message;
567
+ uint8_t bytes[sizeof(protocol_binary_response_header)];
568
+ } protocol_binary_response_no_extras;
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;
578
+
579
+ /**
580
+ * Definition of the packet returned from a successful get, getq, getk and
581
+ * getkq.
582
+ * See section 4
583
+ */
584
+ typedef union {
585
+ struct {
586
+ protocol_binary_response_header header;
587
+ struct {
588
+ uint32_t flags;
589
+ } body;
590
+ } message;
591
+ uint8_t bytes[sizeof(protocol_binary_response_header) + 4];
592
+ } protocol_binary_response_get;
593
+
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;
597
+
598
+ /**
599
+ * Definition of the packet used by the delete command
600
+ * See section 4
601
+ */
602
+ typedef protocol_binary_request_no_extras protocol_binary_request_delete;
603
+
604
+ /**
605
+ * Definition of the packet returned by the delete command
606
+ * See section 4
607
+ *
608
+ * extlen should be either zero, or 16 if the client has enabled the
609
+ * MUTATION_SEQNO feature, with the following format:
610
+ *
611
+ * Header: (0-23): <protocol_binary_response_header>
612
+ * Extras:
613
+ * Vbucket UUID (24-31): 0x0000000000003039
614
+ * Seqno (32-39): 0x000000000000002D
615
+ */
616
+ typedef protocol_binary_response_no_extras protocol_binary_response_delete;
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
+
644
+ /**
645
+ * Definition of the packet used by set, add and replace
646
+ * See section 4
647
+ */
648
+ typedef union {
649
+ struct {
650
+ protocol_binary_request_header header;
651
+ struct {
652
+ uint32_t flags;
653
+ uint32_t expiration;
654
+ } body;
655
+ } message;
656
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 8];
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;
680
+
681
+ /**
682
+ * Definition of the structure used by the increment and decrement
683
+ * command.
684
+ * See section 4
685
+ */
686
+ typedef union {
687
+ struct {
688
+ protocol_binary_request_header header;
689
+ struct {
690
+ uint64_t delta;
691
+ uint64_t initial;
692
+ uint32_t expiration;
693
+ } body;
694
+ } message;
695
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 20];
696
+ } protocol_binary_request_incr;
697
+ typedef protocol_binary_request_incr protocol_binary_request_decr;
698
+
699
+ /**
700
+ * Definition of the response from an incr or decr command
701
+ * command.
702
+ *
703
+ * The result of the incr/decr is a uint64_t placed at header + extlen.
704
+ *
705
+ * extlen should be either zero, or 16 if the client has enabled the
706
+ * MUTATION_SEQNO feature, with the following format:
707
+ *
708
+ * Header: (0-23): <protocol_binary_response_header>
709
+ * Extras:
710
+ * Vbucket UUID (24-31): 0x0000000000003039
711
+ * Seqno (32-39): 0x000000000000002D
712
+ * Value: (40-47): ....
713
+ *
714
+ */
715
+ typedef protocol_binary_response_no_extras protocol_binary_response_incr;
716
+ typedef protocol_binary_response_no_extras protocol_binary_response_decr;
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
+
750
+ /**
751
+ * Definition of the packet returned from a successful version command
752
+ * See section 4
753
+ */
754
+ typedef protocol_binary_response_no_extras protocol_binary_response_version;
755
+
756
+
757
+ /**
758
+ * Definition of the packet used by the stats command.
759
+ * See section 4
760
+ */
761
+ typedef protocol_binary_request_no_extras protocol_binary_request_stats;
762
+
763
+ /**
764
+ * Definition of the packet returned from a successful stats command
765
+ * See section 4
766
+ */
767
+ typedef protocol_binary_response_no_extras protocol_binary_response_stats;
768
+
769
+ /**
770
+ * Definition of the packet used by the verbosity command
771
+ */
772
+ typedef union {
773
+ struct {
774
+ protocol_binary_request_header header;
775
+ struct {
776
+ uint32_t level;
777
+ } body;
778
+ } message;
779
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
780
+ } protocol_binary_request_verbosity;
781
+
782
+ /**
783
+ * Definition of the packet returned from the verbosity command
784
+ */
785
+ typedef protocol_binary_response_no_extras protocol_binary_response_verbosity;
786
+
787
+ /**
788
+ * Definition of the packet used by the touch command.
789
+ */
790
+ typedef union {
791
+ struct {
792
+ protocol_binary_request_header header;
793
+ struct {
794
+ uint32_t expiration;
795
+ } body;
796
+ } message;
797
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
798
+ } protocol_binary_request_touch;
799
+
800
+ /**
801
+ * Definition of the packet returned from the touch command
802
+ */
803
+ typedef protocol_binary_response_no_extras protocol_binary_response_touch;
804
+
805
+ /**
806
+ * Definition of the packet used by the GAT(Q) command.
807
+ */
808
+ typedef union {
809
+ struct {
810
+ protocol_binary_request_header header;
811
+ struct {
812
+ uint32_t expiration;
813
+ } body;
814
+ } message;
815
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
816
+ } protocol_binary_request_gat;
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;
825
+
826
+ /**
827
+ * Definition of the packet used by SUBDOCUMENT single-path commands.
828
+ *
829
+ * The path, which is always required, is in the Body, after the Key.
830
+ *
831
+ * Header: 24 @0: <protocol_binary_request_header>
832
+ * Extras:
833
+ * Sub-document flags 1 @24: <protocol_binary_subdoc_flag>
834
+ * Sub-document pathlen 2 @25: <variable>
835
+ * Body:
836
+ * Key keylen @27: <variable>
837
+ * Path pathlen @27+keylen: <variable>
838
+ * Value to insert/replace
839
+ * vallen-keylen-pathlen @27+keylen+pathlen: [variable]
840
+ */
841
+ typedef union {
842
+ struct {
843
+ protocol_binary_request_header header;
844
+ struct {
845
+ uint16_t pathlen; // Length in bytes of the sub-doc path.
846
+ uint8_t subdoc_flags; // See protocol_binary_subdoc_flag
847
+ } extras;
848
+ } message;
849
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 3];
850
+ } protocol_binary_request_subdocument;
851
+
852
+
853
+ /** Definition of the packet used by SUBDOCUMENT responses.
854
+ */
855
+ typedef union {
856
+ struct {
857
+ protocol_binary_response_header header;
858
+ } message;
859
+ uint8_t bytes[sizeof(protocol_binary_response_header)];
860
+ } protocol_binary_response_subdocument;
861
+
862
+ /**
863
+ * Definition of the request packets used by SUBDOCUMENT multi-path commands.
864
+ *
865
+ * Multi-path sub-document commands differ from single-path in that they
866
+ * encode a series of multiple paths to operate on (from a single key).
867
+ * There are two multi-path commands - MULTI_LOOKUP and MULTI_MUTATION.
868
+ * - MULTI_LOOKUP consists of variable number of subdoc lookup commands
869
+ * (SUBDOC_GET or SUBDOC_EXISTS).
870
+ * - MULTI_MUTATION consists of a variable number of subdoc mutation
871
+ * commands (i.e. all subdoc commands apart from
872
+ * SUBDOC_{GET,EXISTS}).
873
+ *
874
+ * Each path to be operated on is specified by an Operation Spec, which are
875
+ * contained in the body. This defines the opcode, path, and value
876
+ * (for mutations).
877
+ *
878
+ * A maximum of MULTI_MAX_PATHS paths (operations) can be encoded in a
879
+ * single multi-path command.
880
+ *
881
+ * SUBDOC_MULTI_LOOKUP:
882
+ * Header: 24 @0: <protocol_binary_request_header>
883
+ * Extras: 0 @24: no extras
884
+ * Body: <variable> @24:
885
+ * Key keylen @24: <variable>
886
+ * 1..MULTI_MAX_PATHS [Lookup Operation Spec]
887
+ *
888
+ * Lookup Operation Spec:
889
+ * 1 @0 : Opcode
890
+ * 1 @1 : Flags
891
+ * 2 @2 : Path Length
892
+ * pathlen @4 : Path
893
+ */
894
+ static const int PROTOCOL_BINARY_SUBDOC_MULTI_MAX_PATHS = 16;
895
+
896
+ typedef struct {
897
+ uint8_t opcode;
898
+ uint8_t flags;
899
+ uint16_t pathlen;
900
+ /* uint8_t path[pathlen] */
901
+ } protocol_binary_subdoc_multi_lookup_spec;
902
+
903
+ typedef protocol_binary_request_no_extras protocol_binary_request_subdocument_multi_lookup;
904
+
905
+ /*
906
+ *
907
+ * SUBDOC_MULTI_MUTATION
908
+ * Header: 24 @0: <protocol_binary_request_header>
909
+ * Extras: 0 @24:
910
+ * Body: variable @24:
911
+ * Key keylen @24: <variable>
912
+ * 1..MULTI_MAX_PATHS [Mutation Operation Spec]
913
+ *
914
+ * Mutation Operation Spec:
915
+ * 1 @0 : Opcode
916
+ * 1 @1 : Flags
917
+ * 2 @2 : Path Length
918
+ * 4 @4 : Value Length
919
+ * pathlen @8 : Path
920
+ * vallen @8+pathlen : Value
921
+ */
922
+ typedef struct {
923
+ uint8_t opcode;
924
+ uint8_t flags;
925
+ uint16_t pathlen;
926
+ uint32_t valuelen;
927
+ /* uint8_t path[pathlen] */
928
+ /* uint8_t value[valuelen] */
929
+ } protocol_binary_subdoc_multi_mutation_spec;
930
+
931
+ typedef protocol_binary_request_no_extras protocol_binary_request_subdocument_multi_mutation;
932
+
933
+ /**
934
+ * Definition of the response packets used by SUBDOCUMENT multi-path
935
+ * commands.
936
+ *
937
+ * SUBDOC_MULTI_LOOKUP - Body consists of a series of lookup_result structs,
938
+ * one per lookup_spec in the request.
939
+ *
940
+ * Lookup Result:
941
+ * 2 @0 : status
942
+ * 4 @2 : resultlen
943
+ * resultlen @6 : result
944
+ */
945
+ typedef struct {
946
+ protocol_binary_request_header header;
947
+ /* Variable-length 1..PROTOCOL_BINARY_SUBDOC_MULTI_MAX_PATHS */
948
+ protocol_binary_subdoc_multi_lookup_spec body[1];
949
+ } protocol_binary_response_subdoc_multi_lookup;
950
+
951
+ /**
952
+ * SUBDOC_MULTI_MUTATION - Body is either empty (if all mutations
953
+ * successful), or contains the sub-code and
954
+ * index of the first failed mutation spec..
955
+ * Mutation Result (failure):
956
+ * 2 @0 : Status code of first spec which failed.
957
+ * 1 @2 : 0-based index of the first spec which failed.
958
+ */
959
+ typedef union {
960
+ struct {
961
+ protocol_binary_response_header header;
962
+ } message;
963
+ uint8_t bytes[sizeof(protocol_binary_response_header)];
964
+ } protocol_binary_response_subdoc_multi_mutation;
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
+
1229
+ /**
1230
+ * Definition of hello's features.
1231
+ */
1232
+ typedef enum {
1233
+ PROTOCOL_BINARY_FEATURE_DATATYPE = 0x01,
1234
+ PROTOCOL_BINARY_FEATURE_TLS = 0x2,
1235
+ PROTOCOL_BINARY_FEATURE_TCPNODELAY = 0x03,
1236
+ PROTOCOL_BINARY_FEATURE_MUTATION_SEQNO = 0x04,
1237
+ PROTOCOL_BINARY_FEATURE_TCPDELAY = 0x05
1238
+ } protocol_binary_hello_features;
1239
+
1240
+ #define MEMCACHED_FIRST_HELLO_FEATURE 0x01
1241
+ #define MEMCACHED_TOTAL_HELLO_FEATURES 0x05
1242
+
1243
+ #define protocol_feature_2_text(a) \
1244
+ (a == PROTOCOL_BINARY_FEATURE_DATATYPE) ? "Datatype" : \
1245
+ (a == PROTOCOL_BINARY_FEATURE_TLS) ? "TLS" : \
1246
+ (a == PROTOCOL_BINARY_FEATURE_TCPNODELAY) ? "TCP NODELAY" : \
1247
+ (a == PROTOCOL_BINARY_FEATURE_MUTATION_SEQNO) ? "Mutation seqno" : \
1248
+ (a == PROTOCOL_BINARY_FEATURE_TCPDELAY) ? "TCP DELAY" : "Unknown"
1249
+
1250
+ /**
1251
+ * The HELLO command is used by the client and the server to agree
1252
+ * upon the set of features the other end supports. It is initiated
1253
+ * by the client by sending its agent string and the list of features
1254
+ * it would like to use. The server will then reply with the list
1255
+ * of the requested features it supports.
1256
+ *
1257
+ * ex:
1258
+ * Client -> HELLO [myclient 2.0] datatype, tls
1259
+ * Server -> HELLO SUCCESS datatype
1260
+ *
1261
+ * In this example the server responds that it allows the client to
1262
+ * use the datatype extension, but not the tls extension.
1263
+ */
1264
+
1265
+
1266
+ /**
1267
+ * Definition of the packet requested by hello cmd.
1268
+ * Key: This is a client-specific identifier (not really used by
1269
+ * the server, except for logging the HELLO and may therefore
1270
+ * be used to identify the client at a later time)
1271
+ * Body: Contains all features supported by client. Each feature is
1272
+ * specified as an uint16_t in network byte order.
1273
+ */
1274
+ typedef protocol_binary_request_no_extras protocol_binary_request_hello;
1275
+
1276
+
1277
+ /**
1278
+ * Definition of the packet returned by hello cmd.
1279
+ * Body: Contains all features requested by the client that the
1280
+ * server agrees to ssupport. Each feature is
1281
+ * specified as an uint16_t in network byte order.
1282
+ */
1283
+ typedef protocol_binary_response_no_extras protocol_binary_response_hello;
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
+
1631
+ /**
1632
+ * The message format for getLocked engine API
1633
+ */
1634
+ typedef protocol_binary_request_gat protocol_binary_request_getl;
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
+
1690
+ /**
1691
+ * Message format for CMD_GET_CONFIG
1692
+ */
1693
+ typedef protocol_binary_request_no_extras protocol_binary_request_get_cluster_config;
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
+
1767
+ #define OBS_STATE_NOT_PERSISTED 0x00
1768
+ #define OBS_STATE_PERSISTED 0x01
1769
+ #define OBS_STATE_NOT_FOUND 0x80
1770
+ #define OBS_STATE_LOGICAL_DEL 0x81
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
+
1797
+ /**
1798
+ * The PROTOCOL_BINARY_CMD_OBSERVE_SEQNO command is used by the
1799
+ * client to retrieve information about the vbucket in order to
1800
+ * find out if a particular mutation has been persisted or
1801
+ * replicated at the server side. In order to do so, the client
1802
+ * would pass the vbucket uuid of the vbucket that it wishes to
1803
+ * observe to the serve. The response would contain the last
1804
+ * persisted sequence number and the latest sequence number in the
1805
+ * vbucket. For example, if a client sends a request to observe
1806
+ * the vbucket 0 with uuid 12345 and if the response contains the
1807
+ * values <58, 65> and then the client can infer that sequence
1808
+ * number 56 has been persisted, 60 has only been replicated and
1809
+ * not been persisted yet and 68 has not been replicated yet.
1810
+ */
1811
+
1812
+ /**
1813
+ * Definition of the request packet for the observe_seqno command.
1814
+ *
1815
+ * Header: Contains the vbucket id of the vbucket that the client
1816
+ * wants to observe.
1817
+ *
1818
+ * Body: Contains the vbucket uuid of the vbucket that the client
1819
+ * wants to observe. The vbucket uuid is of type uint64_t.
1820
+ *
1821
+ */
1822
+ typedef union {
1823
+ struct {
1824
+ protocol_binary_request_header header;
1825
+ struct {
1826
+ uint64_t uuid;
1827
+ } body;
1828
+ } message;
1829
+ uint8_t bytes[sizeof(protocol_binary_request_header) + 8];
1830
+ } protocol_binary_request_observe_seqno;
1831
+
1832
+ /**
1833
+ * Definition of the response packet for the observe_seqno command.
1834
+ * Body: Contains a tuple of the form
1835
+ * <format_type, vbucket id, vbucket uuid, last_persisted_seqno, current_seqno>
1836
+ *
1837
+ * - format_type is of type uint8_t and it describes whether
1838
+ * the vbucket has failed over or not. 1 indicates a hard
1839
+ * failover, 0 indicates otherwise.
1840
+ * - vbucket id is of type uint16_t and it is the identifier for
1841
+ * the vbucket.
1842
+ * - vbucket uuid is of type uint64_t and it represents a UUID for
1843
+ * the vbucket.
1844
+ * - last_persisted_seqno is of type uint64_t and it is the
1845
+ * last sequence number that was persisted for this
1846
+ * vbucket.
1847
+ * - current_seqno is of the type uint64_t and it is the
1848
+ * sequence number of the latest mutation in the vbucket.
1849
+ *
1850
+ * In the case of a hard failover, the tuple is of the form
1851
+ * <format_type, vbucket id, vbucket uuid, last_persisted_seqno, current_seqno,
1852
+ * old vbucket uuid, last_received_seqno>
1853
+ *
1854
+ * - old vbucket uuid is of type uint64_t and it is the
1855
+ * vbucket UUID of the vbucket prior to the hard failover.
1856
+ *
1857
+ * - last_received_seqno is of type uint64_t and it is the
1858
+ * last received sequence number in the old vbucket uuid.
1859
+ *
1860
+ * The other fields are the same as that mentioned in the normal case.
1861
+ */
1862
+ typedef protocol_binary_response_no_extras protocol_binary_response_observe_seqno;
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
+
1910
+ /**
1911
+ * @}
1912
+ */
1913
+ #ifdef __cplusplus
1914
+ }
1915
+ #endif
1916
+ #endif /* PROTOCOL_BINARY_H */