libcouchbase 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/README.md +1 -1
  4. data/ext/libcouchbase/CMakeLists.txt +8 -6
  5. data/ext/libcouchbase/README.markdown +2 -2
  6. data/ext/libcouchbase/RELEASE_NOTES.markdown +0 -86
  7. data/ext/libcouchbase/cmake/Modules/ConfigureDtrace.cmake +0 -11
  8. data/ext/libcouchbase/cmake/Modules/GenerateConfigDotH.cmake +0 -2
  9. data/ext/libcouchbase/cmake/Modules/GetLibcouchbaseFlags.cmake +1 -2
  10. data/ext/libcouchbase/cmake/Modules/GetVersionInfo.cmake +3 -3
  11. data/ext/libcouchbase/cmake/config-cmake.h.in +0 -2
  12. data/ext/libcouchbase/cmake/defs.mk.in +2 -0
  13. data/ext/libcouchbase/cmake/source_files.cmake +5 -21
  14. data/ext/libcouchbase/include/libcouchbase/auth.h +0 -10
  15. data/ext/libcouchbase/include/libcouchbase/cntl.h +1 -27
  16. data/ext/libcouchbase/include/libcouchbase/error.h +1 -15
  17. data/ext/libcouchbase/include/libcouchbase/n1ql.h +1 -13
  18. data/ext/libcouchbase/include/libcouchbase/plugins/io/bsdio-inl.c +1 -1
  19. data/ext/libcouchbase/include/libcouchbase/subdoc.h +0 -9
  20. data/ext/libcouchbase/include/libcouchbase/views.h +1 -7
  21. data/ext/libcouchbase/include/libcouchbase/visibility.h +0 -1
  22. data/ext/libcouchbase/include/memcached/protocol_binary.h +1131 -29
  23. data/ext/libcouchbase/include/memcached/vbucket.h +42 -0
  24. data/ext/libcouchbase/packaging/parse-git-describe.pl +1 -1
  25. data/ext/libcouchbase/plugins/io/libev/libev_io_opts.h +2 -3
  26. data/ext/libcouchbase/src/README.md +2 -0
  27. data/ext/libcouchbase/src/auth-priv.h +0 -1
  28. data/ext/libcouchbase/src/auth.cc +4 -10
  29. data/ext/libcouchbase/src/bootstrap.c +269 -0
  30. data/ext/libcouchbase/src/bootstrap.h +39 -50
  31. data/ext/libcouchbase/src/bucketconfig/bc_cccp.cc +117 -84
  32. data/ext/libcouchbase/src/bucketconfig/bc_file.c +347 -0
  33. data/ext/libcouchbase/src/bucketconfig/bc_http.c +630 -0
  34. data/ext/libcouchbase/src/bucketconfig/bc_http.h +25 -50
  35. data/ext/libcouchbase/src/bucketconfig/bc_mcraw.c +150 -0
  36. data/ext/libcouchbase/src/bucketconfig/clconfig.h +386 -407
  37. data/ext/libcouchbase/src/bucketconfig/confmon.c +474 -0
  38. data/ext/libcouchbase/src/cbft.cc +27 -22
  39. data/ext/libcouchbase/src/cntl.cc +19 -30
  40. data/ext/libcouchbase/src/connspec.cc +1 -48
  41. data/ext/libcouchbase/src/connspec.h +0 -27
  42. data/ext/libcouchbase/src/dump.cc +2 -2
  43. data/ext/libcouchbase/src/getconfig.cc +33 -7
  44. data/ext/libcouchbase/src/handler.cc +2 -0
  45. data/ext/libcouchbase/src/hostlist.cc +36 -0
  46. data/ext/libcouchbase/src/hostlist.h +62 -41
  47. data/ext/libcouchbase/src/http/http-priv.h +112 -125
  48. data/ext/libcouchbase/src/http/http.cc +30 -15
  49. data/ext/libcouchbase/src/http/http.h +34 -1
  50. data/ext/libcouchbase/src/http/http_io.cc +26 -22
  51. data/ext/libcouchbase/src/instance.cc +23 -94
  52. data/ext/libcouchbase/src/internal.h +26 -52
  53. data/ext/libcouchbase/src/jsparse/parser.cc +202 -146
  54. data/ext/libcouchbase/src/jsparse/parser.h +98 -91
  55. data/ext/libcouchbase/src/lcbht/lcbht.c +282 -0
  56. data/ext/libcouchbase/src/lcbht/lcbht.h +163 -174
  57. data/ext/libcouchbase/src/lcbio/connect.c +557 -0
  58. data/ext/libcouchbase/src/lcbio/connect.h +2 -9
  59. data/ext/libcouchbase/src/lcbio/ctx.c +1 -1
  60. data/ext/libcouchbase/src/lcbio/iotable.h +16 -61
  61. data/ext/libcouchbase/src/lcbio/ioutils.h +1 -1
  62. data/ext/libcouchbase/src/lcbio/manager.c +2 -2
  63. data/ext/libcouchbase/src/mc/mcreq.h +2 -9
  64. data/ext/libcouchbase/src/mcserver/mcserver.cc +34 -143
  65. data/ext/libcouchbase/src/mcserver/mcserver.h +12 -7
  66. data/ext/libcouchbase/src/mcserver/negotiate.cc +38 -132
  67. data/ext/libcouchbase/src/n1ql/ixmgmt.cc +2 -1
  68. data/ext/libcouchbase/src/n1ql/n1ql.cc +32 -56
  69. data/ext/libcouchbase/src/newconfig.cc +6 -6
  70. data/ext/libcouchbase/src/nodeinfo.cc +2 -2
  71. data/ext/libcouchbase/src/operations/{cbflush.cc → cbflush.c} +15 -7
  72. data/ext/libcouchbase/src/operations/{counter.cc → counter.c} +0 -0
  73. data/ext/libcouchbase/src/operations/durability.cc +26 -6
  74. data/ext/libcouchbase/src/operations/durability_internal.h +3 -6
  75. data/ext/libcouchbase/src/operations/{get.cc → get.c} +26 -24
  76. data/ext/libcouchbase/src/operations/{observe.cc → observe.c} +93 -68
  77. data/ext/libcouchbase/src/operations/{pktfwd.cc → pktfwd.c} +0 -0
  78. data/ext/libcouchbase/src/operations/{remove.cc → remove.c} +0 -0
  79. data/ext/libcouchbase/src/operations/stats.cc +8 -3
  80. data/ext/libcouchbase/src/operations/{store.cc → store.c} +32 -27
  81. data/ext/libcouchbase/src/operations/subdoc.cc +18 -38
  82. data/ext/libcouchbase/src/operations/{touch.cc → touch.c} +0 -0
  83. data/ext/libcouchbase/src/packetutils.c +37 -0
  84. data/ext/libcouchbase/src/packetutils.h +2 -2
  85. data/ext/libcouchbase/src/probes.d +1 -1
  86. data/ext/libcouchbase/src/{retrychk.cc → retrychk.c} +3 -2
  87. data/ext/libcouchbase/src/retryq.cc +4 -4
  88. data/ext/libcouchbase/src/settings.c +0 -3
  89. data/ext/libcouchbase/src/settings.h +0 -5
  90. data/ext/libcouchbase/src/simplestring.c +211 -0
  91. data/ext/libcouchbase/src/simplestring.h +228 -0
  92. data/ext/libcouchbase/src/ssl/ssl_c.c +0 -1
  93. data/ext/libcouchbase/src/ssl/ssl_common.c +0 -2
  94. data/ext/libcouchbase/src/ssl/ssl_e.c +1 -0
  95. data/ext/libcouchbase/src/ssobuf.h +82 -0
  96. data/ext/libcouchbase/src/trace.h +4 -4
  97. data/ext/libcouchbase/src/vbucket/vbucket.c +1 -0
  98. data/ext/libcouchbase/src/views/{docreq.cc → docreq.c} +54 -48
  99. data/ext/libcouchbase/src/views/docreq.h +30 -24
  100. data/ext/libcouchbase/src/views/viewreq.c +358 -0
  101. data/ext/libcouchbase/src/views/viewreq.h +13 -43
  102. data/ext/libcouchbase/tests/basic/t_connstr.cc +50 -89
  103. data/ext/libcouchbase/tests/basic/t_host.cc +75 -67
  104. data/ext/libcouchbase/tests/basic/t_jsparse.cc +78 -27
  105. data/ext/libcouchbase/tests/basic/t_string.cc +112 -0
  106. data/ext/libcouchbase/tests/htparse/t_basic.cc +78 -58
  107. data/ext/libcouchbase/tests/iotests/mock-environment.h +1 -2
  108. data/ext/libcouchbase/tests/iotests/t_confmon.cc +114 -96
  109. data/ext/libcouchbase/tests/mc/t_alloc.cc +9 -9
  110. data/ext/libcouchbase/tools/cbc-pillowfight.cc +1 -1
  111. data/lib/libcouchbase/ext/tasks.rb +6 -2
  112. data/lib/libcouchbase/query_view.rb +1 -1
  113. data/lib/libcouchbase/results_fiber.rb +6 -6
  114. data/lib/libcouchbase/version.rb +1 -1
  115. metadata +26 -26
  116. data/ext/libcouchbase/src/bootstrap.cc +0 -216
  117. data/ext/libcouchbase/src/bucketconfig/bc_file.cc +0 -281
  118. data/ext/libcouchbase/src/bucketconfig/bc_http.cc +0 -528
  119. data/ext/libcouchbase/src/bucketconfig/bc_mcraw.cc +0 -115
  120. data/ext/libcouchbase/src/bucketconfig/confmon.cc +0 -378
  121. data/ext/libcouchbase/src/dns-srv.cc +0 -142
  122. data/ext/libcouchbase/src/errmap.cc +0 -107
  123. data/ext/libcouchbase/src/errmap.h +0 -113
  124. data/ext/libcouchbase/src/lcbht/lcbht.cc +0 -177
  125. data/ext/libcouchbase/src/lcbio/connect.cc +0 -562
  126. data/ext/libcouchbase/src/lcbio/timer-cxx.h +0 -87
  127. data/ext/libcouchbase/src/mctx-helper.h +0 -51
  128. data/ext/libcouchbase/src/views/viewreq.cc +0 -318
  129. data/ext/libcouchbase/tests/iotests/t_errmap.cc +0 -97
@@ -27,10 +27,10 @@
27
27
  #define LOGID(req) static_cast<const void*>(req)
28
28
  #define LOGARGS(req, lvl) req->instance->settings, "n1ql", LCB_LOG_##lvl, __FILE__, __LINE__
29
29
 
30
- struct lcb_FTSREQ : lcb::jsparse::Parser::Actions {
30
+ struct lcb_FTSREQ {
31
31
  const lcb_RESPHTTP *cur_htresp;
32
32
  lcb_http_request_t htreq;
33
- lcb::jsparse::Parser *parser;
33
+ lcbjsp_PARSER *parser;
34
34
  const void *cookie;
35
35
  lcb_FTSCALLBACK callback;
36
36
  lcb_t instance;
@@ -41,21 +41,26 @@ struct lcb_FTSREQ : lcb::jsparse::Parser::Actions {
41
41
 
42
42
  lcb_FTSREQ(lcb_t, const void *, const lcb_CMDFTS *);
43
43
  ~lcb_FTSREQ();
44
- void JSPARSE_on_row(const lcb::jsparse::Row& datum) {
45
- lcb_RESPFTS resp = { 0 };
46
- resp.row = static_cast<const char*>(datum.row.iov_base);
47
- resp.nrow = datum.row.iov_len;
48
- nrows++;
49
- invoke_row(&resp);
50
- }
51
- void JSPARSE_on_error(const std::string&) {
52
- lasterr = LCB_PROTOCOL_ERROR;
53
- }
54
- void JSPARSE_on_complete(const std::string&) {
55
- // Nothing
56
- }
57
44
  };
58
45
 
46
+ static void
47
+ row_callback(lcbjsp_PARSER *parser, const lcbjsp_ROW *datum)
48
+ {
49
+ lcb_FTSREQ *req = static_cast<lcb_FTSREQ*>(parser->data);
50
+ lcb_RESPFTS resp = { 0 };
51
+
52
+ if (datum->type == LCBJSP_TYPE_ROW) {
53
+ resp.row = static_cast<const char*>(datum->row.iov_base);
54
+ resp.nrow = datum->row.iov_len;
55
+ req->nrows++;
56
+ req->invoke_row(&resp);
57
+ } else if (datum->type == LCBJSP_TYPE_ERROR) {
58
+ req->lasterr = resp.rc = LCB_PROTOCOL_ERROR;
59
+ } else if (datum->type == LCBJSP_TYPE_COMPLETE) {
60
+ /* Nothing */
61
+ }
62
+ }
63
+
59
64
  static void
60
65
  chunk_callback(lcb_t, int, const lcb_RESPBASE *rb)
61
66
  {
@@ -78,7 +83,7 @@ chunk_callback(lcb_t, int, const lcb_RESPBASE *rb)
78
83
  * should remain alive (so we can cancel it later on) */
79
84
  delete req;
80
85
  } else {
81
- req->parser->feed(static_cast<const char*>(rh->body), rh->nbody);
86
+ lcbjsp_feed(req->parser, static_cast<const char*>(rh->body), rh->nbody);
82
87
  }
83
88
  }
84
89
 
@@ -102,7 +107,7 @@ lcb_FTSREQ::invoke_last()
102
107
 
103
108
  if (parser) {
104
109
  lcb_IOV meta;
105
- parser->get_postmortem(meta);
110
+ lcbjsp_get_postmortem(parser, &meta);
106
111
  resp.row = static_cast<const char*>(meta.iov_base);
107
112
  resp.nrow = meta.iov_len;
108
113
  }
@@ -111,9 +116,7 @@ lcb_FTSREQ::invoke_last()
111
116
  }
112
117
 
113
118
  lcb_FTSREQ::lcb_FTSREQ(lcb_t instance_, const void *cookie_, const lcb_CMDFTS *cmd)
114
- : lcb::jsparse::Parser::Actions(),
115
- cur_htresp(NULL), htreq(NULL),
116
- parser(new lcb::jsparse::Parser(lcb::jsparse::Parser::MODE_FTS, this)),
119
+ : cur_htresp(NULL), htreq(NULL), parser(lcbjsp_create(LCBJSP_MODE_FTS)),
117
120
  cookie(cookie_), callback(cmd->callback), instance(instance_), nrows(0),
118
121
  lasterr(LCB_SUCCESS)
119
122
  {
@@ -162,10 +165,12 @@ lcb_FTSREQ::lcb_FTSREQ(lcb_t instance_, const void *cookie_, const lcb_CMDFTS *c
162
165
  std::string qbody(Json::FastWriter().write(root));
163
166
  htcmd.body = qbody.c_str();
164
167
  htcmd.nbody = qbody.size();
168
+ parser->data = this;
169
+ parser->callback = row_callback;
165
170
 
166
171
  lasterr = lcb_http3(instance, this, &htcmd);
167
172
  if (lasterr == LCB_SUCCESS) {
168
- htreq->set_callback(chunk_callback);
173
+ lcb_htreq_setcb(htreq, chunk_callback);
169
174
  if (cmd->handle) {
170
175
  *cmd->handle = reinterpret_cast<lcb_FTSREQ*>(this);
171
176
  }
@@ -179,7 +184,7 @@ lcb_FTSREQ::~lcb_FTSREQ()
179
184
  htreq = NULL;
180
185
  }
181
186
  if (parser) {
182
- delete parser;
187
+ lcbjsp_free(parser);
183
188
  parser = NULL;
184
189
  }
185
190
  }
@@ -183,12 +183,6 @@ HANDLER(kv_hg_handler) {
183
183
  HANDLER(read_chunk_size_handler) {
184
184
  RETURN_GET_SET(lcb_U32, LCBT_SETTING(instance, read_chunk_size));
185
185
  }
186
- HANDLER(enable_errmap_handler) {
187
- RETURN_GET_SET(int, LCBT_SETTING(instance, use_errmap));
188
- }
189
- HANDLER(select_bucket_handler) {
190
- RETURN_GET_SET(int, LCBT_SETTING(instance, select_bucket));
191
- }
192
186
 
193
187
  HANDLER(get_kvb) {
194
188
  lcb_cntl_vbinfo_st *vbi = reinterpret_cast<lcb_cntl_vbinfo_st*>(arg);
@@ -204,7 +198,7 @@ HANDLER(get_kvb) {
204
198
 
205
199
 
206
200
  HANDLER(conninfo) {
207
- const lcbio_SOCKET *sock;
201
+ lcbio_SOCKET *sock;
208
202
  lcb_cntl_server_st *si = reinterpret_cast<lcb_cntl_server_st*>(arg);
209
203
  const lcb_host_t *host;
210
204
 
@@ -218,7 +212,7 @@ HANDLER(conninfo) {
218
212
  if (ix < 0 || ix > (int)LCBT_NSERVERS(instance)) {
219
213
  return LCB_ECTL_BADARG;
220
214
  }
221
- server = instance->get_server(ix);
215
+ server = LCBT_GET_SERVER(instance, ix);
222
216
  if (!server) {
223
217
  return LCB_NETWORK_ERROR;
224
218
  }
@@ -230,7 +224,7 @@ HANDLER(conninfo) {
230
224
  }
231
225
  }
232
226
  } else if (cmd == LCB_CNTL_CONFIGNODE_INFO) {
233
- sock = lcb::clconfig::http_get_conn(instance->confmon);
227
+ sock = lcb_confmon_get_rest_connection(instance->confmon);
234
228
  } else {
235
229
  return LCB_ECTL_BADARG;
236
230
  }
@@ -252,8 +246,7 @@ HANDLER(conninfo) {
252
246
 
253
247
  HANDLER(config_cache_loaded_handler) {
254
248
  if (mode != LCB_CNTL_GET) { return LCB_ECTL_UNSUPPMODE; }
255
- *(int *)arg = instance->cur_configinfo &&
256
- instance->cur_configinfo->get_origin() == lcb::clconfig::CLCONFIG_FILE;
249
+ *(int *)arg = instance->cur_configinfo && instance->cur_configinfo->origin == LCB_CLCONFIG_FILE;
257
250
  (void)cmd; return LCB_SUCCESS;
258
251
  }
259
252
 
@@ -289,9 +282,9 @@ HANDLER(config_transport) {
289
282
  if (mode == LCB_CNTL_SET) { return LCB_ECTL_UNSUPPMODE; }
290
283
  if (!instance->cur_configinfo) { return LCB_CLIENT_ETMPFAIL; }
291
284
 
292
- switch (instance->cur_configinfo->get_origin()) {
293
- case lcb::clconfig::CLCONFIG_HTTP: *val = LCB_CONFIG_TRANSPORT_HTTP; break;
294
- case lcb::clconfig::CLCONFIG_CCCP: *val = LCB_CONFIG_TRANSPORT_CCCP; break;
285
+ switch (instance->cur_configinfo->origin) {
286
+ case LCB_CLCONFIG_HTTP: *val = LCB_CONFIG_TRANSPORT_HTTP; break;
287
+ case LCB_CLCONFIG_CCCP: *val = LCB_CONFIG_TRANSPORT_CCCP; break;
295
288
  default: return LCB_CLIENT_ETMPFAIL;
296
289
  }
297
290
  (void)cmd; return LCB_SUCCESS;
@@ -299,7 +292,7 @@ HANDLER(config_transport) {
299
292
 
300
293
  HANDLER(config_nodes) {
301
294
  const char *node_strs = reinterpret_cast<const char*>(arg);
302
- lcb::clconfig::Provider *target;
295
+ clconfig_provider *target;
303
296
  lcb::Hostlist hostlist;
304
297
  lcb_error_t err;
305
298
 
@@ -316,13 +309,13 @@ HANDLER(config_nodes) {
316
309
  }
317
310
 
318
311
  if (cmd == LCB_CNTL_CONFIG_HTTP_NODES) {
319
- target = instance->confmon->get_provider(lcb::clconfig::CLCONFIG_HTTP);
312
+ target = lcb_confmon_get_provider(instance->confmon, LCB_CLCONFIG_HTTP);
313
+ lcb_clconfig_http_set_nodes(target, &hostlist);
320
314
  } else {
321
- target = instance->confmon->get_provider(lcb::clconfig::CLCONFIG_CCCP);
315
+ target = lcb_confmon_get_provider(instance->confmon, LCB_CLCONFIG_CCCP);
316
+ lcb_clconfig_cccp_set_nodes(target, &hostlist);
322
317
  }
323
318
 
324
- target->configure_nodes(hostlist);
325
-
326
319
  return LCB_SUCCESS;
327
320
  }
328
321
 
@@ -334,22 +327,22 @@ HANDLER(init_providers) {
334
327
  }
335
328
 
336
329
  HANDLER(config_cache_handler) {
337
- using namespace lcb::clconfig;
338
- Provider *provider;
330
+ clconfig_provider *provider;
339
331
 
340
- provider = instance->confmon->get_provider(lcb::clconfig::CLCONFIG_FILE);
332
+ provider = lcb_confmon_get_provider(instance->confmon, LCB_CLCONFIG_FILE);
341
333
  if (mode == LCB_CNTL_SET) {
342
- bool rv = file_set_filename(provider,
334
+ int rv;
335
+ rv = lcb_clconfig_file_set_filename(provider,
343
336
  reinterpret_cast<const char*>(arg),
344
337
  cmd == LCB_CNTL_CONFIGCACHE_RO);
345
338
 
346
- if (rv) {
339
+ if (rv == 0) {
347
340
  instance->settings->bc_http_stream_time = LCB_MS2US(10000);
348
341
  return LCB_SUCCESS;
349
342
  }
350
343
  return LCB_ERROR;
351
344
  } else {
352
- *(const char **)arg = file_get_filename(provider);
345
+ *(const char **)arg = lcb_clconfig_file_get_filename(provider);
353
346
  return LCB_SUCCESS;
354
347
  }
355
348
  }
@@ -592,9 +585,7 @@ static ctl_handler handlers[] = {
592
585
  client_string_handler, /* LCB_CNTL_CLIENT_STRING */
593
586
  bucket_auth_handler, /* LCB_CNTL_BUCKET_CRED */
594
587
  timeout_common, /* LCB_CNTL_RETRY_NMV_DELAY */
595
- read_chunk_size_handler, /*LCB_CNTL_READ_CHUNKSIZE */
596
- enable_errmap_handler, /* LCB_CNTL_ENABLE_ERRMAP */
597
- select_bucket_handler /* LCB_CNTL_SELECT_BUCKET */
588
+ read_chunk_size_handler /*LCB_CNTL_READ_CHUNKSIZE */
598
589
  };
599
590
 
600
591
  /* Union used for conversion to/from string functions */
@@ -746,8 +737,6 @@ static cntl_OPCODESTRS stropcode_map[] = {
746
737
  {"retry_nmv_delay", LCB_CNTL_RETRY_NMV_INTERVAL, convert_timeout},
747
738
  {"bucket_cred", LCB_CNTL_BUCKET_CRED, NULL},
748
739
  {"read_chunk_size", LCB_CNTL_READ_CHUNKSIZE, convert_u32},
749
- {"enable_errmap", LCB_CNTL_ENABLE_ERRMAP, convert_intbool},
750
- {"select_bucket", LCB_CNTL_SELECT_BUCKET, convert_intbool},
751
740
  {NULL, -1}
752
741
  };
753
742
 
@@ -31,8 +31,6 @@
31
31
  #define F_HASUSER (1<<2)
32
32
  #define F_SSLSCHEME (1<<3)
33
33
  #define F_FILEONLY (1<<4)
34
- #define F_DNSSRV (1<<5)
35
- #define F_DNSSRV_EXPLICIT ( (1<<6) |F_DNSSRV)
36
34
 
37
35
  using namespace lcb;
38
36
 
@@ -106,14 +104,6 @@ Connspec::parse_hosts(const char *hostbegin,
106
104
  port = scratch.substr(colonpos + 1);
107
105
  }
108
106
 
109
- if (m_flags & F_DNSSRV_EXPLICIT) {
110
- if (!m_hosts.empty()) {
111
- SET_ERROR("Only a single host is allowed with DNS SRV");
112
- } else if (!port.empty()) {
113
- SET_ERROR("Port cannot be specified with DNS SRV");
114
- }
115
- }
116
-
117
107
  m_hosts.resize(m_hosts.size() + 1);
118
108
  Spechost *dh = &m_hosts.back();
119
109
  dh->hostname = scratch.substr(0, hostlen);
@@ -244,24 +234,6 @@ Connspec::parse_options(
244
234
  if (sscanf(value, "%d", &m_loglevel) != 1) {
245
235
  SET_ERROR("console_log_level must be a numeric value");
246
236
  }
247
- } else if (!strcmp(key, "dnssrv")) {
248
- if ((m_flags & F_DNSSRV_EXPLICIT) == F_DNSSRV_EXPLICIT) {
249
- SET_ERROR("Cannot use dnssrv scheme with dnssrv option");
250
- }
251
- int btmp = 0;
252
- if (!strcmp(value, "on") || !strcmp(value, "true")) {
253
- btmp = 1;
254
- } else if (!strcmp(value, "off") || !strcmp(value, "false")) {
255
- btmp = 0;
256
- } else if (sscanf(value, "%d", &btmp) != 1) {
257
- printf("Coldn't parse value!\n");
258
- SET_ERROR("dnssrv must have numeric (boolean) value");
259
- }
260
- if (btmp) {
261
- m_flags |= F_DNSSRV;
262
- } else {
263
- m_flags &= ~F_DNSSRV_EXPLICIT;
264
- }
265
237
  } else {
266
238
  m_ctlopts.push_back(std::make_pair(key, value));
267
239
  }
@@ -316,17 +288,10 @@ Connspec::parse(const char *connstr_, const char **errmsg)
316
288
  m_implicit_port = 0;
317
289
  } else if (SCHEME_MATCHES(LCB_SPECSCHEME_MCCOMPAT)) {
318
290
  m_implicit_port = LCB_CONFIG_MCCOMPAT_PORT;
319
- } else if (SCHEME_MATCHES(LCB_SPECSCHEME_SRV)) {
320
- m_implicit_port = LCB_CONFIG_MCD_PORT;
321
- m_flags |= F_DNSSRV_EXPLICIT;
322
- } else if (SCHEME_MATCHES(LCB_SPECSCHEME_SRV_SSL)) {
323
- m_implicit_port = LCB_CONFIG_MCD_SSL_PORT;
324
- m_sslopts |= LCB_SSL_ENABLED;
325
- m_flags |= F_SSLSCHEME | F_DNSSRV_EXPLICIT;
326
291
  } else {
327
292
  /* If we don't have a scheme at all: */
328
293
  if (strstr(connstr_, "://")) {
329
- SET_ERROR("String must begin with 'couchbase://, 'couchbases://', or 'http://'");
294
+ SET_ERROR("String must begin with ''couchbase://, 'couchbases://', or 'http://'");
330
295
  } else {
331
296
  found_scheme = "";
332
297
  m_implicit_port = LCB_CONFIG_HTTP_PORT;
@@ -380,8 +345,6 @@ Connspec::parse(const char *connstr_, const char **errmsg)
380
345
  if (m_hosts.empty()) {
381
346
  m_hosts.resize(m_hosts.size()+1);
382
347
  m_hosts.back().hostname = "localhost";
383
- } else if (m_hosts.size() == 1 && m_hosts[0].isTypeless()) {
384
- m_flags |= F_DNSSRV;
385
348
  }
386
349
 
387
350
  if (options_ != NULL) {
@@ -497,13 +460,3 @@ Connspec::load(const lcb_create_st& cropts)
497
460
  GT_DONE:
498
461
  return err;
499
462
  }
500
-
501
- bool
502
- Connspec::can_dnssrv() const {
503
- return m_flags & F_DNSSRV;
504
- }
505
-
506
- bool
507
- Connspec::is_explicit_dnssrv() const {
508
- return (m_flags & F_DNSSRV_EXPLICIT) == F_DNSSRV_EXPLICIT;
509
- }
@@ -20,11 +20,9 @@
20
20
 
21
21
  #include <libcouchbase/couchbase.h>
22
22
  #include "config.h"
23
-
24
23
  #include <string>
25
24
  #include <vector>
26
25
  #include <set>
27
- #include "hostlist.h"
28
26
 
29
27
  #ifdef _MSC_VER
30
28
  /*
@@ -75,18 +73,6 @@ public:
75
73
  bool is_bs_http() const { return has_bsmode(LCB_CONFIG_TRANSPORT_HTTP); }
76
74
  bool is_bs_cccp() const { return has_bsmode(LCB_CONFIG_TRANSPORT_CCCP); }
77
75
  bool is_bs_file() const { return m_flags & LCB_CONNSPEC_F_FILEONLY; }
78
-
79
- /**
80
- * Whether a DNS SRV lookup can be performed on this connection string.
81
- * @return true if a DNS SRV lookup is possible, or false if there is
82
- * a parameter or format of the connection string preventing a lookup
83
- */
84
- bool can_dnssrv() const;
85
-
86
- /**
87
- * Whether the explicit `couchbase{s}+dnssrv` internal scheme is used
88
- */
89
- bool is_explicit_dnssrv() const;
90
76
  uint16_t default_port() const { return m_implicit_port; }
91
77
  const std::vector<Spechost>& hosts() const { return m_hosts; }
92
78
  const std::string& bucket() const { return m_bucket; }
@@ -97,8 +83,6 @@ public:
97
83
  const Options& options() const { return m_ctlopts; }
98
84
  unsigned loglevel() const { return m_loglevel; }
99
85
  const std::string& connstr() const { return m_connstr; }
100
- void clear_hosts() { m_hosts.clear(); }
101
- void add_host(const Spechost& host) { m_hosts.push_back(host); }
102
86
  private:
103
87
  Options m_ctlopts;
104
88
  std::string m_bucket;
@@ -126,18 +110,7 @@ private:
126
110
  #define LCB_SPECSCHEME_HTTP "http://"
127
111
  #define LCB_SPECSCHEME_HTTP_SSL "https-internal://"
128
112
  #define LCB_SPECSCHEME_MCCOMPAT "memcached://"
129
- #define LCB_SPECSCHEME_SRV "couchbase+dnssrv://"
130
- #define LCB_SPECSCHEME_SRV_SSL "couchbases+dnssrv://"
131
-
132
- // Standalone functionality:
133
- lcb_error_t
134
- dnssrv_query(const char *name, Hostlist& hostlist);
135
-
136
- Hostlist *
137
- dnssrv_getbslist(const char *addr, bool is_ssl, lcb_error_t& errout);
138
-
139
113
  } // namespace
140
-
141
114
  #endif
142
115
 
143
116
  #ifdef _MSC_VER
@@ -34,7 +34,7 @@ lcb_dump(lcb_t instance, FILE *fp, lcb_U32 flags)
34
34
  fprintf(fp, "Settings=%p\n", (void*)instance->settings);
35
35
 
36
36
  if (instance->cur_configinfo) {
37
- lcb::clconfig::ConfigInfo *cfg = instance->cur_configinfo;
37
+ clconfig_info *cfg = instance->cur_configinfo;
38
38
  fprintf(fp, "Current VBC=%p\n", (void*)cfg->vbc);
39
39
  fprintf(fp, "Config RevID=%d\n", cfg->vbc->revid);
40
40
  if (flags & LCB_DUMP_VBCONFIG) {
@@ -90,6 +90,6 @@ lcb_dump(lcb_t instance, FILE *fp, lcb_U32 flags)
90
90
  fprintf(fp, "=== END PIPELINE DUMP ===\n");
91
91
 
92
92
  fprintf(fp, "=== BEGIN CONFMON DUMP ===\n");
93
- instance->confmon->dump(fp);
93
+ lcb_confmon_dump(instance->confmon, fp);
94
94
  fprintf(fp, "=== END CONFMON DUMP ===\n");
95
95
  }
@@ -18,6 +18,31 @@
18
18
  #include "internal.h"
19
19
  #include "packetutils.h"
20
20
  #include <bucketconfig/clconfig.h>
21
+ LCB_INTERNAL_API
22
+ lcb::Server *
23
+ lcb_find_server_by_host(lcb_t instance, const lcb_host_t *host)
24
+ {
25
+ mc_CMDQUEUE *cq = &instance->cmdq;
26
+ unsigned ii;
27
+ for (ii = 0; ii < cq->npipelines; ii++) {
28
+ lcb::Server *server = static_cast<lcb::Server*>(cq->pipelines[ii]);
29
+ if (lcb_host_equals(&server->get_host(), host)) {
30
+ return server;
31
+ }
32
+ }
33
+ return NULL;
34
+ }
35
+
36
+ LCB_INTERNAL_API
37
+ lcb::Server *
38
+ lcb_find_server_by_index(lcb_t instance, int ix)
39
+ {
40
+ mc_CMDQUEUE *cq = &instance->cmdq;
41
+ if (ix < 0 || ix >= static_cast<int>(cq->npipelines)) {
42
+ return NULL;
43
+ }
44
+ return static_cast<lcb::Server*>(cq->pipelines[ix]);
45
+ }
21
46
 
22
47
  static void
23
48
  ext_callback_proxy(mc_PIPELINE *pl, mc_PACKET *req, lcb_error_t rc,
@@ -28,18 +53,19 @@ ext_callback_proxy(mc_PIPELINE *pl, mc_PACKET *req, lcb_error_t rc,
28
53
  const lcb::MemcachedResponse *res =
29
54
  reinterpret_cast<const lcb::MemcachedResponse*>(resdata);
30
55
 
31
- lcb::clconfig::cccp_update(
32
- rd->cookie, rc, res->body<const char*>(), res->bodylen(),
33
- &server->get_host());
56
+ lcb_cccp_update2(rd->cookie, rc, res->body<const char*>(), res->bodylen(),
57
+ &server->get_host());
34
58
  free(rd);
35
59
  }
36
60
 
37
61
  static mc_REQDATAPROCS procs = { ext_callback_proxy };
38
62
 
63
+ LCB_INTERNAL_API
39
64
  lcb_error_t
40
- lcb_st::request_config(const void *cookie_, lcb::Server *server)
65
+ lcb_getconfig(lcb_t instance, const void *cookie, lcb::Server *server)
41
66
  {
42
67
  lcb_error_t err;
68
+ mc_CMDQUEUE *cq = &instance->cmdq;
43
69
  mc_PACKET *packet;
44
70
  mc_REQDATAEX *rd;
45
71
 
@@ -56,7 +82,7 @@ lcb_st::request_config(const void *cookie_, lcb::Server *server)
56
82
 
57
83
  rd = reinterpret_cast<mc_REQDATAEX*>(calloc(1, sizeof(*rd)));
58
84
  rd->procs = &procs;
59
- rd->cookie = cookie_;
85
+ rd->cookie = cookie;
60
86
  rd->start = gethrtime();
61
87
  packet->u_rdata.exdata = rd;
62
88
  packet->flags |= MCREQ_F_REQEXT;
@@ -66,8 +92,8 @@ lcb_st::request_config(const void *cookie_, lcb::Server *server)
66
92
  hdr.opaque(packet->opaque);
67
93
  memcpy(SPAN_BUFFER(&packet->kh_span), hdr.data(), hdr.size());
68
94
 
69
- mcreq_sched_enter(&cmdq);
95
+ mcreq_sched_enter(cq);
70
96
  mcreq_sched_add(server, packet);
71
- mcreq_sched_leave(&cmdq, 1);
97
+ mcreq_sched_leave(cq, 1);
72
98
  return LCB_SUCCESS;
73
99
  }