couchbase 3.0.0.alpha.2-universal-darwin-19 → 3.0.0-universal-darwin-19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (888) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +227 -0
  3. data/.rubocop_todo.yml +47 -0
  4. data/.yardopts +1 -0
  5. data/CONTRIBUTING.md +110 -0
  6. data/Gemfile +16 -3
  7. data/README.md +6 -4
  8. data/Rakefile +6 -2
  9. data/couchbase.gemspec +46 -13
  10. data/examples/analytics.rb +236 -0
  11. data/examples/auth.rb +33 -0
  12. data/examples/crud.rb +16 -2
  13. data/examples/managing_analytics_indexes.rb +86 -0
  14. data/examples/managing_buckets.rb +17 -3
  15. data/examples/managing_collections.rb +22 -9
  16. data/examples/managing_query_indexes.rb +39 -19
  17. data/examples/managing_search_indexes.rb +77 -0
  18. data/examples/managing_view_indexes.rb +68 -0
  19. data/examples/query.rb +17 -3
  20. data/examples/query_with_consistency.rb +30 -20
  21. data/examples/search.rb +202 -0
  22. data/examples/search_with_consistency.rb +97 -0
  23. data/examples/subdocument.rb +42 -30
  24. data/examples/view.rb +59 -0
  25. data/ext/.clang-tidy +2 -0
  26. data/ext/.idea/misc.xml +12 -0
  27. data/ext/CMakeLists.txt +50 -3
  28. data/ext/build_config.hxx.in +20 -0
  29. data/ext/build_version.hxx.in +1 -1
  30. data/ext/couchbase/bucket.hxx +228 -51
  31. data/ext/couchbase/cluster.hxx +147 -87
  32. data/ext/couchbase/cluster_options.hxx +53 -0
  33. data/ext/couchbase/configuration.hxx +232 -14
  34. data/ext/couchbase/couchbase.cxx +4250 -1458
  35. data/ext/couchbase/error_map.hxx +202 -2
  36. data/ext/couchbase/errors.hxx +8 -2
  37. data/ext/couchbase/io/dns_client.hxx +217 -0
  38. data/ext/couchbase/io/dns_codec.hxx +207 -0
  39. data/ext/couchbase/io/dns_config.hxx +116 -0
  40. data/ext/couchbase/io/dns_message.hxx +555 -0
  41. data/ext/couchbase/io/http_command.hxx +91 -0
  42. data/ext/couchbase/io/http_session.hxx +119 -47
  43. data/ext/couchbase/io/{session_manager.hxx → http_session_manager.hxx} +34 -34
  44. data/ext/couchbase/io/mcbp_command.hxx +237 -0
  45. data/ext/couchbase/io/mcbp_message.hxx +24 -2
  46. data/ext/couchbase/io/mcbp_parser.hxx +2 -0
  47. data/ext/couchbase/io/mcbp_session.hxx +455 -173
  48. data/ext/couchbase/io/retry_action.hxx +30 -0
  49. data/ext/couchbase/io/retry_context.hxx +39 -0
  50. data/ext/couchbase/io/retry_orchestrator.hxx +96 -0
  51. data/ext/couchbase/io/retry_reason.hxx +235 -0
  52. data/ext/couchbase/io/retry_strategy.hxx +156 -0
  53. data/ext/couchbase/io/streams.hxx +165 -0
  54. data/ext/couchbase/mutation_token.hxx +1 -1
  55. data/ext/couchbase/operations.hxx +33 -1
  56. data/ext/couchbase/operations/analytics_dataset_create.hxx +117 -0
  57. data/ext/couchbase/operations/analytics_dataset_drop.hxx +103 -0
  58. data/ext/couchbase/operations/analytics_dataset_get_all.hxx +107 -0
  59. data/ext/couchbase/operations/analytics_dataverse_create.hxx +104 -0
  60. data/ext/couchbase/operations/analytics_dataverse_drop.hxx +104 -0
  61. data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +91 -0
  62. data/ext/couchbase/operations/analytics_index_create.hxx +128 -0
  63. data/ext/couchbase/operations/analytics_index_drop.hxx +110 -0
  64. data/ext/couchbase/operations/analytics_index_get_all.hxx +106 -0
  65. data/ext/couchbase/operations/analytics_link_connect.hxx +102 -0
  66. data/ext/couchbase/operations/analytics_link_disconnect.hxx +101 -0
  67. data/ext/couchbase/operations/bucket_create.hxx +5 -2
  68. data/ext/couchbase/operations/bucket_drop.hxx +5 -2
  69. data/ext/couchbase/operations/bucket_flush.hxx +5 -2
  70. data/ext/couchbase/operations/bucket_get.hxx +5 -2
  71. data/ext/couchbase/operations/bucket_get_all.hxx +5 -2
  72. data/ext/couchbase/operations/bucket_update.hxx +5 -2
  73. data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +5 -2
  74. data/ext/couchbase/operations/collection_create.hxx +10 -3
  75. data/ext/couchbase/operations/collection_drop.hxx +5 -2
  76. data/ext/couchbase/operations/design_document.hxx +59 -0
  77. data/ext/couchbase/operations/document_analytics.hxx +288 -0
  78. data/ext/couchbase/operations/document_decrement.hxx +11 -4
  79. data/ext/couchbase/operations/document_exists.hxx +5 -1
  80. data/ext/couchbase/operations/document_get.hxx +8 -1
  81. data/ext/couchbase/operations/document_get_and_lock.hxx +8 -1
  82. data/ext/couchbase/operations/document_get_and_touch.hxx +10 -3
  83. data/ext/couchbase/operations/document_get_projected.hxx +249 -0
  84. data/ext/couchbase/operations/document_increment.hxx +14 -5
  85. data/ext/couchbase/operations/document_insert.hxx +10 -3
  86. data/ext/couchbase/operations/document_lookup_in.hxx +27 -1
  87. data/ext/couchbase/operations/document_mutate_in.hxx +51 -2
  88. data/ext/couchbase/operations/document_query.hxx +31 -11
  89. data/ext/couchbase/operations/document_remove.hxx +8 -1
  90. data/ext/couchbase/operations/document_replace.hxx +10 -3
  91. data/ext/couchbase/operations/document_search.hxx +360 -0
  92. data/ext/couchbase/operations/document_touch.hxx +10 -3
  93. data/ext/couchbase/operations/document_unlock.hxx +8 -1
  94. data/ext/couchbase/operations/document_upsert.hxx +10 -3
  95. data/ext/couchbase/operations/document_view.hxx +228 -0
  96. data/ext/couchbase/operations/query_index_build_deferred.hxx +4 -3
  97. data/ext/couchbase/operations/query_index_create.hxx +18 -7
  98. data/ext/couchbase/operations/query_index_drop.hxx +16 -5
  99. data/ext/couchbase/operations/query_index_get_all.hxx +15 -5
  100. data/ext/couchbase/operations/scope_create.hxx +5 -2
  101. data/ext/couchbase/operations/scope_drop.hxx +5 -2
  102. data/ext/couchbase/operations/scope_get_all.hxx +6 -2
  103. data/ext/couchbase/operations/search_index.hxx +79 -0
  104. data/ext/couchbase/operations/search_index_analyze_document.hxx +92 -0
  105. data/ext/couchbase/operations/search_index_control_ingest.hxx +80 -0
  106. data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +80 -0
  107. data/ext/couchbase/operations/search_index_control_query.hxx +80 -0
  108. data/ext/couchbase/operations/search_index_drop.hxx +77 -0
  109. data/ext/couchbase/operations/search_index_get.hxx +80 -0
  110. data/ext/couchbase/operations/search_index_get_all.hxx +82 -0
  111. data/ext/couchbase/operations/search_index_get_documents_count.hxx +81 -0
  112. data/ext/couchbase/operations/search_index_upsert.hxx +106 -0
  113. data/ext/couchbase/operations/view_index_drop.hxx +67 -0
  114. data/ext/couchbase/operations/view_index_get.hxx +90 -0
  115. data/ext/couchbase/operations/view_index_get_all.hxx +125 -0
  116. data/ext/couchbase/operations/view_index_upsert.hxx +87 -0
  117. data/ext/couchbase/origin.hxx +178 -0
  118. data/ext/couchbase/platform/backtrace.c +189 -0
  119. data/ext/couchbase/platform/backtrace.h +54 -0
  120. data/ext/couchbase/platform/terminate_handler.cc +122 -0
  121. data/ext/couchbase/platform/terminate_handler.h +36 -0
  122. data/ext/couchbase/protocol/client_opcode.hxx +17 -3
  123. data/ext/couchbase/protocol/client_response.hxx +1 -1
  124. data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +1 -6
  125. data/ext/couchbase/protocol/cmd_decrement.hxx +5 -5
  126. data/ext/couchbase/protocol/cmd_get_and_touch.hxx +5 -5
  127. data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +7 -7
  128. data/ext/couchbase/protocol/cmd_get_collection_id.hxx +117 -0
  129. data/ext/couchbase/protocol/cmd_hello.hxx +10 -0
  130. data/ext/couchbase/protocol/cmd_increment.hxx +5 -5
  131. data/ext/couchbase/protocol/cmd_info.hxx +0 -11
  132. data/ext/couchbase/protocol/cmd_insert.hxx +5 -5
  133. data/ext/couchbase/protocol/cmd_lookup_in.hxx +1 -0
  134. data/ext/couchbase/protocol/cmd_mutate_in.hxx +53 -5
  135. data/ext/couchbase/protocol/cmd_replace.hxx +5 -5
  136. data/ext/couchbase/protocol/cmd_touch.hxx +1 -1
  137. data/ext/couchbase/protocol/cmd_upsert.hxx +5 -5
  138. data/ext/couchbase/protocol/status.hxx +14 -4
  139. data/ext/couchbase/service_type.hxx +38 -1
  140. data/ext/couchbase/timeout_defaults.hxx +41 -0
  141. data/ext/couchbase/utils/connection_string.hxx +370 -0
  142. data/ext/couchbase/version.hxx +2 -2
  143. data/ext/extconf.rb +60 -24
  144. data/ext/test/main.cxx +139 -22
  145. data/ext/third_party/http_parser/Makefile +160 -0
  146. data/ext/third_party/json/Makefile +77 -0
  147. data/lib/couchbase.rb +0 -1
  148. data/lib/couchbase/analytics_options.rb +177 -0
  149. data/lib/couchbase/authenticator.rb +14 -0
  150. data/lib/couchbase/binary_collection.rb +17 -13
  151. data/lib/couchbase/binary_collection_options.rb +14 -8
  152. data/lib/couchbase/bucket.rb +55 -3
  153. data/lib/couchbase/cluster.rb +219 -250
  154. data/lib/couchbase/collection.rb +67 -33
  155. data/lib/couchbase/collection_options.rb +95 -15
  156. data/lib/couchbase/common_options.rb +1 -1
  157. data/{bin/console → lib/couchbase/datastructures.rb} +4 -7
  158. data/lib/couchbase/datastructures/couchbase_list.rb +171 -0
  159. data/lib/couchbase/datastructures/couchbase_map.rb +205 -0
  160. data/lib/couchbase/datastructures/couchbase_queue.rb +145 -0
  161. data/lib/couchbase/datastructures/couchbase_set.rb +139 -0
  162. data/lib/couchbase/errors.rb +76 -66
  163. data/lib/couchbase/json_transcoder.rb +4 -4
  164. data/lib/couchbase/libcouchbase.bundle +0 -0
  165. data/lib/couchbase/management/analytics_index_manager.rb +139 -25
  166. data/lib/couchbase/management/bucket_manager.rb +19 -5
  167. data/lib/couchbase/management/collection_manager.rb +16 -7
  168. data/lib/couchbase/management/query_index_manager.rb +75 -20
  169. data/lib/couchbase/management/search_index_manager.rb +65 -15
  170. data/lib/couchbase/management/user_manager.rb +2 -2
  171. data/lib/couchbase/management/view_index_manager.rb +70 -11
  172. data/lib/couchbase/mutation_state.rb +13 -0
  173. data/lib/couchbase/query_options.rb +256 -0
  174. data/lib/couchbase/scope.rb +61 -8
  175. data/lib/couchbase/search_options.rb +1512 -0
  176. data/lib/couchbase/subdoc.rb +87 -23
  177. data/lib/couchbase/version.rb +2 -2
  178. data/lib/couchbase/view_options.rb +155 -0
  179. metadata +86 -781
  180. data/.github/workflows/tests-6.0.3.yml +0 -49
  181. data/.github/workflows/tests.yml +0 -47
  182. data/.gitignore +0 -20
  183. data/.gitmodules +0 -18
  184. data/.idea/.gitignore +0 -5
  185. data/.idea/dictionaries/gem_terms.xml +0 -18
  186. data/.idea/inspectionProfiles/Project_Default.xml +0 -8
  187. data/.idea/vcs.xml +0 -12
  188. data/bin/init-cluster +0 -62
  189. data/bin/setup +0 -24
  190. data/ext/couchbase/configuration_monitor.hxx +0 -93
  191. data/ext/couchbase/operations/command.hxx +0 -77
  192. data/ext/third_party/asio/asio/src/examples/cpp03/Makefile.am +0 -251
  193. data/ext/third_party/asio/asio/src/examples/cpp03/allocation/.gitignore +0 -10
  194. data/ext/third_party/asio/asio/src/examples/cpp03/allocation/server.cpp +0 -285
  195. data/ext/third_party/asio/asio/src/examples/cpp03/buffers/.gitignore +0 -10
  196. data/ext/third_party/asio/asio/src/examples/cpp03/buffers/reference_counted.cpp +0 -131
  197. data/ext/third_party/asio/asio/src/examples/cpp03/chat/.gitignore +0 -11
  198. data/ext/third_party/asio/asio/src/examples/cpp03/chat/chat_client.cpp +0 -177
  199. data/ext/third_party/asio/asio/src/examples/cpp03/chat/chat_message.hpp +0 -93
  200. data/ext/third_party/asio/asio/src/examples/cpp03/chat/chat_server.cpp +0 -249
  201. data/ext/third_party/asio/asio/src/examples/cpp03/chat/posix_chat_client.cpp +0 -204
  202. data/ext/third_party/asio/asio/src/examples/cpp03/echo/.gitignore +0 -11
  203. data/ext/third_party/asio/asio/src/examples/cpp03/echo/async_tcp_echo_server.cpp +0 -137
  204. data/ext/third_party/asio/asio/src/examples/cpp03/echo/async_udp_echo_server.cpp +0 -92
  205. data/ext/third_party/asio/asio/src/examples/cpp03/echo/blocking_tcp_echo_client.cpp +0 -59
  206. data/ext/third_party/asio/asio/src/examples/cpp03/echo/blocking_tcp_echo_server.cpp +0 -79
  207. data/ext/third_party/asio/asio/src/examples/cpp03/echo/blocking_udp_echo_client.cpp +0 -59
  208. data/ext/third_party/asio/asio/src/examples/cpp03/echo/blocking_udp_echo_server.cpp +0 -53
  209. data/ext/third_party/asio/asio/src/examples/cpp03/fork/.gitignore +0 -11
  210. data/ext/third_party/asio/asio/src/examples/cpp03/fork/daemon.cpp +0 -190
  211. data/ext/third_party/asio/asio/src/examples/cpp03/fork/process_per_connection.cpp +0 -161
  212. data/ext/third_party/asio/asio/src/examples/cpp03/http/client/.gitignore +0 -10
  213. data/ext/third_party/asio/asio/src/examples/cpp03/http/client/async_client.cpp +0 -204
  214. data/ext/third_party/asio/asio/src/examples/cpp03/http/client/sync_client.cpp +0 -106
  215. data/ext/third_party/asio/asio/src/examples/cpp03/http/doc_root/data_1K.html +0 -28
  216. data/ext/third_party/asio/asio/src/examples/cpp03/http/doc_root/data_2K.html +0 -49
  217. data/ext/third_party/asio/asio/src/examples/cpp03/http/doc_root/data_4K.html +0 -91
  218. data/ext/third_party/asio/asio/src/examples/cpp03/http/doc_root/data_8K.html +0 -175
  219. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/.gitignore +0 -11
  220. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/connection.cpp +0 -99
  221. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/connection.hpp +0 -83
  222. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/connection_manager.cpp +0 -38
  223. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/connection_manager.hpp +0 -44
  224. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/header.hpp +0 -28
  225. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/main.cpp +0 -44
  226. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/mime_types.cpp +0 -46
  227. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/mime_types.hpp +0 -27
  228. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/reply.cpp +0 -256
  229. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/reply.hpp +0 -64
  230. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/request.hpp +0 -34
  231. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/request_handler.cpp +0 -122
  232. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/request_handler.hpp +0 -46
  233. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/request_parser.cpp +0 -315
  234. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/request_parser.hpp +0 -95
  235. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/server.cpp +0 -94
  236. data/ext/third_party/asio/asio/src/examples/cpp03/http/server/server.hpp +0 -69
  237. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/.gitignore +0 -11
  238. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/connection.cpp +0 -93
  239. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/connection.hpp +0 -75
  240. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/header.hpp +0 -28
  241. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/io_context_pool.cpp +0 -69
  242. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/io_context_pool.hpp +0 -58
  243. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/main.cpp +0 -46
  244. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/mime_types.cpp +0 -46
  245. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/mime_types.hpp +0 -27
  246. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/reply.cpp +0 -256
  247. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/reply.hpp +0 -64
  248. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/request.hpp +0 -34
  249. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/request_handler.cpp +0 -122
  250. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/request_handler.hpp +0 -46
  251. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/request_parser.cpp +0 -315
  252. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/request_parser.hpp +0 -95
  253. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/server.cpp +0 -77
  254. data/ext/third_party/asio/asio/src/examples/cpp03/http/server2/server.hpp +0 -68
  255. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/.gitignore +0 -11
  256. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/connection.cpp +0 -94
  257. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/connection.hpp +0 -78
  258. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/header.hpp +0 -28
  259. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/main.cpp +0 -46
  260. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/mime_types.cpp +0 -46
  261. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/mime_types.hpp +0 -27
  262. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/reply.cpp +0 -256
  263. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/reply.hpp +0 -64
  264. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/request.hpp +0 -34
  265. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/request_handler.cpp +0 -122
  266. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/request_handler.hpp +0 -46
  267. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/request_parser.cpp +0 -315
  268. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/request_parser.hpp +0 -95
  269. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/server.cpp +0 -89
  270. data/ext/third_party/asio/asio/src/examples/cpp03/http/server3/server.hpp +0 -70
  271. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/.gitignore +0 -11
  272. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/file_handler.cpp +0 -122
  273. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/file_handler.hpp +0 -44
  274. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/header.hpp +0 -28
  275. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/main.cpp +0 -58
  276. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/mime_types.cpp +0 -46
  277. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/mime_types.hpp +0 -27
  278. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/reply.cpp +0 -256
  279. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/reply.hpp +0 -64
  280. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/request.hpp +0 -46
  281. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/request_parser.cpp +0 -226
  282. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/request_parser.hpp +0 -78
  283. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/server.cpp +0 -122
  284. data/ext/third_party/asio/asio/src/examples/cpp03/http/server4/server.hpp +0 -73
  285. data/ext/third_party/asio/asio/src/examples/cpp03/icmp/.gitignore +0 -10
  286. data/ext/third_party/asio/asio/src/examples/cpp03/icmp/icmp_header.hpp +0 -94
  287. data/ext/third_party/asio/asio/src/examples/cpp03/icmp/ipv4_header.hpp +0 -102
  288. data/ext/third_party/asio/asio/src/examples/cpp03/icmp/ping.cpp +0 -163
  289. data/ext/third_party/asio/asio/src/examples/cpp03/invocation/.gitignore +0 -10
  290. data/ext/third_party/asio/asio/src/examples/cpp03/invocation/prioritised_handlers.cpp +0 -171
  291. data/ext/third_party/asio/asio/src/examples/cpp03/iostreams/.gitignore +0 -11
  292. data/ext/third_party/asio/asio/src/examples/cpp03/iostreams/daytime_client.cpp +0 -44
  293. data/ext/third_party/asio/asio/src/examples/cpp03/iostreams/daytime_server.cpp +0 -51
  294. data/ext/third_party/asio/asio/src/examples/cpp03/iostreams/http_client.cpp +0 -91
  295. data/ext/third_party/asio/asio/src/examples/cpp03/local/.gitignore +0 -13
  296. data/ext/third_party/asio/asio/src/examples/cpp03/local/connect_pair.cpp +0 -141
  297. data/ext/third_party/asio/asio/src/examples/cpp03/local/iostream_client.cpp +0 -62
  298. data/ext/third_party/asio/asio/src/examples/cpp03/local/stream_client.cpp +0 -61
  299. data/ext/third_party/asio/asio/src/examples/cpp03/local/stream_server.cpp +0 -141
  300. data/ext/third_party/asio/asio/src/examples/cpp03/multicast/.gitignore +0 -11
  301. data/ext/third_party/asio/asio/src/examples/cpp03/multicast/receiver.cpp +0 -93
  302. data/ext/third_party/asio/asio/src/examples/cpp03/multicast/sender.cpp +0 -98
  303. data/ext/third_party/asio/asio/src/examples/cpp03/nonblocking/.gitignore +0 -10
  304. data/ext/third_party/asio/asio/src/examples/cpp03/nonblocking/third_party_lib.cpp +0 -240
  305. data/ext/third_party/asio/asio/src/examples/cpp03/porthopper/.gitignore +0 -11
  306. data/ext/third_party/asio/asio/src/examples/cpp03/porthopper/client.cpp +0 -192
  307. data/ext/third_party/asio/asio/src/examples/cpp03/porthopper/protocol.hpp +0 -156
  308. data/ext/third_party/asio/asio/src/examples/cpp03/porthopper/server.cpp +0 -187
  309. data/ext/third_party/asio/asio/src/examples/cpp03/serialization/.gitignore +0 -11
  310. data/ext/third_party/asio/asio/src/examples/cpp03/serialization/client.cpp +0 -125
  311. data/ext/third_party/asio/asio/src/examples/cpp03/serialization/connection.hpp +0 -188
  312. data/ext/third_party/asio/asio/src/examples/cpp03/serialization/server.cpp +0 -123
  313. data/ext/third_party/asio/asio/src/examples/cpp03/serialization/stock.hpp +0 -50
  314. data/ext/third_party/asio/asio/src/examples/cpp03/services/.gitignore +0 -11
  315. data/ext/third_party/asio/asio/src/examples/cpp03/services/basic_logger.hpp +0 -83
  316. data/ext/third_party/asio/asio/src/examples/cpp03/services/daytime_client.cpp +0 -97
  317. data/ext/third_party/asio/asio/src/examples/cpp03/services/logger.hpp +0 -24
  318. data/ext/third_party/asio/asio/src/examples/cpp03/services/logger_service.cpp +0 -11
  319. data/ext/third_party/asio/asio/src/examples/cpp03/services/logger_service.hpp +0 -145
  320. data/ext/third_party/asio/asio/src/examples/cpp03/socks4/.gitignore +0 -10
  321. data/ext/third_party/asio/asio/src/examples/cpp03/socks4/socks4.hpp +0 -144
  322. data/ext/third_party/asio/asio/src/examples/cpp03/socks4/sync_client.cpp +0 -94
  323. data/ext/third_party/asio/asio/src/examples/cpp03/spawn/.gitignore +0 -12
  324. data/ext/third_party/asio/asio/src/examples/cpp03/spawn/echo_server.cpp +0 -122
  325. data/ext/third_party/asio/asio/src/examples/cpp03/spawn/parallel_grep.cpp +0 -89
  326. data/ext/third_party/asio/asio/src/examples/cpp03/ssl/.gitignore +0 -11
  327. data/ext/third_party/asio/asio/src/examples/cpp03/ssl/README +0 -8
  328. data/ext/third_party/asio/asio/src/examples/cpp03/ssl/ca.pem +0 -49
  329. data/ext/third_party/asio/asio/src/examples/cpp03/ssl/client.cpp +0 -157
  330. data/ext/third_party/asio/asio/src/examples/cpp03/ssl/dh2048.pem +0 -8
  331. data/ext/third_party/asio/asio/src/examples/cpp03/ssl/server.cpp +0 -170
  332. data/ext/third_party/asio/asio/src/examples/cpp03/ssl/server.pem +0 -71
  333. data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/.gitignore +0 -11
  334. data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/async_tcp_client.cpp +0 -311
  335. data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/blocking_tcp_client.cpp +0 -191
  336. data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/blocking_token_tcp_client.cpp +0 -200
  337. data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/blocking_udp_client.cpp +0 -154
  338. data/ext/third_party/asio/asio/src/examples/cpp03/timeouts/server.cpp +0 -433
  339. data/ext/third_party/asio/asio/src/examples/cpp03/timers/.gitignore +0 -10
  340. data/ext/third_party/asio/asio/src/examples/cpp03/timers/time_t_timer.cpp +0 -106
  341. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime1/.gitignore +0 -10
  342. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime1/client.cpp +0 -57
  343. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime2/.gitignore +0 -10
  344. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime2/server.cpp +0 -50
  345. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime3/.gitignore +0 -10
  346. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime3/server.cpp +0 -119
  347. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime4/.gitignore +0 -10
  348. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime4/client.cpp +0 -52
  349. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime5/.gitignore +0 -10
  350. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime5/server.cpp +0 -53
  351. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime6/.gitignore +0 -10
  352. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime6/server.cpp +0 -89
  353. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime7/.gitignore +0 -10
  354. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime7/server.cpp +0 -160
  355. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/daytime_dox.txt +0 -500
  356. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/index_dox.txt +0 -48
  357. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer1/.gitignore +0 -10
  358. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer1/timer.cpp +0 -24
  359. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer2/.gitignore +0 -10
  360. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer2/timer.cpp +0 -29
  361. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer3/.gitignore +0 -10
  362. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer3/timer.cpp +0 -43
  363. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer4/.gitignore +0 -10
  364. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer4/timer.cpp +0 -54
  365. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer5/.gitignore +0 -10
  366. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer5/timer.cpp +0 -80
  367. data/ext/third_party/asio/asio/src/examples/cpp03/tutorial/timer_dox.txt +0 -378
  368. data/ext/third_party/asio/asio/src/examples/cpp03/windows/.gitignore +0 -10
  369. data/ext/third_party/asio/asio/src/examples/cpp03/windows/transmit_file.cpp +0 -177
  370. data/ext/third_party/asio/asio/src/examples/cpp11/Makefile.am +0 -161
  371. data/ext/third_party/asio/asio/src/examples/cpp11/allocation/.gitignore +0 -10
  372. data/ext/third_party/asio/asio/src/examples/cpp11/allocation/server.cpp +0 -255
  373. data/ext/third_party/asio/asio/src/examples/cpp11/buffers/.gitignore +0 -10
  374. data/ext/third_party/asio/asio/src/examples/cpp11/buffers/reference_counted.cpp +0 -122
  375. data/ext/third_party/asio/asio/src/examples/cpp11/chat/.gitignore +0 -11
  376. data/ext/third_party/asio/asio/src/examples/cpp11/chat/chat_client.cpp +0 -167
  377. data/ext/third_party/asio/asio/src/examples/cpp11/chat/chat_message.hpp +0 -91
  378. data/ext/third_party/asio/asio/src/examples/cpp11/chat/chat_server.cpp +0 -227
  379. data/ext/third_party/asio/asio/src/examples/cpp11/echo/.gitignore +0 -11
  380. data/ext/third_party/asio/asio/src/examples/cpp11/echo/async_tcp_echo_server.cpp +0 -114
  381. data/ext/third_party/asio/asio/src/examples/cpp11/echo/async_udp_echo_server.cpp +0 -82
  382. data/ext/third_party/asio/asio/src/examples/cpp11/echo/blocking_tcp_echo_client.cpp +0 -55
  383. data/ext/third_party/asio/asio/src/examples/cpp11/echo/blocking_tcp_echo_server.cpp +0 -74
  384. data/ext/third_party/asio/asio/src/examples/cpp11/echo/blocking_udp_echo_client.cpp +0 -58
  385. data/ext/third_party/asio/asio/src/examples/cpp11/echo/blocking_udp_echo_server.cpp +0 -52
  386. data/ext/third_party/asio/asio/src/examples/cpp11/executors/.gitignore +0 -5
  387. data/ext/third_party/asio/asio/src/examples/cpp11/executors/actor.cpp +0 -286
  388. data/ext/third_party/asio/asio/src/examples/cpp11/executors/bank_account_1.cpp +0 -54
  389. data/ext/third_party/asio/asio/src/examples/cpp11/executors/bank_account_2.cpp +0 -54
  390. data/ext/third_party/asio/asio/src/examples/cpp11/executors/fork_join.cpp +0 -328
  391. data/ext/third_party/asio/asio/src/examples/cpp11/executors/pipeline.cpp +0 -299
  392. data/ext/third_party/asio/asio/src/examples/cpp11/executors/priority_scheduler.cpp +0 -174
  393. data/ext/third_party/asio/asio/src/examples/cpp11/fork/.gitignore +0 -11
  394. data/ext/third_party/asio/asio/src/examples/cpp11/fork/daemon.cpp +0 -189
  395. data/ext/third_party/asio/asio/src/examples/cpp11/fork/process_per_connection.cpp +0 -162
  396. data/ext/third_party/asio/asio/src/examples/cpp11/futures/.gitignore +0 -11
  397. data/ext/third_party/asio/asio/src/examples/cpp11/futures/daytime_client.cpp +0 -94
  398. data/ext/third_party/asio/asio/src/examples/cpp11/handler_tracking/custom_tracking.hpp +0 -201
  399. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/.gitignore +0 -11
  400. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/connection.cpp +0 -94
  401. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/connection.hpp +0 -79
  402. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/connection_manager.cpp +0 -40
  403. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/connection_manager.hpp +0 -48
  404. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/header.hpp +0 -28
  405. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/main.cpp +0 -43
  406. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/mime_types.cpp +0 -45
  407. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/mime_types.hpp +0 -27
  408. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/reply.cpp +0 -255
  409. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/reply.hpp +0 -64
  410. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/request.hpp +0 -34
  411. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/request_handler.cpp +0 -121
  412. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/request_handler.hpp +0 -47
  413. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/request_parser.cpp +0 -315
  414. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/request_parser.hpp +0 -96
  415. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/server.cpp +0 -94
  416. data/ext/third_party/asio/asio/src/examples/cpp11/http/server/server.hpp +0 -64
  417. data/ext/third_party/asio/asio/src/examples/cpp11/invocation/.gitignore +0 -10
  418. data/ext/third_party/asio/asio/src/examples/cpp11/invocation/prioritised_handlers.cpp +0 -202
  419. data/ext/third_party/asio/asio/src/examples/cpp11/iostreams/.gitignore +0 -11
  420. data/ext/third_party/asio/asio/src/examples/cpp11/iostreams/http_client.cpp +0 -91
  421. data/ext/third_party/asio/asio/src/examples/cpp11/local/.gitignore +0 -13
  422. data/ext/third_party/asio/asio/src/examples/cpp11/local/connect_pair.cpp +0 -129
  423. data/ext/third_party/asio/asio/src/examples/cpp11/local/iostream_client.cpp +0 -61
  424. data/ext/third_party/asio/asio/src/examples/cpp11/local/stream_client.cpp +0 -60
  425. data/ext/third_party/asio/asio/src/examples/cpp11/local/stream_server.cpp +0 -121
  426. data/ext/third_party/asio/asio/src/examples/cpp11/multicast/.gitignore +0 -11
  427. data/ext/third_party/asio/asio/src/examples/cpp11/multicast/receiver.cpp +0 -88
  428. data/ext/third_party/asio/asio/src/examples/cpp11/multicast/sender.cpp +0 -91
  429. data/ext/third_party/asio/asio/src/examples/cpp11/nonblocking/.gitignore +0 -10
  430. data/ext/third_party/asio/asio/src/examples/cpp11/nonblocking/third_party_lib.cpp +0 -212
  431. data/ext/third_party/asio/asio/src/examples/cpp11/operations/.gitignore +0 -10
  432. data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_1.cpp +0 -113
  433. data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_2.cpp +0 -131
  434. data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_3.cpp +0 -192
  435. data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_4.cpp +0 -207
  436. data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_5.cpp +0 -243
  437. data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_6.cpp +0 -302
  438. data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_7.cpp +0 -222
  439. data/ext/third_party/asio/asio/src/examples/cpp11/operations/composed_8.cpp +0 -217
  440. data/ext/third_party/asio/asio/src/examples/cpp11/socks4/.gitignore +0 -10
  441. data/ext/third_party/asio/asio/src/examples/cpp11/socks4/socks4.hpp +0 -143
  442. data/ext/third_party/asio/asio/src/examples/cpp11/socks4/sync_client.cpp +0 -93
  443. data/ext/third_party/asio/asio/src/examples/cpp11/spawn/.gitignore +0 -12
  444. data/ext/third_party/asio/asio/src/examples/cpp11/spawn/echo_server.cpp +0 -111
  445. data/ext/third_party/asio/asio/src/examples/cpp11/spawn/parallel_grep.cpp +0 -84
  446. data/ext/third_party/asio/asio/src/examples/cpp11/ssl/.gitignore +0 -11
  447. data/ext/third_party/asio/asio/src/examples/cpp11/ssl/README +0 -8
  448. data/ext/third_party/asio/asio/src/examples/cpp11/ssl/ca.pem +0 -49
  449. data/ext/third_party/asio/asio/src/examples/cpp11/ssl/client.cpp +0 -165
  450. data/ext/third_party/asio/asio/src/examples/cpp11/ssl/dh2048.pem +0 -8
  451. data/ext/third_party/asio/asio/src/examples/cpp11/ssl/server.cpp +0 -143
  452. data/ext/third_party/asio/asio/src/examples/cpp11/ssl/server.pem +0 -71
  453. data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/.gitignore +0 -11
  454. data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/async_tcp_client.cpp +0 -311
  455. data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp +0 -192
  456. data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp +0 -197
  457. data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp +0 -155
  458. data/ext/third_party/asio/asio/src/examples/cpp11/timeouts/server.cpp +0 -433
  459. data/ext/third_party/asio/asio/src/examples/cpp11/timers/.gitignore +0 -10
  460. data/ext/third_party/asio/asio/src/examples/cpp11/timers/time_t_timer.cpp +0 -106
  461. data/ext/third_party/asio/asio/src/examples/cpp14/Makefile.am +0 -64
  462. data/ext/third_party/asio/asio/src/examples/cpp14/echo/.gitignore +0 -11
  463. data/ext/third_party/asio/asio/src/examples/cpp14/echo/async_tcp_echo_server.cpp +0 -117
  464. data/ext/third_party/asio/asio/src/examples/cpp14/echo/async_udp_echo_server.cpp +0 -83
  465. data/ext/third_party/asio/asio/src/examples/cpp14/echo/blocking_tcp_echo_client.cpp +0 -55
  466. data/ext/third_party/asio/asio/src/examples/cpp14/echo/blocking_tcp_echo_server.cpp +0 -77
  467. data/ext/third_party/asio/asio/src/examples/cpp14/echo/blocking_udp_echo_client.cpp +0 -59
  468. data/ext/third_party/asio/asio/src/examples/cpp14/echo/blocking_udp_echo_server.cpp +0 -53
  469. data/ext/third_party/asio/asio/src/examples/cpp14/executors/.gitignore +0 -6
  470. data/ext/third_party/asio/asio/src/examples/cpp14/executors/actor.cpp +0 -281
  471. data/ext/third_party/asio/asio/src/examples/cpp14/executors/async_1.cpp +0 -47
  472. data/ext/third_party/asio/asio/src/examples/cpp14/executors/async_2.cpp +0 -68
  473. data/ext/third_party/asio/asio/src/examples/cpp14/executors/bank_account_1.cpp +0 -54
  474. data/ext/third_party/asio/asio/src/examples/cpp14/executors/bank_account_2.cpp +0 -53
  475. data/ext/third_party/asio/asio/src/examples/cpp14/executors/fork_join.cpp +0 -327
  476. data/ext/third_party/asio/asio/src/examples/cpp14/executors/pipeline.cpp +0 -294
  477. data/ext/third_party/asio/asio/src/examples/cpp14/executors/priority_scheduler.cpp +0 -173
  478. data/ext/third_party/asio/asio/src/examples/cpp14/iostreams/.gitignore +0 -11
  479. data/ext/third_party/asio/asio/src/examples/cpp14/iostreams/http_client.cpp +0 -91
  480. data/ext/third_party/asio/asio/src/examples/cpp14/operations/.gitignore +0 -10
  481. data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_1.cpp +0 -113
  482. data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_2.cpp +0 -131
  483. data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_3.cpp +0 -186
  484. data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_4.cpp +0 -201
  485. data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_5.cpp +0 -238
  486. data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_6.cpp +0 -298
  487. data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_7.cpp +0 -219
  488. data/ext/third_party/asio/asio/src/examples/cpp14/operations/composed_8.cpp +0 -212
  489. data/ext/third_party/asio/asio/src/examples/cpp17/Makefile.am +0 -8
  490. data/ext/third_party/asio/asio/src/examples/cpp17/coroutines_ts/chat_server.cpp +0 -225
  491. data/ext/third_party/asio/asio/src/examples/cpp17/coroutines_ts/echo_server.cpp +0 -76
  492. data/ext/third_party/asio/asio/src/examples/cpp17/coroutines_ts/echo_server_with_default.cpp +0 -78
  493. data/ext/third_party/asio/asio/src/examples/cpp17/coroutines_ts/range_based_for.cpp +0 -107
  494. data/ext/third_party/asio/asio/src/examples/cpp17/coroutines_ts/refactored_echo_server.cpp +0 -85
  495. data/ext/third_party/asio/asio/src/tests/.gitignore +0 -11
  496. data/ext/third_party/asio/asio/src/tests/Makefile.am +0 -432
  497. data/ext/third_party/asio/asio/src/tests/latency/.gitignore +0 -11
  498. data/ext/third_party/asio/asio/src/tests/latency/allocator.hpp +0 -52
  499. data/ext/third_party/asio/asio/src/tests/latency/high_res_clock.hpp +0 -53
  500. data/ext/third_party/asio/asio/src/tests/latency/tcp_client.cpp +0 -124
  501. data/ext/third_party/asio/asio/src/tests/latency/tcp_server.cpp +0 -114
  502. data/ext/third_party/asio/asio/src/tests/latency/udp_client.cpp +0 -104
  503. data/ext/third_party/asio/asio/src/tests/latency/udp_server.cpp +0 -125
  504. data/ext/third_party/asio/asio/src/tests/performance/.gitignore +0 -11
  505. data/ext/third_party/asio/asio/src/tests/performance/client.cpp +0 -286
  506. data/ext/third_party/asio/asio/src/tests/performance/handler_allocator.hpp +0 -112
  507. data/ext/third_party/asio/asio/src/tests/performance/server.cpp +0 -233
  508. data/ext/third_party/asio/asio/src/tests/unit/.gitignore +0 -75
  509. data/ext/third_party/asio/asio/src/tests/unit/archetypes/async_ops.hpp +0 -415
  510. data/ext/third_party/asio/asio/src/tests/unit/archetypes/async_result.hpp +0 -94
  511. data/ext/third_party/asio/asio/src/tests/unit/archetypes/gettable_socket_option.hpp +0 -54
  512. data/ext/third_party/asio/asio/src/tests/unit/archetypes/io_control_command.hpp +0 -32
  513. data/ext/third_party/asio/asio/src/tests/unit/archetypes/settable_socket_option.hpp +0 -49
  514. data/ext/third_party/asio/asio/src/tests/unit/associated_allocator.cpp +0 -25
  515. data/ext/third_party/asio/asio/src/tests/unit/associated_executor.cpp +0 -25
  516. data/ext/third_party/asio/asio/src/tests/unit/async_result.cpp +0 -25
  517. data/ext/third_party/asio/asio/src/tests/unit/awaitable.cpp +0 -25
  518. data/ext/third_party/asio/asio/src/tests/unit/basic_datagram_socket.cpp +0 -25
  519. data/ext/third_party/asio/asio/src/tests/unit/basic_deadline_timer.cpp +0 -25
  520. data/ext/third_party/asio/asio/src/tests/unit/basic_raw_socket.cpp +0 -25
  521. data/ext/third_party/asio/asio/src/tests/unit/basic_seq_packet_socket.cpp +0 -25
  522. data/ext/third_party/asio/asio/src/tests/unit/basic_serial_port.cpp +0 -26
  523. data/ext/third_party/asio/asio/src/tests/unit/basic_signal_set.cpp +0 -25
  524. data/ext/third_party/asio/asio/src/tests/unit/basic_socket.cpp +0 -25
  525. data/ext/third_party/asio/asio/src/tests/unit/basic_socket_acceptor.cpp +0 -25
  526. data/ext/third_party/asio/asio/src/tests/unit/basic_stream_socket.cpp +0 -25
  527. data/ext/third_party/asio/asio/src/tests/unit/basic_streambuf.cpp +0 -25
  528. data/ext/third_party/asio/asio/src/tests/unit/basic_waitable_timer.cpp +0 -25
  529. data/ext/third_party/asio/asio/src/tests/unit/bind_executor.cpp +0 -25
  530. data/ext/third_party/asio/asio/src/tests/unit/buffer.cpp +0 -830
  531. data/ext/third_party/asio/asio/src/tests/unit/buffered_read_stream.cpp +0 -338
  532. data/ext/third_party/asio/asio/src/tests/unit/buffered_stream.cpp +0 -364
  533. data/ext/third_party/asio/asio/src/tests/unit/buffered_write_stream.cpp +0 -353
  534. data/ext/third_party/asio/asio/src/tests/unit/buffers_iterator.cpp +0 -292
  535. data/ext/third_party/asio/asio/src/tests/unit/co_spawn.cpp +0 -25
  536. data/ext/third_party/asio/asio/src/tests/unit/completion_condition.cpp +0 -25
  537. data/ext/third_party/asio/asio/src/tests/unit/compose.cpp +0 -185
  538. data/ext/third_party/asio/asio/src/tests/unit/connect.cpp +0 -1190
  539. data/ext/third_party/asio/asio/src/tests/unit/coroutine.cpp +0 -112
  540. data/ext/third_party/asio/asio/src/tests/unit/deadline_timer.cpp +0 -392
  541. data/ext/third_party/asio/asio/src/tests/unit/defer.cpp +0 -25
  542. data/ext/third_party/asio/asio/src/tests/unit/detached.cpp +0 -25
  543. data/ext/third_party/asio/asio/src/tests/unit/dispatch.cpp +0 -25
  544. data/ext/third_party/asio/asio/src/tests/unit/error.cpp +0 -89
  545. data/ext/third_party/asio/asio/src/tests/unit/execution_context.cpp +0 -25
  546. data/ext/third_party/asio/asio/src/tests/unit/executor.cpp +0 -25
  547. data/ext/third_party/asio/asio/src/tests/unit/executor_work_guard.cpp +0 -25
  548. data/ext/third_party/asio/asio/src/tests/unit/generic/.gitignore +0 -14
  549. data/ext/third_party/asio/asio/src/tests/unit/generic/basic_endpoint.cpp +0 -25
  550. data/ext/third_party/asio/asio/src/tests/unit/generic/datagram_protocol.cpp +0 -263
  551. data/ext/third_party/asio/asio/src/tests/unit/generic/raw_protocol.cpp +0 -263
  552. data/ext/third_party/asio/asio/src/tests/unit/generic/seq_packet_protocol.cpp +0 -205
  553. data/ext/third_party/asio/asio/src/tests/unit/generic/stream_protocol.cpp +0 -248
  554. data/ext/third_party/asio/asio/src/tests/unit/high_resolution_timer.cpp +0 -30
  555. data/ext/third_party/asio/asio/src/tests/unit/io_context.cpp +0 -362
  556. data/ext/third_party/asio/asio/src/tests/unit/io_context_strand.cpp +0 -325
  557. data/ext/third_party/asio/asio/src/tests/unit/ip/.gitignore +0 -27
  558. data/ext/third_party/asio/asio/src/tests/unit/ip/address.cpp +0 -144
  559. data/ext/third_party/asio/asio/src/tests/unit/ip/basic_endpoint.cpp +0 -25
  560. data/ext/third_party/asio/asio/src/tests/unit/ip/basic_resolver.cpp +0 -25
  561. data/ext/third_party/asio/asio/src/tests/unit/ip/basic_resolver_entry.cpp +0 -25
  562. data/ext/third_party/asio/asio/src/tests/unit/ip/basic_resolver_iterator.cpp +0 -25
  563. data/ext/third_party/asio/asio/src/tests/unit/ip/basic_resolver_query.cpp +0 -25
  564. data/ext/third_party/asio/asio/src/tests/unit/ip/host_name.cpp +0 -55
  565. data/ext/third_party/asio/asio/src/tests/unit/ip/icmp.cpp +0 -577
  566. data/ext/third_party/asio/asio/src/tests/unit/ip/multicast.cpp +0 -363
  567. data/ext/third_party/asio/asio/src/tests/unit/ip/network_v4.cpp +0 -314
  568. data/ext/third_party/asio/asio/src/tests/unit/ip/network_v6.cpp +0 -238
  569. data/ext/third_party/asio/asio/src/tests/unit/ip/resolver_query_base.cpp +0 -25
  570. data/ext/third_party/asio/asio/src/tests/unit/ip/tcp.cpp +0 -1346
  571. data/ext/third_party/asio/asio/src/tests/unit/ip/udp.cpp +0 -673
  572. data/ext/third_party/asio/asio/src/tests/unit/ip/unicast.cpp +0 -171
  573. data/ext/third_party/asio/asio/src/tests/unit/ip/v6_only.cpp +0 -135
  574. data/ext/third_party/asio/asio/src/tests/unit/is_read_buffered.cpp +0 -129
  575. data/ext/third_party/asio/asio/src/tests/unit/is_write_buffered.cpp +0 -129
  576. data/ext/third_party/asio/asio/src/tests/unit/local/.gitignore +0 -13
  577. data/ext/third_party/asio/asio/src/tests/unit/local/basic_endpoint.cpp +0 -25
  578. data/ext/third_party/asio/asio/src/tests/unit/local/connect_pair.cpp +0 -76
  579. data/ext/third_party/asio/asio/src/tests/unit/local/datagram_protocol.cpp +0 -242
  580. data/ext/third_party/asio/asio/src/tests/unit/local/stream_protocol.cpp +0 -219
  581. data/ext/third_party/asio/asio/src/tests/unit/packaged_task.cpp +0 -25
  582. data/ext/third_party/asio/asio/src/tests/unit/placeholders.cpp +0 -25
  583. data/ext/third_party/asio/asio/src/tests/unit/posix/.gitignore +0 -14
  584. data/ext/third_party/asio/asio/src/tests/unit/posix/basic_descriptor.cpp +0 -25
  585. data/ext/third_party/asio/asio/src/tests/unit/posix/basic_stream_descriptor.cpp +0 -25
  586. data/ext/third_party/asio/asio/src/tests/unit/posix/descriptor.cpp +0 -25
  587. data/ext/third_party/asio/asio/src/tests/unit/posix/descriptor_base.cpp +0 -25
  588. data/ext/third_party/asio/asio/src/tests/unit/posix/stream_descriptor.cpp +0 -183
  589. data/ext/third_party/asio/asio/src/tests/unit/post.cpp +0 -25
  590. data/ext/third_party/asio/asio/src/tests/unit/read.cpp +0 -4997
  591. data/ext/third_party/asio/asio/src/tests/unit/read_at.cpp +0 -7502
  592. data/ext/third_party/asio/asio/src/tests/unit/read_until.cpp +0 -1658
  593. data/ext/third_party/asio/asio/src/tests/unit/redirect_error.cpp +0 -25
  594. data/ext/third_party/asio/asio/src/tests/unit/serial_port.cpp +0 -173
  595. data/ext/third_party/asio/asio/src/tests/unit/serial_port_base.cpp +0 -99
  596. data/ext/third_party/asio/asio/src/tests/unit/signal_set.cpp +0 -95
  597. data/ext/third_party/asio/asio/src/tests/unit/socket_base.cpp +0 -650
  598. data/ext/third_party/asio/asio/src/tests/unit/ssl/.gitignore +0 -15
  599. data/ext/third_party/asio/asio/src/tests/unit/ssl/context.cpp +0 -25
  600. data/ext/third_party/asio/asio/src/tests/unit/ssl/context_base.cpp +0 -25
  601. data/ext/third_party/asio/asio/src/tests/unit/ssl/error.cpp +0 -25
  602. data/ext/third_party/asio/asio/src/tests/unit/ssl/host_name_verification.cpp +0 -25
  603. data/ext/third_party/asio/asio/src/tests/unit/ssl/rfc2818_verification.cpp +0 -25
  604. data/ext/third_party/asio/asio/src/tests/unit/ssl/stream.cpp +0 -191
  605. data/ext/third_party/asio/asio/src/tests/unit/ssl/stream_base.cpp +0 -25
  606. data/ext/third_party/asio/asio/src/tests/unit/steady_timer.cpp +0 -30
  607. data/ext/third_party/asio/asio/src/tests/unit/strand.cpp +0 -263
  608. data/ext/third_party/asio/asio/src/tests/unit/streambuf.cpp +0 -62
  609. data/ext/third_party/asio/asio/src/tests/unit/system_context.cpp +0 -30
  610. data/ext/third_party/asio/asio/src/tests/unit/system_executor.cpp +0 -30
  611. data/ext/third_party/asio/asio/src/tests/unit/system_timer.cpp +0 -399
  612. data/ext/third_party/asio/asio/src/tests/unit/this_coro.cpp +0 -25
  613. data/ext/third_party/asio/asio/src/tests/unit/thread.cpp +0 -25
  614. data/ext/third_party/asio/asio/src/tests/unit/time_traits.cpp +0 -25
  615. data/ext/third_party/asio/asio/src/tests/unit/ts/.gitignore +0 -17
  616. data/ext/third_party/asio/asio/src/tests/unit/ts/buffer.cpp +0 -30
  617. data/ext/third_party/asio/asio/src/tests/unit/ts/executor.cpp +0 -30
  618. data/ext/third_party/asio/asio/src/tests/unit/ts/internet.cpp +0 -30
  619. data/ext/third_party/asio/asio/src/tests/unit/ts/io_context.cpp +0 -30
  620. data/ext/third_party/asio/asio/src/tests/unit/ts/net.cpp +0 -30
  621. data/ext/third_party/asio/asio/src/tests/unit/ts/netfwd.cpp +0 -33
  622. data/ext/third_party/asio/asio/src/tests/unit/ts/socket.cpp +0 -30
  623. data/ext/third_party/asio/asio/src/tests/unit/ts/timer.cpp +0 -30
  624. data/ext/third_party/asio/asio/src/tests/unit/unit_test.hpp +0 -175
  625. data/ext/third_party/asio/asio/src/tests/unit/use_awaitable.cpp +0 -25
  626. data/ext/third_party/asio/asio/src/tests/unit/use_future.cpp +0 -670
  627. data/ext/third_party/asio/asio/src/tests/unit/uses_executor.cpp +0 -25
  628. data/ext/third_party/asio/asio/src/tests/unit/wait_traits.cpp +0 -25
  629. data/ext/third_party/asio/asio/src/tests/unit/windows/.gitignore +0 -18
  630. data/ext/third_party/asio/asio/src/tests/unit/windows/basic_object_handle.cpp +0 -25
  631. data/ext/third_party/asio/asio/src/tests/unit/windows/basic_overlapped_handle.cpp +0 -25
  632. data/ext/third_party/asio/asio/src/tests/unit/windows/basic_random_access_handle.cpp +0 -25
  633. data/ext/third_party/asio/asio/src/tests/unit/windows/basic_stream_handle.cpp +0 -25
  634. data/ext/third_party/asio/asio/src/tests/unit/windows/object_handle.cpp +0 -130
  635. data/ext/third_party/asio/asio/src/tests/unit/windows/overlapped_handle.cpp +0 -26
  636. data/ext/third_party/asio/asio/src/tests/unit/windows/overlapped_ptr.cpp +0 -107
  637. data/ext/third_party/asio/asio/src/tests/unit/windows/random_access_handle.cpp +0 -155
  638. data/ext/third_party/asio/asio/src/tests/unit/windows/stream_handle.cpp +0 -148
  639. data/ext/third_party/asio/asio/src/tests/unit/write.cpp +0 -4904
  640. data/ext/third_party/asio/asio/src/tests/unit/write_at.cpp +0 -7563
  641. data/ext/third_party/asio/asio/src/tools/handlerviz.pl +0 -299
  642. data/ext/third_party/gsl/tests/CMakeLists.txt +0 -267
  643. data/ext/third_party/gsl/tests/CMakeLists.txt.in +0 -14
  644. data/ext/third_party/gsl/tests/algorithm_tests.cpp +0 -227
  645. data/ext/third_party/gsl/tests/assertion_tests.cpp +0 -61
  646. data/ext/third_party/gsl/tests/at_tests.cpp +0 -135
  647. data/ext/third_party/gsl/tests/bounds_tests.cpp +0 -102
  648. data/ext/third_party/gsl/tests/byte_tests.cpp +0 -129
  649. data/ext/third_party/gsl/tests/multi_span_tests.cpp +0 -1866
  650. data/ext/third_party/gsl/tests/no_exception_ensure_tests.cpp +0 -48
  651. data/ext/third_party/gsl/tests/notnull_tests.cpp +0 -535
  652. data/ext/third_party/gsl/tests/owner_tests.cpp +0 -43
  653. data/ext/third_party/gsl/tests/span_compatibility_tests.cpp +0 -1021
  654. data/ext/third_party/gsl/tests/span_ext_tests.cpp +0 -360
  655. data/ext/third_party/gsl/tests/span_tests.cpp +0 -1244
  656. data/ext/third_party/gsl/tests/strict_notnull_tests.cpp +0 -190
  657. data/ext/third_party/gsl/tests/strided_span_tests.cpp +0 -790
  658. data/ext/third_party/gsl/tests/string_span_tests.cpp +0 -1217
  659. data/ext/third_party/gsl/tests/utils_tests.cpp +0 -129
  660. data/ext/third_party/http_parser/contrib/parsertrace.c +0 -157
  661. data/ext/third_party/http_parser/contrib/url_parser.c +0 -47
  662. data/ext/third_party/http_parser/fuzzers/fuzz_parser.c +0 -26
  663. data/ext/third_party/http_parser/fuzzers/fuzz_url.c +0 -14
  664. data/ext/third_party/json/contrib/nlohmann.cpp +0 -48
  665. data/ext/third_party/json/contrib/nlohmann/from_value.hpp +0 -62
  666. data/ext/third_party/json/contrib/nlohmann/json.hpp +0 -18928
  667. data/ext/third_party/json/contrib/nlohmann/to_value.hpp +0 -109
  668. data/ext/third_party/json/doc/Advanced-Use-Cases.md +0 -83
  669. data/ext/third_party/json/doc/Batteries-Included.md +0 -212
  670. data/ext/third_party/json/doc/Binding-Traits.md +0 -319
  671. data/ext/third_party/json/doc/Changelog.md +0 -31
  672. data/ext/third_party/json/doc/Common-Use-Cases.md +0 -148
  673. data/ext/third_party/json/doc/Design-Decisions.md +0 -36
  674. data/ext/third_party/json/doc/Events-Interface.md +0 -140
  675. data/ext/third_party/json/doc/Getting-Started.md +0 -19
  676. data/ext/third_party/json/doc/Instance-Sharing.md +0 -163
  677. data/ext/third_party/json/doc/Interoperability.md +0 -75
  678. data/ext/third_party/json/doc/Overview.md +0 -24
  679. data/ext/third_party/json/doc/Overview.png +0 -0
  680. data/ext/third_party/json/doc/Parser-Interface.md +0 -84
  681. data/ext/third_party/json/doc/README.md +0 -78
  682. data/ext/third_party/json/doc/Scratchpad.md +0 -25
  683. data/ext/third_party/json/doc/Type-Traits.md +0 -364
  684. data/ext/third_party/json/doc/Types.png +0 -0
  685. data/ext/third_party/json/doc/Value-Class.md +0 -525
  686. data/ext/third_party/json/src/example/json/CMakeLists.txt +0 -67
  687. data/ext/third_party/json/src/example/json/cbor_to_jaxn.cpp +0 -18
  688. data/ext/third_party/json/src/example/json/cbor_to_json.cpp +0 -18
  689. data/ext/third_party/json/src/example/json/cbor_to_msgpack.cpp +0 -18
  690. data/ext/third_party/json/src/example/json/cbor_to_pretty_jaxn.cpp +0 -18
  691. data/ext/third_party/json/src/example/json/cbor_to_pretty_json.cpp +0 -18
  692. data/ext/third_party/json/src/example/json/cbor_to_ubjson.cpp +0 -18
  693. data/ext/third_party/json/src/example/json/jaxn_to_cbor.cpp +0 -18
  694. data/ext/third_party/json/src/example/json/jaxn_to_cplusplus.cpp +0 -249
  695. data/ext/third_party/json/src/example/json/jaxn_to_jaxn.cpp +0 -18
  696. data/ext/third_party/json/src/example/json/jaxn_to_msgpack.cpp +0 -18
  697. data/ext/third_party/json/src/example/json/jaxn_to_pretty_jaxn.cpp +0 -18
  698. data/ext/third_party/json/src/example/json/jaxn_to_ubjson.cpp +0 -18
  699. data/ext/third_party/json/src/example/json/json_to_cbor.cpp +0 -18
  700. data/ext/third_party/json/src/example/json/json_to_json.cpp +0 -18
  701. data/ext/third_party/json/src/example/json/json_to_msgpack.cpp +0 -18
  702. data/ext/third_party/json/src/example/json/json_to_pretty_json.cpp +0 -18
  703. data/ext/third_party/json/src/example/json/json_to_ubjson.cpp +0 -18
  704. data/ext/third_party/json/src/example/json/msgpack_to_cbor.cpp +0 -18
  705. data/ext/third_party/json/src/example/json/msgpack_to_jaxn.cpp +0 -18
  706. data/ext/third_party/json/src/example/json/msgpack_to_json.cpp +0 -18
  707. data/ext/third_party/json/src/example/json/msgpack_to_pretty_jaxn.cpp +0 -18
  708. data/ext/third_party/json/src/example/json/msgpack_to_pretty_json.cpp +0 -18
  709. data/ext/third_party/json/src/example/json/msgpack_to_ubjson.cpp +0 -18
  710. data/ext/third_party/json/src/example/json/printf_doubles.cpp +0 -51
  711. data/ext/third_party/json/src/example/json/ubjson_to_cbor.cpp +0 -18
  712. data/ext/third_party/json/src/example/json/ubjson_to_jaxn.cpp +0 -18
  713. data/ext/third_party/json/src/example/json/ubjson_to_json.cpp +0 -18
  714. data/ext/third_party/json/src/example/json/ubjson_to_msgpack.cpp +0 -18
  715. data/ext/third_party/json/src/example/json/ubjson_to_pretty_jaxn.cpp +0 -18
  716. data/ext/third_party/json/src/example/json/ubjson_to_pretty_json.cpp +0 -18
  717. data/ext/third_party/json/src/example/json/validate_event_order.cpp +0 -27
  718. data/ext/third_party/json/src/example/json/validate_integer.cpp +0 -56
  719. data/ext/third_party/json/src/perf/json/bench_mark.hpp +0 -43
  720. data/ext/third_party/json/src/perf/json/benchmark.cpp +0 -34
  721. data/ext/third_party/json/src/perf/json/parse_file.cpp +0 -17
  722. data/ext/third_party/json/src/perf/json/pretty_print_file.cpp +0 -19
  723. data/ext/third_party/json/src/perf/json/print_double.cpp +0 -34
  724. data/ext/third_party/json/src/perf/json/print_file.cpp +0 -19
  725. data/ext/third_party/json/src/perf/json/sizes.cpp +0 -24
  726. data/ext/third_party/json/src/perf/json/syntax_only.cpp +0 -27
  727. data/ext/third_party/json/src/test/json/CMakeLists.txt +0 -97
  728. data/ext/third_party/json/src/test/json/big_list_of_naughty_strings.cpp +0 -43
  729. data/ext/third_party/json/src/test/json/binding_array.cpp +0 -549
  730. data/ext/third_party/json/src/test/json/binding_factory.cpp +0 -265
  731. data/ext/third_party/json/src/test/json/binding_object.cpp +0 -208
  732. data/ext/third_party/json/src/test/json/binding_versions.cpp +0 -95
  733. data/ext/third_party/json/src/test/json/cbor.cpp +0 -149
  734. data/ext/third_party/json/src/test/json/cbor_parts_parser.cpp +0 -36
  735. data/ext/third_party/json/src/test/json/contrib_diff.cpp +0 -43
  736. data/ext/third_party/json/src/test/json/contrib_get.cpp +0 -42
  737. data/ext/third_party/json/src/test/json/contrib_patch_add.cpp +0 -75
  738. data/ext/third_party/json/src/test/json/contrib_patch_copy.cpp +0 -113
  739. data/ext/third_party/json/src/test/json/contrib_patch_move.cpp +0 -97
  740. data/ext/third_party/json/src/test/json/contrib_patch_remove.cpp +0 -85
  741. data/ext/third_party/json/src/test/json/contrib_patch_replace.cpp +0 -79
  742. data/ext/third_party/json/src/test/json/contrib_patch_test.cpp +0 -69
  743. data/ext/third_party/json/src/test/json/contrib_position.cpp +0 -48
  744. data/ext/third_party/json/src/test/json/contrib_reference.cpp +0 -44
  745. data/ext/third_party/json/src/test/json/contrib_schema.cpp +0 -132
  746. data/ext/third_party/json/src/test/json/contrib_traits.cpp +0 -258
  747. data/ext/third_party/json/src/test/json/double.cpp +0 -182
  748. data/ext/third_party/json/src/test/json/enable_implicit_constructor.cpp +0 -54
  749. data/ext/third_party/json/src/test/json/escape.cpp +0 -42
  750. data/ext/third_party/json/src/test/json/events_binary_to.cpp +0 -56
  751. data/ext/third_party/json/src/test/json/events_compare.cpp +0 -433
  752. data/ext/third_party/json/src/test/json/events_debug.cpp +0 -24
  753. data/ext/third_party/json/src/test/json/events_hash.cpp +0 -65
  754. data/ext/third_party/json/src/test/json/events_to_stream.cpp +0 -28
  755. data/ext/third_party/json/src/test/json/events_to_string.cpp +0 -25
  756. data/ext/third_party/json/src/test/json/include_json.cpp +0 -14
  757. data/ext/third_party/json/src/test/json/integer.cpp +0 -118
  758. data/ext/third_party/json/src/test/json/jaxn_ostream.cpp +0 -76
  759. data/ext/third_party/json/src/test/json/jaxn_parse.cpp +0 -239
  760. data/ext/third_party/json/src/test/json/jaxn_parts_parser.cpp +0 -220
  761. data/ext/third_party/json/src/test/json/json_ostream.cpp +0 -102
  762. data/ext/third_party/json/src/test/json/json_parse.cpp +0 -153
  763. data/ext/third_party/json/src/test/json/json_parts_parser.cpp +0 -124
  764. data/ext/third_party/json/src/test/json/json_pointer.cpp +0 -176
  765. data/ext/third_party/json/src/test/json/key_camel_case_to_snake_case.cpp +0 -38
  766. data/ext/third_party/json/src/test/json/key_snake_case_to_camel_case.cpp +0 -33
  767. data/ext/third_party/json/src/test/json/literal.cpp +0 -18
  768. data/ext/third_party/json/src/test/json/main.hpp +0 -20
  769. data/ext/third_party/json/src/test/json/make_events.hpp +0 -362
  770. data/ext/third_party/json/src/test/json/msgpack.cpp +0 -136
  771. data/ext/third_party/json/src/test/json/object_construction.cpp +0 -167
  772. data/ext/third_party/json/src/test/json/opaque_pointer.cpp +0 -192
  773. data/ext/third_party/json/src/test/json/operators.cpp +0 -494
  774. data/ext/third_party/json/src/test/json/optional.cpp +0 -79
  775. data/ext/third_party/json/src/test/json/public_base.cpp +0 -142
  776. data/ext/third_party/json/src/test/json/self_contained.cpp +0 -106
  777. data/ext/third_party/json/src/test/json/sha256.cpp +0 -38
  778. data/ext/third_party/json/src/test/json/string_view.cpp +0 -70
  779. data/ext/third_party/json/src/test/json/temporary_parsing.cpp +0 -339
  780. data/ext/third_party/json/src/test/json/test.hpp +0 -74
  781. data/ext/third_party/json/src/test/json/test_events.hpp +0 -250
  782. data/ext/third_party/json/src/test/json/test_types.hpp +0 -557
  783. data/ext/third_party/json/src/test/json/test_unhex.hpp +0 -42
  784. data/ext/third_party/json/src/test/json/type.cpp +0 -35
  785. data/ext/third_party/json/src/test/json/ubjson.cpp +0 -119
  786. data/ext/third_party/json/src/test/json/uri_fragment.cpp +0 -52
  787. data/ext/third_party/json/src/test/json/validate_event_interfaces.cpp +0 -177
  788. data/ext/third_party/json/src/test/json/validate_utf8.cpp +0 -37
  789. data/ext/third_party/json/src/test/json/value_access.cpp +0 -144
  790. data/ext/third_party/json/src/test/json/value_basics.cpp +0 -241
  791. data/ext/third_party/json/src/test/json/value_create.cpp +0 -372
  792. data/ext/third_party/json/src/test/json/value_ptr.cpp +0 -33
  793. data/ext/third_party/json/src/test/json/value_subscript.cpp +0 -89
  794. data/ext/third_party/json/src/test/json/with_arguments.cpp +0 -98
  795. data/ext/third_party/json/tests/blns.json +0 -496
  796. data/ext/third_party/json/tests/canada.json +0 -9
  797. data/ext/third_party/json/tests/citm_catalog.json +0 -50469
  798. data/ext/third_party/json/tests/draft4/additionalItems.json +0 -82
  799. data/ext/third_party/json/tests/draft4/additionalProperties.json +0 -88
  800. data/ext/third_party/json/tests/draft4/allOf.json +0 -112
  801. data/ext/third_party/json/tests/draft4/anyOf.json +0 -68
  802. data/ext/third_party/json/tests/draft4/default.json +0 -49
  803. data/ext/third_party/json/tests/draft4/definitions.json +0 -32
  804. data/ext/third_party/json/tests/draft4/dependencies.json +0 -113
  805. data/ext/third_party/json/tests/draft4/enum.json +0 -72
  806. data/ext/third_party/json/tests/draft4/items.json +0 -46
  807. data/ext/third_party/json/tests/draft4/maxItems.json +0 -28
  808. data/ext/third_party/json/tests/draft4/maxLength.json +0 -33
  809. data/ext/third_party/json/tests/draft4/maxProperties.json +0 -28
  810. data/ext/third_party/json/tests/draft4/maximum.json +0 -42
  811. data/ext/third_party/json/tests/draft4/minItems.json +0 -28
  812. data/ext/third_party/json/tests/draft4/minLength.json +0 -33
  813. data/ext/third_party/json/tests/draft4/minProperties.json +0 -28
  814. data/ext/third_party/json/tests/draft4/minimum.json +0 -42
  815. data/ext/third_party/json/tests/draft4/multipleOf.json +0 -60
  816. data/ext/third_party/json/tests/draft4/not.json +0 -96
  817. data/ext/third_party/json/tests/draft4/oneOf.json +0 -68
  818. data/ext/third_party/json/tests/draft4/optional/bignum.json +0 -107
  819. data/ext/third_party/json/tests/draft4/optional/format.json +0 -148
  820. data/ext/third_party/json/tests/draft4/optional/zeroTerminatedFloats.json +0 -15
  821. data/ext/third_party/json/tests/draft4/pattern.json +0 -34
  822. data/ext/third_party/json/tests/draft4/patternProperties.json +0 -110
  823. data/ext/third_party/json/tests/draft4/properties.json +0 -92
  824. data/ext/third_party/json/tests/draft4/ref.json +0 -179
  825. data/ext/third_party/json/tests/draft4/refRemote.json +0 -74
  826. data/ext/third_party/json/tests/draft4/required.json +0 -44
  827. data/ext/third_party/json/tests/draft4/type.json +0 -345
  828. data/ext/third_party/json/tests/draft4/uniqueItems.json +0 -79
  829. data/ext/third_party/json/tests/taocpp/binary.jaxn +0 -4
  830. data/ext/third_party/json/tests/taocpp/dateTime.json +0 -108
  831. data/ext/third_party/json/tests/taocpp/make_events.cbor +0 -0
  832. data/ext/third_party/json/tests/taocpp/number.json +0 -682
  833. data/ext/third_party/json/tests/taocpp/position.json +0 -8
  834. data/ext/third_party/json/tests/taocpp/schema.json +0 -378
  835. data/ext/third_party/json/tests/twitter.json +0 -15482
  836. data/ext/third_party/snappy/testdata/alice29.txt +0 -3609
  837. data/ext/third_party/snappy/testdata/asyoulik.txt +0 -4122
  838. data/ext/third_party/snappy/testdata/baddata1.snappy +0 -0
  839. data/ext/third_party/snappy/testdata/baddata2.snappy +0 -0
  840. data/ext/third_party/snappy/testdata/baddata3.snappy +0 -0
  841. data/ext/third_party/snappy/testdata/fireworks.jpeg +0 -0
  842. data/ext/third_party/snappy/testdata/geo.protodata +0 -0
  843. data/ext/third_party/snappy/testdata/html +0 -1
  844. data/ext/third_party/snappy/testdata/html_x_4 +0 -1
  845. data/ext/third_party/snappy/testdata/kppkn.gtb +0 -0
  846. data/ext/third_party/snappy/testdata/lcet10.txt +0 -7519
  847. data/ext/third_party/snappy/testdata/paper-100k.pdf +2 -600
  848. data/ext/third_party/snappy/testdata/plrabn12.txt +0 -10699
  849. data/ext/third_party/snappy/testdata/urls.10K +0 -10000
  850. data/ext/third_party/spdlog/bench/CMakeLists.txt +0 -25
  851. data/ext/third_party/spdlog/bench/async_bench.cpp +0 -179
  852. data/ext/third_party/spdlog/bench/bench.cpp +0 -238
  853. data/ext/third_party/spdlog/bench/formatter-bench.cpp +0 -80
  854. data/ext/third_party/spdlog/bench/latency.cpp +0 -166
  855. data/ext/third_party/spdlog/bench/utils.h +0 -34
  856. data/ext/third_party/spdlog/example/CMakeLists.txt +0 -23
  857. data/ext/third_party/spdlog/example/example.cpp +0 -282
  858. data/ext/third_party/spdlog/logos/jetbrains-variant-4.svg +0 -43
  859. data/ext/third_party/spdlog/scripts/extract_version.py +0 -17
  860. data/ext/third_party/spdlog/scripts/format.sh +0 -16
  861. data/ext/third_party/spdlog/tests/CMakeLists.txt +0 -70
  862. data/ext/third_party/spdlog/tests/catch.hpp +0 -15372
  863. data/ext/third_party/spdlog/tests/catch.license +0 -23
  864. data/ext/third_party/spdlog/tests/includes.h +0 -26
  865. data/ext/third_party/spdlog/tests/main.cpp +0 -2
  866. data/ext/third_party/spdlog/tests/test_async.cpp +0 -188
  867. data/ext/third_party/spdlog/tests/test_backtrace.cpp +0 -65
  868. data/ext/third_party/spdlog/tests/test_cfg.cpp +0 -93
  869. data/ext/third_party/spdlog/tests/test_create_dir.cpp +0 -80
  870. data/ext/third_party/spdlog/tests/test_daily_logger.cpp +0 -149
  871. data/ext/third_party/spdlog/tests/test_dup_filter.cpp +0 -88
  872. data/ext/third_party/spdlog/tests/test_errors.cpp +0 -118
  873. data/ext/third_party/spdlog/tests/test_eventlog.cpp +0 -71
  874. data/ext/third_party/spdlog/tests/test_file_helper.cpp +0 -102
  875. data/ext/third_party/spdlog/tests/test_file_logging.cpp +0 -98
  876. data/ext/third_party/spdlog/tests/test_fmt_helper.cpp +0 -86
  877. data/ext/third_party/spdlog/tests/test_macros.cpp +0 -60
  878. data/ext/third_party/spdlog/tests/test_misc.cpp +0 -271
  879. data/ext/third_party/spdlog/tests/test_mpmc_q.cpp +0 -106
  880. data/ext/third_party/spdlog/tests/test_pattern_formatter.cpp +0 -443
  881. data/ext/third_party/spdlog/tests/test_registry.cpp +0 -116
  882. data/ext/third_party/spdlog/tests/test_sink.h +0 -79
  883. data/ext/third_party/spdlog/tests/test_stdout_api.cpp +0 -98
  884. data/ext/third_party/spdlog/tests/test_systemd.cpp +0 -15
  885. data/ext/third_party/spdlog/tests/test_time_point.cpp +0 -36
  886. data/ext/third_party/spdlog/tests/utils.cpp +0 -125
  887. data/ext/third_party/spdlog/tests/utils.h +0 -18
  888. data/rbi/couchbase.rbi +0 -79
@@ -0,0 +1,237 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2020 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
+
18
+ #pragma once
19
+
20
+ #include <io/mcbp_session.hxx>
21
+ #include <io/retry_orchestrator.hxx>
22
+
23
+ #include <protocol/cmd_get_collection_id.hxx>
24
+ #include <functional>
25
+ #include <utility>
26
+
27
+ namespace couchbase::operations
28
+ {
29
+
30
+ using mcbp_command_handler = std::function<void(std::error_code, std::optional<io::mcbp_message>)>;
31
+
32
+ template<typename Manager, typename Request>
33
+ struct mcbp_command : public std::enable_shared_from_this<mcbp_command<Manager, Request>> {
34
+ using encoded_request_type = typename Request::encoded_request_type;
35
+ using encoded_response_type = typename Request::encoded_response_type;
36
+ asio::steady_timer deadline;
37
+ asio::steady_timer retry_backoff;
38
+ Request request;
39
+ encoded_request_type encoded;
40
+ std::optional<std::uint32_t> opaque_{};
41
+ std::shared_ptr<io::mcbp_session> session_{};
42
+ mcbp_command_handler handler_{};
43
+ std::shared_ptr<Manager> manager_{};
44
+
45
+ mcbp_command(asio::io_context& ctx, std::shared_ptr<Manager> manager, Request req)
46
+ : deadline(ctx)
47
+ , retry_backoff(ctx)
48
+ , request(req)
49
+ , manager_(manager)
50
+ {
51
+ }
52
+
53
+ void start(mcbp_command_handler&& handler)
54
+ {
55
+ handler_ = handler;
56
+ deadline.expires_after(request.timeout);
57
+ deadline.async_wait([self = this->shared_from_this()](std::error_code ec) {
58
+ if (ec == asio::error::operation_aborted) {
59
+ return;
60
+ }
61
+ self->cancel(io::retry_reason::do_not_retry);
62
+ });
63
+ }
64
+
65
+ void cancel(io::retry_reason reason)
66
+ {
67
+ if (opaque_ && session_) {
68
+ if (session_->cancel(opaque_.value(), asio::error::operation_aborted, reason)) {
69
+ handler_ = nullptr;
70
+ }
71
+ }
72
+ invoke_handler(std::make_error_code(request.retries.idempotent ? error::common_errc::unambiguous_timeout
73
+ : error::common_errc::ambiguous_timeout));
74
+ retry_backoff.cancel();
75
+ deadline.cancel();
76
+ }
77
+
78
+ void invoke_handler(std::error_code ec, std::optional<io::mcbp_message> msg = {})
79
+ {
80
+ if (handler_) {
81
+ handler_(ec, std::move(msg));
82
+ }
83
+ handler_ = nullptr;
84
+ }
85
+
86
+ void request_collection_id()
87
+ {
88
+ protocol::client_request<protocol::get_collection_id_request_body> req;
89
+ req.opaque(session_->next_opaque());
90
+ req.body().collection_path(request.id.collection);
91
+ session_->write_and_subscribe(
92
+ req.opaque(),
93
+ req.data(session_->supports_feature(protocol::hello_feature::snappy)),
94
+ [self = this->shared_from_this()](std::error_code ec, io::retry_reason /* reason */, io::mcbp_message&& msg) mutable {
95
+ if (ec == asio::error::operation_aborted) {
96
+ return self->invoke_handler(std::make_error_code(error::common_errc::ambiguous_timeout));
97
+ }
98
+ if (ec == std::make_error_code(error::common_errc::collection_not_found)) {
99
+ if (self->request.id.collection_uid) {
100
+ return self->handle_unknown_collection();
101
+ }
102
+ return self->invoke_handler(ec);
103
+ }
104
+ if (ec) {
105
+ return self->invoke_handler(ec);
106
+ }
107
+ protocol::client_response<protocol::get_collection_id_response_body> resp(msg);
108
+ self->session_->update_collection_uid(self->request.id.collection, resp.body().collection_uid());
109
+ self->request.id.collection_uid = resp.body().collection_uid();
110
+ return self->send();
111
+ });
112
+ }
113
+
114
+ void handle_unknown_collection()
115
+ {
116
+ auto backoff = std::chrono::milliseconds(500);
117
+ auto time_left = deadline.expiry() - std::chrono::steady_clock::now();
118
+ spdlog::debug("{} unknown collection response for \"{}/{}/{}\", time_left={}ms",
119
+ session_->log_prefix(),
120
+ request.id.bucket,
121
+ request.id.collection,
122
+ request.id.key,
123
+ std::chrono::duration_cast<std::chrono::milliseconds>(time_left).count());
124
+ if (time_left < backoff) {
125
+ return invoke_handler(std::make_error_code(request.retries.idempotent ? error::common_errc::unambiguous_timeout
126
+ : error::common_errc::ambiguous_timeout));
127
+ }
128
+ retry_backoff.expires_after(backoff);
129
+ retry_backoff.async_wait([self = this->shared_from_this()](std::error_code ec) mutable {
130
+ if (ec == asio::error::operation_aborted) {
131
+ return;
132
+ }
133
+ self->request_collection_id();
134
+ });
135
+ }
136
+
137
+ void send()
138
+ {
139
+ opaque_ = session_->next_opaque();
140
+ request.opaque = *opaque_;
141
+ if (!request.id.collection_uid) {
142
+ if (session_->supports_feature(protocol::hello_feature::collections)) {
143
+ auto collection_id = session_->get_collection_uid(request.id.collection);
144
+ if (collection_id) {
145
+ request.id.collection_uid = *collection_id;
146
+ } else {
147
+ spdlog::debug("{} no cache entry for collection, resolve collection id for \"{}/{}/{}\", timeout={}ms",
148
+ session_->log_prefix(),
149
+ request.id.bucket,
150
+ request.id.collection,
151
+ request.id.key,
152
+ request.timeout.count());
153
+ return request_collection_id();
154
+ }
155
+ } else {
156
+ if (!request.id.collection.empty() && request.id.collection != "_default._default") {
157
+ return invoke_handler(std::make_error_code(error::common_errc::unsupported_operation));
158
+ }
159
+ }
160
+ }
161
+ request.encode_to(encoded);
162
+
163
+ session_->write_and_subscribe(
164
+ request.opaque,
165
+ encoded.data(session_->supports_feature(protocol::hello_feature::snappy)),
166
+ [self = this->shared_from_this()](std::error_code ec, io::retry_reason reason, io::mcbp_message&& msg) mutable {
167
+ self->retry_backoff.cancel();
168
+ if (ec == asio::error::operation_aborted) {
169
+ return self->invoke_handler(std::make_error_code(
170
+ self->request.retries.idempotent ? error::common_errc::unambiguous_timeout : error::common_errc::ambiguous_timeout));
171
+ }
172
+ if (ec == std::make_error_code(error::common_errc::request_canceled)) {
173
+ if (reason == io::retry_reason::do_not_retry) {
174
+ return self->invoke_handler(ec);
175
+ }
176
+ return io::retry_orchestrator::maybe_retry(self->manager_, self, reason, ec);
177
+ }
178
+ protocol::status status = protocol::status::invalid;
179
+ std::optional<error_map::error_info> error_code{};
180
+ if (protocol::is_valid_status(msg.header.status())) {
181
+ status = static_cast<protocol::status>(msg.header.status());
182
+ } else {
183
+ error_code = self->session_->decode_error_code(msg.header.status());
184
+ }
185
+ if (status == protocol::status::not_my_vbucket) {
186
+ self->session_->handle_not_my_vbucket(std::move(msg));
187
+ return io::retry_orchestrator::maybe_retry(self->manager_, self, io::retry_reason::kv_not_my_vbucket, ec);
188
+ }
189
+ if (status == protocol::status::unknown_collection) {
190
+ return self->handle_unknown_collection();
191
+ }
192
+ if (error_code && error_code.value().has_retry_attribute()) {
193
+ reason = io::retry_reason::kv_error_map_retry_indicated;
194
+ } else {
195
+ switch (status) {
196
+ case protocol::status::locked:
197
+ if (encoded_request_type::body_type::opcode != protocol::client_opcode::unlock) {
198
+ /**
199
+ * special case for unlock command, when it should not be retried, because it does not make sense
200
+ * (someone else unlocked the document)
201
+ */
202
+ reason = io::retry_reason::kv_locked;
203
+ }
204
+ break;
205
+ case protocol::status::temporary_failure:
206
+ reason = io::retry_reason::kv_temporary_failure;
207
+ break;
208
+ case protocol::status::sync_write_in_progress:
209
+ reason = io::retry_reason::kv_sync_write_in_progress;
210
+ break;
211
+ case protocol::status::sync_write_re_commit_in_progress:
212
+ reason = io::retry_reason::kv_sync_write_re_commit_in_progress;
213
+ break;
214
+ default:
215
+ break;
216
+ }
217
+ }
218
+ if (reason == io::retry_reason::do_not_retry) {
219
+ self->deadline.cancel();
220
+ self->invoke_handler(ec, msg);
221
+ } else {
222
+ io::retry_orchestrator::maybe_retry(self->manager_, self, reason, ec);
223
+ }
224
+ });
225
+ }
226
+
227
+ void send_to(std::shared_ptr<io::mcbp_session> session)
228
+ {
229
+ if (!handler_) {
230
+ return;
231
+ }
232
+ session_ = std::move(session);
233
+ send();
234
+ }
235
+ };
236
+
237
+ } // namespace couchbase::operations
@@ -19,8 +19,17 @@
19
19
 
20
20
  #include <cstdint>
21
21
  #include <vector>
22
+ #include <array>
22
23
 
23
- namespace couchbase::io
24
+ namespace couchbase
25
+ {
26
+ namespace protocol
27
+ {
28
+ static const size_t header_size = 24;
29
+ using header_buffer = std::array<std::uint8_t, header_size>;
30
+ } // namespace protocol
31
+
32
+ namespace io
24
33
  {
25
34
  struct binary_header {
26
35
  std::uint8_t magic;
@@ -32,10 +41,23 @@ struct binary_header {
32
41
  std::uint32_t bodylen;
33
42
  std::uint32_t opaque;
34
43
  std::uint64_t cas;
44
+
45
+ std::uint16_t status()
46
+ {
47
+ return htons(specific);
48
+ }
35
49
  };
36
50
 
37
51
  struct mcbp_message {
38
52
  binary_header header;
39
53
  std::vector<std::uint8_t> body;
54
+
55
+ protocol::header_buffer header_data()
56
+ {
57
+ protocol::header_buffer buf;
58
+ std::memcpy(buf.data(), &header, sizeof(header));
59
+ return buf;
60
+ }
40
61
  };
41
- } // namespace couchbase::io
62
+ } // namespace io
63
+ } // namespace couchbase
@@ -73,6 +73,8 @@ struct mcbp_parser {
73
73
  if (success) {
74
74
  std::copy(uncompressed.begin(), uncompressed.end(), std::back_inserter(msg.body));
75
75
  use_raw_value = false;
76
+ // patch header with new body size
77
+ msg.header.bodylen = htonl(static_cast<std::uint32_t>(prefix_size + uncompressed.size()));
76
78
  }
77
79
  }
78
80
  if (use_raw_value) {
@@ -27,6 +27,10 @@
27
27
 
28
28
  #include <io/mcbp_message.hxx>
29
29
  #include <io/mcbp_parser.hxx>
30
+ #include <io/streams.hxx>
31
+ #include <io/retry_orchestrator.hxx>
32
+
33
+ #include <timeout_defaults.hxx>
30
34
 
31
35
  #include <protocol/hello_feature.hxx>
32
36
  #include <protocol/client_request.hxx>
@@ -39,7 +43,6 @@
39
43
  #include <protocol/cmd_select_bucket.hxx>
40
44
  #include <protocol/cmd_get_cluster_config.hxx>
41
45
  #include <protocol/cmd_get_error_map.hxx>
42
- #include <protocol/cmd_get_collections_manifest.hxx>
43
46
  #include <protocol/cmd_get.hxx>
44
47
  #include <protocol/cmd_cluster_map_change_notification.hxx>
45
48
 
@@ -47,6 +50,7 @@
47
50
 
48
51
  #include <spdlog/fmt/bin_to_hex.h>
49
52
 
53
+ #include <origin.hxx>
50
54
  #include <errors.hxx>
51
55
  #include <version.hxx>
52
56
 
@@ -55,6 +59,35 @@ namespace couchbase::io
55
59
 
56
60
  class mcbp_session : public std::enable_shared_from_this<mcbp_session>
57
61
  {
62
+ class collection_cache
63
+ {
64
+ private:
65
+ std::map<std::string, std::uint32_t> cid_map_{ { "_default._default", 0 } };
66
+
67
+ public:
68
+ [[nodiscard]] std::optional<std::uint32_t> get(const std::string& path)
69
+ {
70
+ Expects(!path.empty());
71
+ auto ptr = cid_map_.find(path);
72
+ if (ptr != cid_map_.end()) {
73
+ return ptr->second;
74
+ }
75
+ return {};
76
+ }
77
+
78
+ void update(const std::string& path, std::uint32_t id)
79
+ {
80
+ Expects(!path.empty());
81
+ cid_map_[path] = id;
82
+ }
83
+
84
+ void reset()
85
+ {
86
+ cid_map_.clear();
87
+ cid_map_["_default._default"] = 0;
88
+ }
89
+ };
90
+
58
91
  class message_handler
59
92
  {
60
93
  public:
@@ -88,41 +121,47 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
88
121
 
89
122
  explicit bootstrap_handler(std::shared_ptr<mcbp_session> session)
90
123
  : session_(session)
91
- , sasl_([this]() -> std::string { return session_->username_; },
92
- [this]() -> std::string { return session_->password_; },
124
+ , sasl_([origin = session_->origin_]() -> std::string { return origin.username(); },
125
+ [origin = session_->origin_]() -> std::string { return origin.password(); },
93
126
  { "SCRAM-SHA512", "SCRAM-SHA256", "SCRAM-SHA1", "PLAIN" })
94
127
  {
95
128
  tao::json::value user_agent{
96
- { "a", fmt::format("ruby_sdk/{}.{}.{}", BACKEND_VERSION_MAJOR, BACKEND_VERSION_MINOR, BACKEND_VERSION_PATCH) },
97
- { "i", fmt::format("{}/{}", uuid::to_string(session_->client_id_), uuid::to_string(session_->id_)) }
129
+ { "a",
130
+ fmt::format(
131
+ "ruby/{}.{}.{}/{}", BACKEND_VERSION_MAJOR, BACKEND_VERSION_MINOR, BACKEND_VERSION_PATCH, BACKEND_GIT_REVISION) },
132
+ { "i", fmt::format("{}/{}", session_->client_id_, session_->id_) }
98
133
  };
99
134
  protocol::client_request<protocol::hello_request_body> hello_req;
100
135
  hello_req.opaque(session_->next_opaque());
101
136
  hello_req.body().user_agent(tao::json::to_string(user_agent));
137
+ spdlog::debug("{} user_agent={}, requested_features=[{}]",
138
+ session_->log_prefix_,
139
+ hello_req.body().user_agent(),
140
+ fmt::join(hello_req.body().features(), ", "));
102
141
  session_->write(hello_req.data());
103
142
 
104
- protocol::client_request<protocol::sasl_list_mechs_request_body> list_req;
105
- list_req.opaque(session_->next_opaque());
106
- session_->write(list_req.data());
107
-
108
- protocol::client_request<protocol::sasl_auth_request_body> auth_req;
109
- sasl::error sasl_code;
110
- std::string_view sasl_payload;
111
- std::tie(sasl_code, sasl_payload) = sasl_.start();
112
- auth_req.opaque(session_->next_opaque());
113
- auth_req.body().mechanism(sasl_.get_name());
114
- auth_req.body().sasl_data(sasl_payload);
115
- session_->write(auth_req.data());
143
+ if (!session->origin_.credentials().uses_certificate()) {
144
+ protocol::client_request<protocol::sasl_list_mechs_request_body> list_req;
145
+ list_req.opaque(session_->next_opaque());
146
+ session_->write(list_req.data());
147
+
148
+ protocol::client_request<protocol::sasl_auth_request_body> auth_req;
149
+ sasl::error sasl_code;
150
+ std::string_view sasl_payload;
151
+ std::tie(sasl_code, sasl_payload) = sasl_.start();
152
+ auth_req.opaque(session_->next_opaque());
153
+ auth_req.body().mechanism(sasl_.get_name());
154
+ auth_req.body().sasl_data(sasl_payload);
155
+ session_->write(auth_req.data());
156
+ }
116
157
 
117
158
  session_->flush();
118
159
  }
119
160
 
120
161
  void complete(std::error_code ec)
121
162
  {
163
+ stopped_ = true;
122
164
  session_->invoke_bootstrap_handler(ec);
123
- if (!ec) {
124
- session_->handler_ = std::make_unique<normal_handler>(session_);
125
- }
126
165
  }
127
166
 
128
167
  void auth_success()
@@ -138,10 +177,6 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
138
177
  sb_req.opaque(session_->next_opaque());
139
178
  sb_req.body().bucket_name(session_->bucket_name_.value());
140
179
  session_->write(sb_req.data());
141
-
142
- protocol::client_request<protocol::get_collections_manifest_request_body> gcm_req;
143
- gcm_req.opaque(session_->next_opaque());
144
- session_->write(gcm_req.data());
145
180
  }
146
181
  protocol::client_request<protocol::get_cluster_config_request_body> cfg_req;
147
182
  cfg_req.opaque(session_->next_opaque());
@@ -161,15 +196,20 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
161
196
  protocol::client_response<protocol::hello_response_body> resp(msg);
162
197
  if (resp.status() == protocol::status::success) {
163
198
  session_->supported_features_ = resp.body().supported_features();
199
+ spdlog::debug("{} supported_features=[{}]", session_->log_prefix_, fmt::join(session_->supported_features_, ", "));
200
+ if (session_->origin_.credentials().uses_certificate()) {
201
+ spdlog::debug("{} skip SASL authentication, because TLS certificate was specified", session_->log_prefix_);
202
+ return auth_success();
203
+ }
164
204
  } else {
165
- spdlog::warn("unexpected message status during bootstrap: {}", resp.error_message());
205
+ spdlog::warn("{} unexpected message status during bootstrap: {}", session_->log_prefix_, resp.error_message());
166
206
  return complete(std::make_error_code(error::network_errc::handshake_failure));
167
207
  }
168
208
  } break;
169
209
  case protocol::client_opcode::sasl_list_mechs: {
170
210
  protocol::client_response<protocol::sasl_list_mechs_response_body> resp(msg);
171
211
  if (resp.status() != protocol::status::success) {
172
- spdlog::warn("unexpected message status during bootstrap: {}", resp.error_message());
212
+ spdlog::warn("{} unexpected message status during bootstrap: {}", session_->log_prefix_, resp.error_message());
173
213
  return complete(std::make_error_code(error::common_errc::authentication_failure));
174
214
  }
175
215
  } break;
@@ -192,11 +232,14 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
192
232
  req.body().sasl_data(sasl_payload);
193
233
  session_->write_and_flush(req.data());
194
234
  } else {
195
- spdlog::error("unable to authenticate: sasl_code={}", sasl_code);
235
+ spdlog::error("{} unable to authenticate: sasl_code={}", session_->log_prefix_, sasl_code);
196
236
  return complete(std::make_error_code(error::common_errc::authentication_failure));
197
237
  }
198
238
  } else {
199
- spdlog::warn("unexpected message status during bootstrap: {} (opcode={})", resp.error_message(), opcode);
239
+ spdlog::warn("{} unexpected message status during bootstrap: {} (opcode={})",
240
+ session_->log_prefix_,
241
+ resp.error_message(),
242
+ opcode);
200
243
  return complete(std::make_error_code(error::common_errc::authentication_failure));
201
244
  }
202
245
  } break;
@@ -210,39 +253,28 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
210
253
  case protocol::client_opcode::get_error_map: {
211
254
  protocol::client_response<protocol::get_error_map_response_body> resp(msg);
212
255
  if (resp.status() == protocol::status::success) {
213
- session_->errmap_.emplace(resp.body().errmap());
256
+ session_->error_map_.emplace(resp.body().errmap());
214
257
  } else {
215
- spdlog::warn("unexpected message status during bootstrap: {} (opcode={})", resp.error_message(), opcode);
216
- return complete(std::make_error_code(error::network_errc::protocol_error));
217
- }
218
- } break;
219
- case protocol::client_opcode::get_collections_manifest: {
220
- protocol::client_response<protocol::get_collections_manifest_response_body> resp(msg);
221
- if (resp.status() == protocol::status::success) {
222
- session_->manifest_.emplace(resp.body().manifest());
223
- spdlog::trace(
224
- "collections manifest for bucket \"{}\": {}", session_->bucket_name_.value_or(""), *session_->manifest_);
225
- } else if (resp.status() == protocol::status::no_collections_manifest) {
226
- spdlog::trace("collection manifest is not available for bucket \"{}\": {}",
227
- session_->bucket_name_.value_or(""),
228
- resp.error_message());
229
- } else {
230
- spdlog::warn("unexpected message status during bootstrap: {} (opcode={})", resp.error_message(), opcode);
258
+ spdlog::warn("{} unexpected message status during bootstrap: {} (opcode={})",
259
+ session_->log_prefix_,
260
+ resp.error_message(),
261
+ opcode);
231
262
  return complete(std::make_error_code(error::network_errc::protocol_error));
232
263
  }
233
264
  } break;
234
265
  case protocol::client_opcode::select_bucket: {
235
266
  protocol::client_response<protocol::select_bucket_response_body> resp(msg);
236
267
  if (resp.status() == protocol::status::success) {
237
- spdlog::trace("selected bucket: {}", session_->bucket_name_.value_or(""));
268
+ spdlog::debug("{} selected bucket: {}", session_->log_prefix_, session_->bucket_name_.value_or(""));
238
269
  session_->bucket_selected_ = true;
239
270
  } else if (resp.status() == protocol::status::no_access) {
240
- spdlog::trace("unable to select bucket: {}, probably the bucket does not exist",
271
+ spdlog::debug("{} unable to select bucket: {}, probably the bucket does not exist",
272
+ session_->log_prefix_,
241
273
  session_->bucket_name_.value_or(""));
242
274
  session_->bucket_selected_ = false;
243
275
  return complete(std::make_error_code(error::common_errc::bucket_not_found));
244
276
  } else {
245
- spdlog::warn("unexpected message status during bootstrap: {}", resp.error_message());
277
+ spdlog::warn("{} unexpected message status during bootstrap: {}", session_->log_prefix_, resp.error_message());
246
278
  return complete(std::make_error_code(error::common_errc::bucket_not_found));
247
279
  }
248
280
  } break;
@@ -254,17 +286,21 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
254
286
  } else if (resp.status() == protocol::status::no_bucket && !session_->bucket_name_) {
255
287
  // bucket-less session, but the server wants bucket
256
288
  session_->supports_gcccp_ = false;
257
- spdlog::warn("this server does not support GCCCP, open bucket before making any cluster-level command");
289
+ spdlog::warn("{} this server does not support GCCCP, open bucket before making any cluster-level command",
290
+ session_->log_prefix_);
258
291
  session_->update_configuration(
259
- make_blank_configuration(session_->endpoint_.address().to_string(), session_->endpoint_.port(), 0));
292
+ make_blank_configuration(session_->endpoint_address_, session_->endpoint_.port(), 0));
260
293
  complete({});
261
294
  } else {
262
- spdlog::warn("unexpected message status during bootstrap: {} (opcode={})", resp.error_message(), opcode);
295
+ spdlog::warn("{} unexpected message status during bootstrap: {} (opcode={})",
296
+ session_->log_prefix_,
297
+ resp.error_message(),
298
+ opcode);
263
299
  return complete(std::make_error_code(error::network_errc::protocol_error));
264
300
  }
265
301
  } break;
266
302
  default:
267
- spdlog::warn("unexpected message during bootstrap: {}", opcode);
303
+ spdlog::warn("{} unexpected message during bootstrap: {}", session_->log_prefix_, opcode);
268
304
  return complete(std::make_error_code(error::network_errc::protocol_error));
269
305
  }
270
306
  }
@@ -317,9 +353,10 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
317
353
  session_->update_configuration(resp.body().config());
318
354
  }
319
355
  } else {
320
- spdlog::warn("unexpected message status: {}", resp.error_message());
356
+ spdlog::warn("{} unexpected message status: {}", session_->log_prefix_, resp.error_message());
321
357
  }
322
358
  } break;
359
+ case protocol::client_opcode::get_collection_id:
323
360
  case protocol::client_opcode::get:
324
361
  case protocol::client_opcode::get_and_lock:
325
362
  case protocol::client_opcode::get_and_touch:
@@ -338,14 +375,24 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
338
375
  std::uint16_t status = ntohs(msg.header.specific);
339
376
  auto handler = session_->command_handlers_.find(opaque);
340
377
  if (handler != session_->command_handlers_.end()) {
341
- handler->second(session_->map_status_code(opcode, status), std::move(msg));
378
+ auto ec = session_->map_status_code(opcode, status);
379
+ spdlog::trace("{} MCBP invoke operation handler: opaque={}, status={}, ec={}",
380
+ session_->log_prefix_,
381
+ opaque,
382
+ protocol::status_to_string(status),
383
+ ec.message());
384
+ auto fun = handler->second;
342
385
  session_->command_handlers_.erase(handler);
386
+ fun(ec, retry_reason::do_not_retry, std::move(msg));
343
387
  } else {
344
- spdlog::debug("unexpected orphan response opcode={}, opaque={}", msg.header.opcode, msg.header.opaque);
388
+ spdlog::debug("{} unexpected orphan response: opcode={}, opaque={}",
389
+ session_->log_prefix_,
390
+ msg.header.opcode,
391
+ msg.header.opaque);
345
392
  }
346
393
  } break;
347
394
  default:
348
- spdlog::warn("unexpected client response: {}", opcode);
395
+ spdlog::warn("{} unexpected client response: {}", session_->log_prefix_, opcode);
349
396
  }
350
397
  break;
351
398
  case protocol::magic::server_request:
@@ -362,23 +409,21 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
362
409
  }
363
410
  } break;
364
411
  default:
365
- spdlog::warn("unexpected server request: {}", opcode);
412
+ spdlog::warn("{} unexpected server request: {}", session_->log_prefix_, opcode);
366
413
  }
367
414
  break;
368
415
  case protocol::magic::client_request:
369
416
  case protocol::magic::alt_client_request:
370
417
  case protocol::magic::server_response:
371
- spdlog::warn("unexpected magic: {}, opcode={}, opaque={}", magic, msg.header.opcode, msg.header.opaque);
418
+ spdlog::warn(
419
+ "{} unexpected magic: {}, opcode={}, opaque={}", session_->log_prefix_, magic, msg.header.opcode, msg.header.opaque);
372
420
  break;
373
421
  }
374
422
  }
375
423
 
376
424
  void fetch_config(std::error_code ec)
377
425
  {
378
- if (ec == asio::error::operation_aborted) {
379
- return;
380
- }
381
- if (stopped_ || !session_) {
426
+ if (ec == asio::error::operation_aborted || stopped_ || !session_) {
382
427
  return;
383
428
  }
384
429
  protocol::client_request<protocol::get_cluster_config_request_body> req;
@@ -390,55 +435,149 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
390
435
  };
391
436
 
392
437
  public:
393
- mcbp_session(uuid::uuid_t client_id, asio::io_context& ctx, std::optional<std::string> bucket_name = {})
438
+ mcbp_session() = delete;
439
+ mcbp_session(const std::string& client_id,
440
+ asio::io_context& ctx,
441
+ const couchbase::origin& origin,
442
+ std::optional<std::string> bucket_name = {},
443
+ std::vector<protocol::hello_feature> known_features = {})
444
+ : client_id_(client_id)
445
+ , id_(uuid::to_string(uuid::random()))
446
+ , ctx_(ctx)
447
+ , resolver_(ctx_)
448
+ , stream_(std::make_unique<plain_stream_impl>(ctx_))
449
+ , bootstrap_deadline_(ctx_)
450
+ , connection_deadline_(ctx_)
451
+ , retry_backoff_(ctx_)
452
+ , origin_(origin)
453
+ , bucket_name_(std::move(bucket_name))
454
+ , supported_features_(known_features)
455
+ {
456
+ log_prefix_ = fmt::format("[{}/{}/{}/{}]", stream_->log_prefix(), client_id_, id_, bucket_name_.value_or("-"));
457
+ }
458
+
459
+ mcbp_session(const std::string& client_id,
460
+ asio::io_context& ctx,
461
+ asio::ssl::context& tls,
462
+ const couchbase::origin& origin,
463
+ std::optional<std::string> bucket_name = {},
464
+ std::vector<protocol::hello_feature> known_features = {})
394
465
  : client_id_(client_id)
395
- , id_(uuid::random())
466
+ , id_(uuid::to_string(uuid::random()))
396
467
  , ctx_(ctx)
397
468
  , resolver_(ctx_)
398
- , strand_(asio::make_strand(ctx_))
399
- , socket_(strand_)
400
- , deadline_timer_(ctx_)
469
+ , stream_(std::make_unique<tls_stream_impl>(ctx_, tls))
470
+ , bootstrap_deadline_(ctx_)
471
+ , connection_deadline_(ctx_)
472
+ , retry_backoff_(ctx_)
473
+ , origin_(origin)
401
474
  , bucket_name_(std::move(bucket_name))
475
+ , supported_features_(known_features)
402
476
  {
477
+ log_prefix_ = fmt::format("[{}/{}/{}/{}]", stream_->log_prefix(), client_id_, id_, bucket_name_.value_or("-"));
403
478
  }
404
479
 
405
480
  ~mcbp_session()
406
481
  {
407
- stop();
482
+ stop(retry_reason::do_not_retry);
408
483
  }
409
484
 
410
- void bootstrap(const std::string& hostname,
411
- const std::string& service,
412
- const std::string& username,
413
- const std::string& password,
414
- std::function<void(std::error_code, configuration)>&& handler)
485
+ [[nodiscard]] const std::string& log_prefix() const
415
486
  {
416
- username_ = username;
417
- password_ = password;
487
+ return log_prefix_;
488
+ }
489
+
490
+ void bootstrap(std::function<void(std::error_code, configuration)>&& handler, bool retry_on_bucket_not_found = false)
491
+ {
492
+ retry_bootstrap_on_bucket_not_found_ = retry_on_bucket_not_found;
418
493
  bootstrap_handler_ = std::move(handler);
419
- resolver_.async_resolve(
420
- hostname, service, std::bind(&mcbp_session::on_resolve, this, std::placeholders::_1, std::placeholders::_2));
494
+ bootstrap_deadline_.expires_after(timeout_defaults::bootstrap_timeout);
495
+ bootstrap_deadline_.async_wait([self = shared_from_this()](std::error_code ec) {
496
+ if (ec == asio::error::operation_aborted || self->stopped_) {
497
+ return;
498
+ }
499
+ spdlog::warn("{} unable to bootstrap in time", self->log_prefix_);
500
+ self->bootstrap_handler_(std::make_error_code(error::common_errc::unambiguous_timeout), {});
501
+ self->bootstrap_handler_ = nullptr;
502
+ self->stop(retry_reason::socket_closed_while_in_flight);
503
+ });
504
+ initiate_bootstrap();
421
505
  }
422
506
 
423
- [[nodiscard]] std::string id()
507
+ void initiate_bootstrap()
424
508
  {
425
- return uuid::to_string(id_);
509
+ if (stopped_) {
510
+ return;
511
+ }
512
+ if (origin_.exhausted()) {
513
+ auto backoff = std::chrono::milliseconds(500);
514
+ spdlog::debug("{} reached the end of list of bootstrap nodes, waiting for {}ms before restart", log_prefix_, backoff.count());
515
+ retry_backoff_.expires_after(backoff);
516
+ retry_backoff_.async_wait([self = shared_from_this()](std::error_code ec) mutable {
517
+ if (ec == asio::error::operation_aborted || self->stopped_) {
518
+ return;
519
+ }
520
+ self->origin_.restart();
521
+ self->initiate_bootstrap();
522
+ });
523
+ return;
524
+ }
525
+ std::tie(bootstrap_hostname_, bootstrap_port_) = origin_.next_address();
526
+ log_prefix_ = fmt::format("[{}/{}/{}/{}] <{}:{}>",
527
+ stream_->log_prefix(),
528
+ client_id_,
529
+ id_,
530
+ bucket_name_.value_or("-"),
531
+ bootstrap_hostname_,
532
+ bootstrap_port_);
533
+ spdlog::debug("{} attempt to establish MCBP connection", log_prefix_);
534
+ resolver_.async_resolve(bootstrap_hostname_,
535
+ bootstrap_port_,
536
+ std::bind(&mcbp_session::on_resolve, shared_from_this(), std::placeholders::_1, std::placeholders::_2));
537
+ }
538
+
539
+ [[nodiscard]] const std::string& id() const
540
+ {
541
+ return id_;
542
+ }
543
+
544
+ void on_stop(std::function<void(io::retry_reason)> handler)
545
+ {
546
+ on_stop_handler_ = std::move(handler);
426
547
  }
427
548
 
428
- void stop()
549
+ void stop(retry_reason reason)
429
550
  {
430
551
  if (stopped_) {
431
552
  return;
432
553
  }
554
+ spdlog::debug("{} stop MCBP connection, reason={}", log_prefix_, reason);
433
555
  stopped_ = true;
434
- deadline_timer_.cancel();
556
+ bootstrap_deadline_.cancel();
557
+ connection_deadline_.cancel();
558
+ retry_backoff_.cancel();
435
559
  resolver_.cancel();
436
- if (socket_.is_open()) {
437
- socket_.close();
560
+ if (stream_->is_open()) {
561
+ stream_->close();
562
+ }
563
+ auto ec = std::make_error_code(error::common_errc::request_canceled);
564
+ if (!bootstrapped_ && bootstrap_handler_) {
565
+ bootstrap_handler_(ec, {});
566
+ bootstrap_handler_ = nullptr;
438
567
  }
439
568
  if (handler_) {
440
569
  handler_->stop();
441
570
  }
571
+ for (auto& handler : command_handlers_) {
572
+ spdlog::debug("{} MCBP cancel operation during session close, opaque={}, ec={}", log_prefix_, handler.first, ec.message());
573
+ handler.second(ec, reason, {});
574
+ }
575
+ command_handlers_.clear();
576
+ config_listeners_.clear();
577
+ if (on_stop_handler_) {
578
+ on_stop_handler_(reason);
579
+ }
580
+ on_stop_handler_ = nullptr;
442
581
  }
443
582
 
444
583
  void write(const std::vector<uint8_t>& buf)
@@ -446,6 +585,11 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
446
585
  if (stopped_) {
447
586
  return;
448
587
  }
588
+ std::uint32_t opaque{ 0 };
589
+ std::memcpy(&opaque, buf.data() + 12, sizeof(opaque));
590
+ spdlog::trace("{} MCBP send, opaque={}, {:n}", log_prefix_, opaque, spdlog::to_hex(buf.begin(), buf.begin() + 24));
591
+ SPDLOG_TRACE("{} MCBP send, opaque={}{:a}", log_prefix_, opaque, spdlog::to_hex(data));
592
+ std::scoped_lock lock(output_buffer_mutex_);
449
593
  output_buffer_.push_back(buf);
450
594
  }
451
595
 
@@ -468,30 +612,49 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
468
612
 
469
613
  void write_and_subscribe(uint32_t opaque,
470
614
  std::vector<std::uint8_t>& data,
471
- std::function<void(std::error_code, io::mcbp_message&&)> handler)
615
+ std::function<void(std::error_code, retry_reason, io::mcbp_message&&)> handler)
472
616
  {
473
617
  if (stopped_) {
618
+ spdlog::warn("{} MCBP cancel operation, while trying to write to closed session, opaque={}", log_prefix_, opaque);
619
+ handler(std::make_error_code(error::common_errc::request_canceled), retry_reason::socket_closed_while_in_flight, {});
474
620
  return;
475
621
  }
476
622
  command_handlers_.emplace(opaque, std::move(handler));
477
- if (bootstrapped_ && socket_.is_open()) {
623
+ if (bootstrapped_ && stream_->is_open()) {
478
624
  write_and_flush(data);
479
625
  } else {
626
+ spdlog::debug("{} the stream is not ready yet, put the message into pending buffer, opaque={}", log_prefix_, opaque);
627
+ std::scoped_lock lock(pending_buffer_mutex_);
480
628
  pending_buffer_.push_back(data);
481
629
  }
482
630
  }
483
631
 
484
- [[nodiscard]] std::optional<collections_manifest> manifest()
632
+ [[nodiscard]] bool cancel(uint32_t opaque, std::error_code ec, retry_reason reason)
485
633
  {
486
- return manifest_;
634
+ if (stopped_) {
635
+ return false;
636
+ }
637
+ auto handler = command_handlers_.find(opaque);
638
+ if (handler != command_handlers_.end()) {
639
+ spdlog::debug("{} MCBP cancel operation, opaque={}, ec={}", log_prefix_, opaque, ec.message());
640
+ handler->second(ec, reason, {});
641
+ command_handlers_.erase(handler);
642
+ return true;
643
+ }
644
+ return false;
487
645
  }
488
646
 
489
- bool supports_feature(protocol::hello_feature feature)
647
+ [[nodiscard]] bool supports_feature(protocol::hello_feature feature)
490
648
  {
491
649
  return std::find(supported_features_.begin(), supported_features_.end(), feature) != supported_features_.end();
492
650
  }
493
651
 
494
- bool supports_gcccp()
652
+ [[nodiscard]] std::vector<protocol::hello_feature> supported_features() const
653
+ {
654
+ return supported_features_;
655
+ }
656
+
657
+ [[nodiscard]] bool supports_gcccp()
495
658
  {
496
659
  return supports_gcccp_;
497
660
  }
@@ -512,6 +675,16 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
512
675
  return config_->index_for_this_node();
513
676
  }
514
677
 
678
+ [[nodiscard]] const std::string& bootstrap_hostname() const
679
+ {
680
+ return bootstrap_hostname_;
681
+ }
682
+
683
+ [[nodiscard]] const std::string& bootstrap_port() const
684
+ {
685
+ return bootstrap_port_;
686
+ }
687
+
515
688
  [[nodiscard]] uint32_t next_opaque()
516
689
  {
517
690
  return ++opaque_;
@@ -531,16 +704,17 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
531
704
  return std::make_error_code(error::key_value_errc::document_not_found);
532
705
 
533
706
  case protocol::status::exists:
534
- if (opcode == protocol::client_opcode::replace || opcode == protocol::client_opcode::remove) {
535
- return std::make_error_code(error::common_errc::cas_mismatch);
707
+ if (opcode == protocol::client_opcode::insert) {
708
+ return std::make_error_code(error::key_value_errc::document_exists);
536
709
  }
537
- return std::make_error_code(error::key_value_errc::document_exists);
710
+ return std::make_error_code(error::common_errc::cas_mismatch);
538
711
 
539
712
  case protocol::status::too_big:
540
713
  return std::make_error_code(error::key_value_errc::value_too_large);
541
714
 
542
715
  case protocol::status::invalid:
543
716
  case protocol::status::xattr_invalid:
717
+ case protocol::status::subdoc_invalid_combo:
544
718
  return std::make_error_code(error::common_errc::invalid_argument);
545
719
 
546
720
  case protocol::status::delta_bad_value:
@@ -565,7 +739,7 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
565
739
  return std::make_error_code(error::common_errc::internal_server_failure);
566
740
 
567
741
  case protocol::status::busy:
568
- case protocol::status::temp_failure:
742
+ case protocol::status::temporary_failure:
569
743
  case protocol::status::no_memory:
570
744
  case protocol::status::not_initialized:
571
745
  return std::make_error_code(error::common_errc::temporary_failure);
@@ -624,7 +798,6 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
624
798
  case protocol::status::subdoc_value_too_deep:
625
799
  return std::make_error_code(error::key_value_errc::value_too_deep);
626
800
 
627
- case protocol::status::subdoc_invalid_combo:
628
801
  case protocol::status::subdoc_xattr_invalid_flag_combo:
629
802
  case protocol::status::subdoc_xattr_invalid_key_combo:
630
803
  return std::make_error_code(error::key_value_errc::xattr_invalid_key_combo);
@@ -651,29 +824,107 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
651
824
  break;
652
825
  }
653
826
  // FIXME: use error map here
654
- spdlog::warn("unknown status code: {} (opcode={})", status, opcode);
827
+ spdlog::warn("{} unknown status code: {} (opcode={})", log_prefix_, protocol::status_to_string(status), opcode);
655
828
  return std::make_error_code(error::network_errc::protocol_error);
656
829
  }
657
830
 
831
+ std::optional<error_map::error_info> decode_error_code(std::uint16_t code)
832
+ {
833
+ if (error_map_) {
834
+ auto info = error_map_->errors.find(code);
835
+ if (info != error_map_->errors.end()) {
836
+ return info->second;
837
+ }
838
+ }
839
+ return {};
840
+ }
841
+
842
+ void on_configuration_update(std::function<void(const configuration&)> handler)
843
+ {
844
+ config_listeners_.emplace_back(std::move(handler));
845
+ }
846
+
658
847
  void update_configuration(configuration&& config)
659
848
  {
849
+ if (stopped_) {
850
+ return;
851
+ }
660
852
  if (!config_ || config.rev > config_->rev) {
853
+ for (auto& node : config.nodes) {
854
+ if (node.hostname.empty()) {
855
+ node.hostname = bootstrap_hostname_;
856
+ }
857
+ }
661
858
  config_.emplace(config);
662
- spdlog::trace("received new configuration: {}", config_.value());
859
+ spdlog::debug("{} received new configuration: {}", log_prefix_, config_.value());
860
+ for (auto& listener : config_listeners_) {
861
+ listener(*config_);
862
+ }
663
863
  }
664
864
  }
665
865
 
866
+ void handle_not_my_vbucket(io::mcbp_message&& msg)
867
+ {
868
+ if (stopped_) {
869
+ return;
870
+ }
871
+ Expects(msg.header.magic == static_cast<std::uint8_t>(protocol::magic::alt_client_response) ||
872
+ msg.header.magic == static_cast<std::uint8_t>(protocol::magic::client_response));
873
+ if (protocol::has_json_datatype(msg.header.datatype)) {
874
+ auto magic = static_cast<protocol::magic>(msg.header.magic);
875
+ uint8_t extras_size = msg.header.extlen;
876
+ uint8_t framing_extras_size = 0;
877
+ uint16_t key_size = htons(msg.header.keylen);
878
+ if (magic == protocol::magic::alt_client_response) {
879
+ framing_extras_size = static_cast<std::uint8_t>(msg.header.keylen >> 8U);
880
+ key_size = msg.header.keylen & 0xffU;
881
+ }
882
+
883
+ std::vector<uint8_t>::difference_type offset = framing_extras_size + key_size + extras_size;
884
+ if (ntohl(msg.header.bodylen) - offset > 0) {
885
+ auto config = protocol::parse_config(msg.body.begin() + offset, msg.body.end());
886
+ spdlog::debug("{} received not_my_vbucket status for {}, opaque={} with config rev={} in the payload",
887
+ log_prefix_,
888
+ static_cast<protocol::client_opcode>(msg.header.opcode),
889
+ msg.header.opaque,
890
+ config.rev);
891
+ update_configuration(std::move(config));
892
+ }
893
+ }
894
+ }
895
+
896
+ std::optional<std::uint32_t> get_collection_uid(const std::string& collection_path)
897
+ {
898
+ return collection_cache_.get(collection_path);
899
+ }
900
+
901
+ void update_collection_uid(const std::string& path, std::uint32_t uid)
902
+ {
903
+ if (stopped_) {
904
+ return;
905
+ }
906
+ collection_cache_.update(path, uid);
907
+ }
908
+
666
909
  private:
667
910
  void invoke_bootstrap_handler(std::error_code ec)
668
911
  {
912
+ if (retry_bootstrap_on_bucket_not_found_ && ec == std::make_error_code(error::common_errc::bucket_not_found)) {
913
+ spdlog::debug(R"({} server returned {}, it must be transient condition, retrying)", log_prefix_, ec.message());
914
+ return initiate_bootstrap();
915
+ }
916
+
669
917
  if (!bootstrapped_ && bootstrap_handler_) {
918
+ bootstrap_deadline_.cancel();
670
919
  bootstrap_handler_(ec, config_.value_or(configuration{}));
671
920
  bootstrap_handler_ = nullptr;
672
921
  }
673
- bootstrapped_ = true;
674
922
  if (ec) {
675
- stop();
923
+ return stop(retry_reason::node_not_available);
676
924
  }
925
+ bootstrapped_ = true;
926
+ handler_ = std::make_unique<normal_handler>(shared_from_this());
927
+ std::scoped_lock lock(pending_buffer_mutex_);
677
928
  if (!pending_buffer_.empty()) {
678
929
  for (const auto& buf : pending_buffer_) {
679
930
  write(buf);
@@ -689,12 +940,13 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
689
940
  return;
690
941
  }
691
942
  if (ec) {
692
- spdlog::error("error on resolve: {}", ec.message());
693
- return invoke_bootstrap_handler(std::make_error_code(error::network_errc::resolve_failure));
943
+ spdlog::error("{} error on resolve: {}", log_prefix_, ec.message());
944
+ return initiate_bootstrap();
694
945
  }
695
946
  endpoints_ = endpoints;
696
947
  do_connect(endpoints_.begin());
697
- deadline_timer_.async_wait(std::bind(&mcbp_session::check_deadline, this, std::placeholders::_1));
948
+ connection_deadline_.expires_after(timeout_defaults::connect_timeout);
949
+ connection_deadline_.async_wait(std::bind(&mcbp_session::check_deadline, shared_from_this(), std::placeholders::_1));
698
950
  }
699
951
 
700
952
  void do_connect(asio::ip::tcp::resolver::results_type::iterator it)
@@ -703,13 +955,12 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
703
955
  return;
704
956
  }
705
957
  if (it != endpoints_.end()) {
706
- spdlog::trace("connecting to {}:{}", it->endpoint().address().to_string(), it->endpoint().port());
707
- deadline_timer_.expires_after(std::chrono::seconds(10));
708
- socket_.async_connect(it->endpoint(), std::bind(&mcbp_session::on_connect, this, std::placeholders::_1, it));
958
+ spdlog::debug("{} connecting to {}:{}", log_prefix_, it->endpoint().address().to_string(), it->endpoint().port());
959
+ connection_deadline_.expires_after(timeout_defaults::connect_timeout);
960
+ stream_->async_connect(it->endpoint(), std::bind(&mcbp_session::on_connect, shared_from_this(), std::placeholders::_1, it));
709
961
  } else {
710
- spdlog::error("no more endpoints left to connect");
711
- invoke_bootstrap_handler(std::make_error_code(error::network_errc::no_endpoints_left));
712
- stop();
962
+ spdlog::error("{} no more endpoints left to connect, will try another address", log_prefix_);
963
+ return initiate_bootstrap();
713
964
  }
714
965
  }
715
966
 
@@ -718,32 +969,39 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
718
969
  if (stopped_) {
719
970
  return;
720
971
  }
721
- if (!socket_.is_open() || ec) {
972
+ if (!stream_->is_open() || ec) {
973
+ spdlog::warn(
974
+ "{} unable to connect to {}:{}: {}", log_prefix_, it->endpoint().address().to_string(), it->endpoint().port(), ec.message());
722
975
  do_connect(++it);
723
976
  } else {
724
- socket_.set_option(asio::ip::tcp::no_delay{ true });
725
- socket_.set_option(asio::socket_base::keep_alive{ true });
977
+ stream_->set_options();
726
978
  endpoint_ = it->endpoint();
727
- spdlog::trace("connected to {}:{}", endpoint_.address().to_string(), it->endpoint().port());
979
+ endpoint_address_ = endpoint_.address().to_string();
980
+ spdlog::debug("{} connected to {}:{}", log_prefix_, endpoint_address_, it->endpoint().port());
981
+ log_prefix_ = fmt::format("[{}/{}/{}/{}] <{}/{}:{}>",
982
+ stream_->log_prefix(),
983
+ client_id_,
984
+ id_,
985
+ bucket_name_.value_or("-"),
986
+ bootstrap_hostname_,
987
+ endpoint_address_,
988
+ endpoint_.port());
728
989
  handler_ = std::make_unique<bootstrap_handler>(shared_from_this());
729
- deadline_timer_.expires_at(asio::steady_timer::time_point::max());
730
- deadline_timer_.cancel();
990
+ connection_deadline_.expires_at(asio::steady_timer::time_point::max());
991
+ connection_deadline_.cancel();
731
992
  }
732
993
  }
733
994
 
734
995
  void check_deadline(std::error_code ec)
735
996
  {
736
- if (ec == asio::error::operation_aborted) {
997
+ if (ec == asio::error::operation_aborted || stopped_) {
737
998
  return;
738
999
  }
739
- if (stopped_) {
740
- return;
1000
+ if (connection_deadline_.expiry() <= asio::steady_timer::clock_type::now()) {
1001
+ stream_->close();
1002
+ connection_deadline_.expires_at(asio::steady_timer::time_point::max());
741
1003
  }
742
- if (deadline_timer_.expiry() <= asio::steady_timer::clock_type::now()) {
743
- socket_.close();
744
- deadline_timer_.expires_at(asio::steady_timer::time_point::max());
745
- }
746
- deadline_timer_.async_wait(std::bind(&mcbp_session::check_deadline, this, std::placeholders::_1));
1004
+ connection_deadline_.async_wait(std::bind(&mcbp_session::check_deadline, shared_from_this(), std::placeholders::_1));
747
1005
  }
748
1006
 
749
1007
  void do_read()
@@ -755,35 +1013,47 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
755
1013
  return;
756
1014
  }
757
1015
  reading_ = true;
758
- socket_.async_read_some(asio::buffer(input_buffer_),
759
- [self = shared_from_this()](std::error_code ec, std::size_t bytes_transferred) {
760
- if (ec == asio::error::operation_aborted || self->stopped_) {
761
- return;
762
- }
763
- if (ec) {
764
- spdlog::error("[{}] [{}] IO error while reading from the socket: {}",
765
- uuid::to_string(self->id_),
766
- self->endpoint_.address().to_string(),
767
- ec.message());
768
- return self->stop();
769
- }
770
- self->parser_.feed(self->input_buffer_.data(), self->input_buffer_.data() + ssize_t(bytes_transferred));
771
-
772
- for (;;) {
773
- mcbp_message msg{};
774
- switch (self->parser_.next(msg)) {
775
- case mcbp_parser::ok:
776
- self->handler_->handle(std::move(msg));
777
- break;
778
- case mcbp_parser::need_data:
779
- self->reading_ = false;
780
- return self->do_read();
781
- case mcbp_parser::failure:
782
- ec = std::make_error_code(error::common_errc::parsing_failure);
783
- return self->stop();
784
- }
785
- }
786
- });
1016
+ stream_->async_read_some(
1017
+ asio::buffer(input_buffer_), [self = shared_from_this()](std::error_code ec, std::size_t bytes_transferred) {
1018
+ if (ec == asio::error::operation_aborted || self->stopped_) {
1019
+ return;
1020
+ }
1021
+ if (ec) {
1022
+ spdlog::error("{} IO error while reading from the socket: {}, pending_handlers={}",
1023
+ self->log_prefix_,
1024
+ ec.message(),
1025
+ self->command_handlers_.size());
1026
+ return self->stop(retry_reason::socket_closed_while_in_flight);
1027
+ }
1028
+ self->parser_.feed(self->input_buffer_.data(), self->input_buffer_.data() + ssize_t(bytes_transferred));
1029
+
1030
+ for (;;) {
1031
+ mcbp_message msg{};
1032
+ switch (self->parser_.next(msg)) {
1033
+ case mcbp_parser::ok:
1034
+ spdlog::trace(
1035
+ "{} MCBP recv, opaque={}, {:n}", self->log_prefix_, msg.header.opaque, spdlog::to_hex(msg.header_data()));
1036
+ SPDLOG_TRACE("{} MCBP recv, opaque={}{:a}{:a}",
1037
+ self->log_prefix_,
1038
+ msg.header.opaque,
1039
+ spdlog::to_hex(msg.header_data()),
1040
+ spdlog::to_hex(msg.body));
1041
+ self->handler_->handle(std::move(msg));
1042
+ if (self->stopped_) {
1043
+ return;
1044
+ }
1045
+ break;
1046
+ case mcbp_parser::need_data:
1047
+ self->reading_ = false;
1048
+ if (!self->stopped_) {
1049
+ self->do_read();
1050
+ }
1051
+ return;
1052
+ case mcbp_parser::failure:
1053
+ return self->stop(retry_reason::kv_temporary_failure);
1054
+ }
1055
+ }
1056
+ });
787
1057
  }
788
1058
 
789
1059
  void do_write()
@@ -791,7 +1061,8 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
791
1061
  if (stopped_) {
792
1062
  return;
793
1063
  }
794
- if (!writing_buffer_.empty()) {
1064
+ std::scoped_lock lock(writing_buffer_mutex_, output_buffer_mutex_);
1065
+ if (!writing_buffer_.empty() || output_buffer_.empty()) {
795
1066
  return;
796
1067
  }
797
1068
  std::swap(writing_buffer_, output_buffer_);
@@ -800,60 +1071,71 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
800
1071
  for (auto& buf : writing_buffer_) {
801
1072
  buffers.emplace_back(asio::buffer(buf));
802
1073
  }
803
- asio::async_write(socket_, buffers, [self = shared_from_this()](std::error_code ec, std::size_t /*unused*/) {
804
- if (self->stopped_) {
1074
+ stream_->async_write(buffers, [self = shared_from_this()](std::error_code ec, std::size_t /*unused*/) {
1075
+ if (ec == asio::error::operation_aborted || self->stopped_) {
805
1076
  return;
806
1077
  }
807
1078
  if (ec) {
808
- spdlog::error("[{}] [{}] IO error while writing to the socket: {}",
809
- uuid::to_string(self->id_),
810
- self->endpoint_.address().to_string(),
811
- ec.message());
812
- return self->stop();
1079
+ spdlog::error("{} IO error while writing to the socket: {}, pending_handlers={}",
1080
+ self->log_prefix_,
1081
+ ec.message(),
1082
+ self->command_handlers_.size());
1083
+ return self->stop(retry_reason::socket_closed_while_in_flight);
813
1084
  }
814
- self->writing_buffer_.clear();
815
- if (!self->output_buffer_.empty()) {
816
- self->do_write();
1085
+ {
1086
+ std::scoped_lock inner_lock(self->writing_buffer_mutex_);
1087
+ self->writing_buffer_.clear();
817
1088
  }
1089
+ self->do_write();
818
1090
  self->do_read();
819
1091
  });
820
1092
  }
821
1093
 
822
- uuid::uuid_t client_id_;
823
- uuid::uuid_t id_;
1094
+ std::string client_id_;
1095
+ std::string id_;
824
1096
  asio::io_context& ctx_;
825
1097
  asio::ip::tcp::resolver resolver_;
826
- asio::strand<asio::io_context::executor_type> strand_;
827
- asio::ip::tcp::socket socket_;
828
- asio::steady_timer deadline_timer_;
1098
+ std::unique_ptr<stream_impl> stream_;
1099
+ asio::steady_timer bootstrap_deadline_;
1100
+ asio::steady_timer connection_deadline_;
1101
+ asio::steady_timer retry_backoff_;
1102
+ couchbase::origin origin_;
829
1103
  std::optional<std::string> bucket_name_;
830
1104
  mcbp_parser parser_;
831
1105
  std::unique_ptr<message_handler> handler_;
832
- std::function<void(std::error_code, configuration)> bootstrap_handler_;
833
- std::map<uint32_t, std::function<void(std::error_code, io::mcbp_message&&)>> command_handlers_{};
1106
+ std::function<void(std::error_code, const configuration&)> bootstrap_handler_{};
1107
+ std::map<uint32_t, std::function<void(std::error_code, retry_reason, io::mcbp_message&&)>> command_handlers_{};
1108
+ std::vector<std::function<void(const configuration&)>> config_listeners_{};
1109
+ std::function<void(io::retry_reason)> on_stop_handler_{};
834
1110
 
835
1111
  bool bootstrapped_{ false };
836
1112
  std::atomic_bool stopped_{ false };
837
1113
  bool authenticated_{ false };
838
1114
  bool bucket_selected_{ false };
839
1115
  bool supports_gcccp_{ true };
1116
+ bool retry_bootstrap_on_bucket_not_found_{ false };
840
1117
 
841
1118
  std::atomic<std::uint32_t> opaque_{ 0 };
842
1119
 
843
- std::string username_;
844
- std::string password_;
845
-
846
1120
  std::array<std::uint8_t, 16384> input_buffer_{};
847
1121
  std::vector<std::vector<std::uint8_t>> output_buffer_{};
848
1122
  std::vector<std::vector<std::uint8_t>> pending_buffer_{};
849
1123
  std::vector<std::vector<std::uint8_t>> writing_buffer_{};
1124
+ std::mutex output_buffer_mutex_{};
1125
+ std::mutex pending_buffer_mutex_{};
1126
+ std::mutex writing_buffer_mutex_{};
1127
+ std::string bootstrap_hostname_{};
1128
+ std::string bootstrap_port_{};
850
1129
  asio::ip::tcp::endpoint endpoint_{}; // connected endpoint
1130
+ std::string endpoint_address_{}; // cached string with endpoint address
851
1131
  asio::ip::tcp::resolver::results_type endpoints_;
852
1132
  std::vector<protocol::hello_feature> supported_features_;
853
1133
  std::optional<configuration> config_;
854
- std::optional<error_map> errmap_;
855
- std::optional<collections_manifest> manifest_;
1134
+ std::optional<error_map> error_map_;
1135
+ collection_cache collection_cache_;
856
1136
 
857
1137
  std::atomic_bool reading_{ false };
1138
+
1139
+ std::string log_prefix_{};
858
1140
  };
859
1141
  } // namespace couchbase::io