Couchbase C Client  2.10.6
Asynchronous C Client for Couchbase
couchbase.h
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * Copyright 2010-2017 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 #ifndef LIBCOUCHBASE_COUCHBASE_H
19 #define LIBCOUCHBASE_COUCHBASE_H 1
20 
26 #define LCB_CONFIG_MCD_PORT 11210
27 #define LCB_CONFIG_MCD_SSL_PORT 11207
28 #define LCB_CONFIG_HTTP_PORT 8091
29 #define LCB_CONFIG_HTTP_SSL_PORT 18091
30 #define LCB_CONFIG_MCCOMPAT_PORT 11211
31 
32 struct lcb_st;
33 
41 typedef struct lcb_st *lcb_t;
42 struct lcb_http_request_st;
43 typedef struct lcb_http_request_st *lcb_http_request_t;
44 
45 #include <stddef.h>
46 #include <time.h>
47 #include <stdarg.h>
48 #include <stdio.h>
49 #include <libcouchbase/sysdefs.h>
50 #include <libcouchbase/assert.h>
51 #include <libcouchbase/visibility.h>
52 #include <libcouchbase/error.h>
53 #include <libcouchbase/iops.h>
54 #include <libcouchbase/http.h>
55 #include <libcouchbase/configuration.h>
56 #include <libcouchbase/kvbuf.h>
57 #include <libcouchbase/auth.h>
58 #include <libcouchbase/tracing.h>
59 #include <libcouchbase/_cxxwrap.h>
60 #include <libcouchbase/cntl.h>
61 
62 #ifdef __cplusplus
63 extern "C"{
64 #endif
65 
66 typedef lcb_U8 lcb_datatype_t;
67 typedef lcb_U32 lcb_USECS;
68 
69 
70 /******************************************************************************
71  ******************************************************************************
72  ******************************************************************************
73  ** INITIALIZATION **
74  ******************************************************************************
75  ******************************************************************************
76  ******************************************************************************/
77 
247 typedef enum {
250 } lcb_type_t;
251 
257 typedef enum {
262 } lcb_BTYPE;
263 
264 
265 #ifndef __LCB_DOXYGEN__
266 /* These are definitions for some of the older fields of the `lcb_create_st`
267  * structure. They are here for backwards compatibility and should not be
268  * used by new code */
269 typedef enum { LCB_CONFIG_TRANSPORT_LIST_END = 0, LCB_CONFIG_TRANSPORT_HTTP = 1, LCB_CONFIG_TRANSPORT_CCCP, LCB_CONFIG_TRANSPORT_MAX } lcb_config_transport_t;
270 #define LCB_CREATE_V0_FIELDS const char *host; const char *user; const char *passwd; const char *bucket; struct lcb_io_opt_st *io;
271 #define LCB_CREATE_V1_FIELDS LCB_CREATE_V0_FIELDS lcb_type_t type;
272 #define LCB_CREATE_V2_FIELDS LCB_CREATE_V1_FIELDS const char *mchosts; const lcb_config_transport_t* transports;
273 struct lcb_create_st0 { LCB_CREATE_V0_FIELDS };
274 struct lcb_create_st1 { LCB_CREATE_V1_FIELDS };
275 struct lcb_create_st2 { LCB_CREATE_V2_FIELDS };
276 #endif
277 
282  const char *connstr;
288  const char *username;
289 
293  const char *passwd;
294 
295  void *_pad_bucket;
296  struct lcb_io_opt_st *io;
297  lcb_type_t type;
298 };
299 
306  const char *connstr;
312  const char *username;
313 
317  const char *passwd;
318 
320  struct lcb_io_opt_st *io;
321  lcb_type_t type;
322 };
323 
330  int version;
331 
334  union lcb_CRST_u {
335  struct lcb_create_st0 v0;
336  struct lcb_create_st1 v1;
337  struct lcb_create_st2 v2;
339  struct lcb_create_st4 v4;
340  } v;
341  LCB_DEPR_CTORS_CRST
342 };
343 
387 LIBCOUCHBASE_API
388 lcb_error_t lcb_create(lcb_t *instance, const struct lcb_create_st *options);
389 
412 LIBCOUCHBASE_API
413 lcb_error_t lcb_connect(lcb_t instance);
414 
424 typedef void (*lcb_bootstrap_callback)(lcb_t instance, lcb_error_t err);
425 
436 LIBCOUCHBASE_API
439 
452 LIBCOUCHBASE_API
455 
464 LIBCOUCHBASE_API
465 void
466 lcb_set_auth(lcb_t instance, lcb_AUTHENTICATOR *auth);
504 #define LCB_CMD_BASE \
505  \
508  lcb_U32 cmdflags; \
509  \
510  \
518  lcb_U32 exptime; \
519  \
520  \
525  lcb_U64 cas; \
526  \
527  \
528  lcb_KEYBUF key; \
529  \
530  \
531  lcb_KEYBUF _hashkey
532 
535 typedef struct lcb_CMDBASE {
536  LCB_CMD_BASE;
537 } lcb_CMDBASE;
538 
546 #define LCB_CMD_F_INTERNAL_CALLBACK (1 << 0)
547 
553 #define LCB_CMD_F_MULTIAUTH (1<<1)
554 
569 #define LCB_CMD_SET_KEY(cmd, keybuf, keylen) \
570  LCB_KREQ_SIMPLE(&(cmd)->key, keybuf, keylen)
571 
582 #define LCB_CMD__SETVBID(cmd, vbid) do { \
583  (cmd)->_hashkey.type = LCB_KV_VBID; \
584  (cmd)->_hashkey.contig.nbytes = vbid; \
585 } while (0);
586 
621 #define LCB_RESP_BASE \
622  \
626  void *cookie; \
627  const void *key; \
628  lcb_SIZE nkey; \
629  lcb_CAS cas; \
630  lcb_error_t rc; \
631  lcb_U16 version; \
632  \
633  lcb_U16 rflags;
634 
635 
641 typedef struct {
642  LCB_RESP_BASE
643 } lcb_RESPBASE;
644 
645 
646 #define LCB_RESP_SERVER_FIELDS \
647  \
648  const char *server;
649 
655 typedef struct {
656  LCB_RESP_BASE
657  LCB_RESP_SERVER_FIELDS
659 
661 typedef struct lcb_MUTATION_TOKEN {
662  lcb_U64 uuid_;
663  lcb_U64 seqno_;
664  lcb_U16 vbid_;
666 
672 typedef enum {
675 
682 
685 
689 
693 
696 } lcb_RESPFLAGS;
697 
711 typedef enum {
729  LCB_CALLBACK_STOREDUR,
731  LCB_CALLBACK_SDMUTATE,
735  LCB_CALLBACK__MAX /* Number of callbacks */
737 
738 /* The following callback types cannot be set using lcb_install_callback3(),
739  * however, their value is passed along as the second argument of their
740  * respective callbacks. This allows you to still use the same callback,
741  * differentiating their meaning by the type. */
742 
744 #define LCB_CALLBACK_VIEWQUERY -1
745 
747 #define LCB_CALLBACK_N1QL -2
748 
750 #define LCB_CALLBACK_IXMGMT -3
751 
753 #define LCB_CALLBACK_ANALYTICS -4
754 
762 typedef void (*lcb_RESPCALLBACK)
763  (lcb_t instance, int cbtype, const lcb_RESPBASE* resp);
764 
786 LIBCOUCHBASE_API
788 lcb_install_callback3(lcb_t instance, int cbtype, lcb_RESPCALLBACK cb);
789 
802 LIBCOUCHBASE_API
804 lcb_get_callback3(lcb_t instance, int cbtype);
805 
812 LIBCOUCHBASE_API
813 const char *
814 lcb_strcbtype(int cbtype);
815 
830 #define LCB_CMDGET_F_CLEAREXP (1<<16)
831 
856 typedef struct {
857  LCB_CMD_BASE;
864  int lock;
865 } lcb_CMDGET;
866 
868 typedef struct {
869  LCB_RESP_BASE
870  const void *value;
871  lcb_SIZE nvalue;
872  void* bufh;
873  lcb_datatype_t datatype;
874  lcb_U32 itmflags;
875 } lcb_RESPGET;
876 
917 LIBCOUCHBASE_API
919 lcb_get3(lcb_t instance, const void *cookie, const lcb_CMDGET *cmd);
934 typedef enum {
938 
941 
945 } lcb_replica_t;
946 
958 typedef struct {
959  LCB_CMD_BASE;
982 
988  int index;
990 
1038 LIBCOUCHBASE_API
1040 lcb_rget3(lcb_t instance, const void *cookie, const lcb_CMDGETREPLICA *cmd);
1057 typedef enum {
1062  LCB_ADD = 0x01,
1063 
1068  LCB_REPLACE = 0x02,
1069 
1071  LCB_SET = 0x03,
1072 
1081  LCB_UPSERT = 0x00,
1082 
1088  LCB_APPEND = 0x04,
1089 
1094 } lcb_storage_t;
1095 
1106 typedef struct {
1107  LCB_CMD_BASE;
1108 
1114 
1120  lcb_U32 flags;
1121 
1123  lcb_datatype_t datatype;
1124 
1130 } lcb_CMDSTORE;
1131 
1135 typedef struct {
1136  LCB_RESP_BASE
1137 
1140 } lcb_RESPSTORE;
1141 
1155 #define LCB_CMD_SET_VALUE(scmd, valbuf, vallen) do { \
1156  (scmd)->value.vtype = LCB_KV_COPY; \
1157  (scmd)->value.u_buf.contig.bytes = valbuf; \
1158  (scmd)->value.u_buf.contig.nbytes = vallen; \
1159 } while (0);
1160 
1177 #define LCB_CMD_SET_VALUEIOV(scmd, iovs, niovs) do { \
1178  (scmd)->value.vtype = LCB_KV_IOVCOPY; \
1179  (scmd)->value.u_buf.multi.iov = iovs; \
1180  (scmd)->value.u_buf.multi.niov = niovs; \
1181 } while (0);
1182 
1233 LIBCOUCHBASE_API
1235 lcb_store3(lcb_t instance, const void *cookie, const lcb_CMDSTORE *cmd);
1256 
1268 
1305 LIBCOUCHBASE_API
1307 lcb_remove3(lcb_t instance, const void *cookie, const lcb_CMDREMOVE * cmd);
1346 typedef struct lcb_MULTICMD_CTX_st {
1353  lcb_error_t (*addcmd)(struct lcb_MULTICMD_CTX_st *ctx, const lcb_CMDBASE *cmd);
1354 
1364  lcb_error_t (*done)(struct lcb_MULTICMD_CTX_st *ctx, const void *cookie);
1365 
1373  void (*fail)(struct lcb_MULTICMD_CTX_st *ctx);
1374 
1375 #ifdef LCB_TRACING
1376 
1382  void (*setspan)(struct lcb_MULTICMD_CTX_st *ctx, lcbtrace_SPAN *span);
1383 #endif
1403 typedef enum {
1410 
1424 
1433 } lcb_DURMODE;
1434 
1436 typedef struct {
1445  lcb_U32 timeout;
1446 
1455  lcb_U32 interval;
1456 
1470  lcb_U16 persist_to;
1471 
1485  lcb_U16 replicate_to;
1486 
1493 
1498  lcb_U8 cap_max;
1499 
1504  lcb_U8 pollopts;
1506 
1509 typedef struct lcb_durability_opts_st {
1510  int version;
1511  union {
1513  } v;
1515 
1518 #define LCB_CMDENDURE_F_MUTATION_TOKEN (1 << 16)
1519 
1527 typedef struct {
1528  LCB_CMD_BASE;
1529  const lcb_MUTATION_TOKEN *mutation_token;
1530 } lcb_CMDENDURE;
1531 
1533 typedef struct {
1534  LCB_RESP_BASE
1539  lcb_U16 nresponses;
1540 
1546 
1552 
1557  lcb_U8 npersisted;
1558 
1563  lcb_U8 nreplicated;
1564 } lcb_RESPENDURE;
1565 
1686 LIBCOUCHBASE_API
1688 lcb_endure3_ctxnew(lcb_t instance,
1689  const lcb_durability_opts_t *options, lcb_error_t *err);
1690 
1695 typedef struct {
1696  LCB_CMD_BASE;
1698  lcb_U32 flags;
1699  lcb_datatype_t datatype;
1708 
1715 } lcb_CMDSTOREDUR;
1716 
1720 typedef struct {
1721  LCB_RESP_BASE
1724 
1731 
1740 LIBCOUCHBASE_API
1742 lcb_storedur3(lcb_t instance, const void *cookie, const lcb_CMDSTOREDUR *cmd);
1743 
1744 #define LCB_DURABILITY_VALIDATE_CAPMAX (1 << 1)
1745 
1773 LIBCOUCHBASE_API
1776  lcb_U16 *persist_to, lcb_U16 *replicate_to, int options);
1787 #define LCB_CMDOBSERVE_F_MASTER_ONLY (1 << 16)
1788 
1793 typedef struct {
1794  LCB_CMD_BASE;
1797  const lcb_U16* servers_;
1798  size_t nservers_;
1799 } lcb_CMDOBSERVE;
1800 
1804 typedef enum {
1813 
1814  LCB_OBSERVE_MAX = 0x82
1815 } lcb_observe_t;
1816 
1822 typedef struct {
1823  LCB_RESP_BASE
1824  lcb_U8 status;
1825  lcb_U8 ismaster;
1826  lcb_U32 ttp;
1827  lcb_U32 ttr;
1828 } lcb_RESPOBSERVE;
1829 
1865 LIBCOUCHBASE_API
1867 lcb_observe3_ctxnew(lcb_t instance);
1868 
1873 typedef struct {
1874  LCB_CMD_BASE;
1879  lcb_U16 server_index;
1880  lcb_U16 vbid;
1881  lcb_U64 uuid;
1882 } lcb_CMDOBSEQNO;
1883 
1890 typedef struct {
1891  LCB_RESP_BASE
1892  lcb_U16 vbid;
1893  lcb_U16 server_index;
1894  lcb_U64 cur_uuid;
1896  lcb_U64 mem_seqno;
1902  lcb_U64 old_uuid;
1903 
1908  lcb_U64 old_seqno;
1909 } lcb_RESPOBSEQNO;
1910 
1918 LIBCOUCHBASE_API
1920 lcb_observe_seqno3(lcb_t instance, const void *cookie, const lcb_CMDOBSEQNO *cmd);
1921 
1947 #define LCB_MUTATION_TOKEN_ID(p) ((p)->uuid_)
1948 
1949 #define LCB_MUTATION_TOKEN_SEQ(p) ((p)->seqno_)
1950 
1951 #define LCB_MUTATION_TOKEN_VB(p) ((p)->vbid_)
1952 
1953 #define LCB_MUTATION_TOKEN_ISVALID(p) \
1954  (p && !((p)->uuid_ == 0 && (p)->seqno_ == 0 && (p)->vbid_ == 0))
1955 
1965 LIBCOUCHBASE_API
1966 const lcb_MUTATION_TOKEN *
1967 lcb_resp_get_mutation_token(int cbtype, const lcb_RESPBASE *rb);
1968 
2018 LIBCOUCHBASE_API
2019 const lcb_MUTATION_TOKEN *
2020 lcb_get_mutation_token(lcb_t instance, const lcb_KEYBUF *kb, lcb_error_t *errp);
2021 
2047 typedef struct {
2048  LCB_CMD_BASE;
2052  lcb_int64_t delta;
2055  lcb_U64 initial;
2058  int create;
2059 } lcb_CMDCOUNTER;
2060 
2065 typedef struct {
2066  LCB_RESP_BASE
2068  lcb_U64 value;
2069 } lcb_RESPCOUNTER;
2070 
2111 LIBCOUCHBASE_API
2113 lcb_counter3(lcb_t instance, const void *cookie, const lcb_CMDCOUNTER *cmd);
2140 
2144 
2168 LIBCOUCHBASE_API
2170 lcb_unlock3(lcb_t instance, const void *cookie, const lcb_CMDUNLOCK *cmd);
2193 
2197 
2224 LIBCOUCHBASE_API
2226 lcb_touch3(lcb_t instance, const void *cookie, const lcb_CMDTOUCH *cmd);
2250 
2256 #define LCB_CMDSTATS_F_KV (1 << 16)
2257 
2262 typedef struct {
2263  LCB_RESP_BASE
2264  LCB_RESP_SERVER_FIELDS
2265  const char *value;
2266  lcb_SIZE nvalue;
2267 } lcb_RESPSTATS;
2268 
2308 LIBCOUCHBASE_API
2310 lcb_stats3(lcb_t instance, const void *cookie, const lcb_CMDSTATS * cmd);
2320 typedef struct {
2321  LCB_RESP_BASE
2322  LCB_RESP_SERVER_FIELDS
2323  const char *mcversion;
2324  lcb_SIZE nversion;
2326 
2330 LIBCOUCHBASE_API
2332 lcb_server_versions3(lcb_t instance, const void *cookie, const lcb_CMDBASE * cmd);
2333 
2342 typedef enum {
2343  LCB_VERBOSITY_DETAIL = 0x00,
2344  LCB_VERBOSITY_DEBUG = 0x01,
2345  LCB_VERBOSITY_INFO = 0x02,
2346  LCB_VERBOSITY_WARNING = 0x03
2348 
2349 typedef struct {
2350  /* unused */
2351  LCB_CMD_BASE;
2352  const char *server;
2353  lcb_verbosity_level_t level;
2354 } lcb_CMDVERBOSITY;
2357 LIBCOUCHBASE_API
2359 lcb_server_verbosity3(lcb_t instance, const void *cookie, const lcb_CMDVERBOSITY *cmd);
2374 typedef lcb_CMDBASE lcb_CMDCBFLUSH;
2376 
2399 LIBCOUCHBASE_API
2401 lcb_cbflush3(lcb_t instance, const void *cookie, const lcb_CMDCBFLUSH *cmd);
2402 
2403 
2404 typedef lcb_CMDBASE lcb_CMDFLUSH;
2410 LIBCOUCHBASE_API
2412 lcb_flush3(lcb_t instance, const void *cookie, const lcb_CMDFLUSH *cmd);
2423 typedef lcb_CMDBASE lcb_CMDNOOP;
2425 
2436 LIBCOUCHBASE_API
2438 lcb_noop3(lcb_t instance, const void *cookie, const lcb_CMDNOOP *cmd);
2453 #define LCB_PINGSVC_F_KV 0x01
2454 
2458 #define LCB_PINGSVC_F_N1QL 0x02
2459 
2463 #define LCB_PINGSVC_F_VIEWS 0x04
2464 
2468 #define LCB_PINGSVC_F_FTS 0x08
2469 
2473 #define LCB_PINGSVC_F_ANALYTICS 0x10
2474 
2481 #define LCB_PINGOPT_F_NOMETRICS 0x01
2482 
2487 #define LCB_PINGOPT_F_JSON 0x02
2488 
2493 #define LCB_PINGOPT_F_JSONDETAILS 0x04
2494 
2498 #define LCB_PINGOPT_F_JSONPRETTY 0x08
2499 
2505 typedef struct {
2506  LCB_CMD_BASE;
2507  int services;
2508  int options;
2509  const char *id;
2510 } lcb_CMDPING;
2511 
2517 typedef enum {
2518  LCB_PINGSVC_KV = 0,
2519  LCB_PINGSVC_VIEWS,
2520  LCB_PINGSVC_N1QL,
2521  LCB_PINGSVC_FTS,
2522  LCB_PINGSVC_ANALYTICS,
2523  LCB_PINGSVC__MAX
2524 } lcb_PINGSVCTYPE;
2525 
2531 typedef enum {
2532  LCB_PINGSTATUS_OK = 0,
2533  LCB_PINGSTATUS_TIMEOUT,
2534  LCB_PINGSTATUS_ERROR,
2535  LCB_PINGSTATUS__MAX
2536 } lcb_PINGSTATUS;
2537 
2544 typedef struct {
2546  /* TODO: rename to "remote" */
2547  const char *server;
2548  lcb_U64 latency;
2550  const char *local;
2551  const char *id;
2552  const char *scope;
2554 } lcb_PINGSVC;
2555 
2561 typedef struct {
2562  LCB_RESP_BASE
2563  LCB_RESP_SERVER_FIELDS
2564  lcb_SIZE nservices;
2566  lcb_SIZE njson;
2567  const char *json;
2568 } lcb_RESPPING;
2569 
2608 LIBCOUCHBASE_API
2610 lcb_ping3(lcb_t instance, const void *cookie, const lcb_CMDPING *cmd);
2611 
2612 typedef struct {
2613  LCB_CMD_BASE;
2614  int options;
2615  const char *id;
2616 } lcb_CMDDIAG;
2617 
2618 typedef struct {
2619  LCB_RESP_BASE
2620  lcb_SIZE njson;
2621  const char *json;
2622 } lcb_RESPDIAG;
2623 
2657 LIBCOUCHBASE_API
2658 lcb_error_t lcb_diag(lcb_t instance, const void *cookie, const lcb_CMDDIAG *cmd);
2677 typedef enum {
2683 
2691 
2696 
2699 
2702 
2705 
2712 
2713  LCB_HTTP_TYPE_MAX
2714 } lcb_http_type_t;
2715 
2722 typedef enum {
2723  LCB_HTTP_METHOD_GET = 0,
2724  LCB_HTTP_METHOD_POST = 1,
2725  LCB_HTTP_METHOD_PUT = 2,
2726  LCB_HTTP_METHOD_DELETE = 3,
2727  LCB_HTTP_METHOD_MAX = 4
2729 
2739 #define LCB_CMDHTTP_F_STREAM (1 << 16)
2740 
2746 #define LCB_CMDHTTP_F_CASTMO (1 << 17)
2747 
2752 #define LCB_CMDHTTP_F_NOUPASS (1 << 18)
2753 
2758 typedef struct {
2759  LCB_CMD_BASE;
2769  const char *body;
2770 
2772  lcb_SIZE nbody;
2773 
2776  lcb_http_request_t *reqhandle;
2777 
2779  const char *content_type;
2780 
2783  const char *username;
2784 
2787  const char *password;
2788 
2791  const char *host;
2792 } lcb_CMDHTTP;
2793 
2802 typedef struct {
2803  LCB_RESP_BASE
2807  short htstatus;
2808 
2811  const char * const * headers;
2812 
2815  const void *body;
2817  lcb_SIZE nbody;
2819  lcb_http_request_t _htreq;
2820 } lcb_RESPHTTP;
2821 
2876 LIBCOUCHBASE_API
2878 lcb_http3(lcb_t instance, const void *cookie, const lcb_CMDHTTP *cmd);
2879 
2903 LIBCOUCHBASE_API
2904 void
2905 lcb_cancel_http_request(lcb_t instance, lcb_http_request_t request);
2971 LIBCOUCHBASE_API
2972 void lcb_set_cookie(lcb_t instance, const void *cookie);
2973 
2981 LIBCOUCHBASE_API
2982 const void *lcb_get_cookie(lcb_t instance);
3014 LIBCOUCHBASE_API
3015 lcb_error_t lcb_wait(lcb_t instance);
3016 
3043 LIBCOUCHBASE_API
3045 
3047 typedef enum {
3050 
3059 } lcb_WAITFLAGS;
3060 
3068 LIBCOUCHBASE_API
3069 void lcb_wait3(lcb_t instance, lcb_WAITFLAGS flags);
3070 
3082 LIBCOUCHBASE_API
3083 void lcb_breakout(lcb_t instance);
3084 
3091 LIBCOUCHBASE_API
3092 int lcb_is_waiting(lcb_t instance);
3151 LIBCOUCHBASE_API
3152 void
3153 lcb_refresh_config(lcb_t instance);
3154 
3229 LIBCOUCHBASE_API
3230 void lcb_sched_enter(lcb_t instance);
3231 
3250 LIBCOUCHBASE_API
3251 void lcb_sched_leave(lcb_t instance);
3252 
3253 
3280 LIBCOUCHBASE_API
3281 void lcb_sched_fail(lcb_t instance);
3282 
3300 LIBCOUCHBASE_API
3301 void lcb_sched_flush(lcb_t instance);
3302 
3321 LIBCOUCHBASE_API
3322 void lcb_destroy(lcb_t instance);
3323 
3328 typedef void (*lcb_destroy_callback)(const void *cookie);
3329 
3335 LIBCOUCHBASE_API
3364 LIBCOUCHBASE_API
3365 void lcb_destroy_async(lcb_t instance, const void *arg);
3371 #define LCB_DATATYPE_JSON 0x01
3372 
3374 typedef enum { LCB_VALUE_RAW = 0x00, LCB_VALUE_F_JSON = 0x01, LCB_VALUE_F_SNAPPYCOMP = 0x02 } lcb_VALUEFLAGS;
3375 
3376 
3392 typedef enum {
3401 
3407 
3410 
3416 } lcb_GETNODETYPE;
3417 
3420 #define LCB_GETNODE_UNAVAILABLE "invalid_host:0"
3421 
3464 LIBCOUCHBASE_API
3465 const char *
3466 lcb_get_node(lcb_t instance, lcb_GETNODETYPE type, unsigned index);
3467 
3485 LIBCOUCHBASE_API
3486 const char *
3487 lcb_get_keynode(lcb_t instance, const void *key, size_t nkey);
3488 
3497 LIBCOUCHBASE_API
3498 lcb_S32 lcb_get_num_replicas(lcb_t instance);
3499 
3506 LIBCOUCHBASE_API
3507 lcb_S32 lcb_get_num_nodes(lcb_t instance);
3508 
3509 
3527 LIBCOUCHBASE_API
3528 const char *const *lcb_get_server_list(lcb_t instance);
3529 
3544 LIBCOUCHBASE_API
3545 void
3546 lcb_dump(lcb_t instance, FILE *fp, lcb_U32 flags);
3608 LIBCOUCHBASE_API
3609 lcb_error_t lcb_cntl(lcb_t instance, int mode, int cmd, void *arg);
3610 
3676 LIBCOUCHBASE_API
3678 lcb_cntl_string(lcb_t instance, const char *key, const char *value);
3679 
3688 LIBCOUCHBASE_API
3689 lcb_error_t lcb_cntl_setu32(lcb_t instance, int cmd, lcb_U32 arg);
3690 
3700 LIBCOUCHBASE_API
3701 lcb_U32 lcb_cntl_getu32(lcb_t instance, int cmd);
3702 
3708 LIBCOUCHBASE_API
3709 int
3710 lcb_cntl_exists(int ctl); /* settings */
3712 
3794 };
3795 typedef enum lcb_timeunit_t lcb_timeunit_t;
3796 
3809 LIBCOUCHBASE_API
3811 
3812 
3821 LIBCOUCHBASE_API
3823 
3839 typedef void (*lcb_timings_callback)(lcb_t instance,
3840  const void *cookie,
3841  lcb_timeunit_t timeunit,
3842  lcb_U32 min,
3843  lcb_U32 max,
3844  lcb_U32 total,
3845  lcb_U32 maxtotal);
3846 
3856 LIBCOUCHBASE_API
3858  const void *cookie,
3859  lcb_timings_callback callback);
3875 #if !defined(LCB_VERSION_STRING) || defined(__LCB_DOXYGEN__)
3876 
3877 #define LCB_VERSION_STRING "unknown"
3878 #endif
3879 
3880 #if !defined(LCB_VERSION) || defined(__LCB_DOXYGEN__)
3881 
3896 #define LCB_VERSION 0x000000
3897 #endif
3898 
3899 #if !defined(LCB_VERSION_CHANGESET) || defined(__LCB_DOXYGEN__)
3900 
3901 #define LCB_VERSION_CHANGESET "0xdeadbeef"
3902 #endif
3903 
3914 LIBCOUCHBASE_API
3915 const char *lcb_get_version(lcb_U32 *version);
3916 
3918 LIBCOUCHBASE_API LCB_EXTERN_VAR
3919 const lcb_U32 lcb_version_g;
3920 
3922 #define LCB_SUPPORTS_SSL 1
3923 
3924 #define LCB_SUPPORTS_SNAPPY 2
3925 
3926 #define LCB_SUPPORTS_TRACING 3
3927 
3934 LIBCOUCHBASE_API
3935 int
3936 lcb_supports_feature(int n);
3937 
3946 LIBCOUCHBASE_API
3947 void *lcb_mem_alloc(lcb_SIZE size);
3948 
3950 LIBCOUCHBASE_API
3951 void lcb_mem_free(void *ptr);
3952 
3962 LCB_INTERNAL_API
3963 void lcb_run_loop(lcb_t instance);
3964 
3966 LCB_INTERNAL_API
3967 void lcb_stop_loop(lcb_t instance);
3968 
3970 /* This returns the library's idea of time */
3971 LCB_INTERNAL_API
3972 lcb_U64 lcb_nstime(void);
3973 
3974 typedef enum {
3985 } lcb_DUMPFLAGS;
3986 
3988 struct lcb_histogram_st;
3989 typedef struct lcb_histogram_st lcb_HISTOGRAM;
3990 
3996 LIBCOUCHBASE_API
3997 lcb_HISTOGRAM *
3998 lcb_histogram_create(void);
3999 
4004 LIBCOUCHBASE_API
4005 void
4006 lcb_histogram_destroy(lcb_HISTOGRAM *hg);
4007 
4014 LIBCOUCHBASE_API
4015 void
4016 lcb_histogram_record(lcb_HISTOGRAM *hg, lcb_U64 duration);
4017 
4018 typedef void (*lcb_HISTOGRAM_CALLBACK)
4019  (const void *cookie, lcb_timeunit_t timeunit, lcb_U32 min, lcb_U32 max,
4020  lcb_U32 total, lcb_U32 maxtotal);
4021 
4029 LIBCOUCHBASE_API
4030 void
4031 lcb_histogram_read(const lcb_HISTOGRAM *hg, const void *cookie,
4032  lcb_HISTOGRAM_CALLBACK cb);
4033 
4044 LIBCOUCHBASE_API
4045 void lcb_histogram_print(lcb_HISTOGRAM* hg, FILE* stream);
4046 
4058 LIBCOUCHBASE_API
4059 const char *
4060 lcb_resp_get_error_context(int cbtype, const lcb_RESPBASE *rb);
4061 
4072 LIBCOUCHBASE_API
4073 const char *
4074 lcb_resp_get_error_ref(int cbtype, const lcb_RESPBASE *rb);
4075 
4082 LIBCOUCHBASE_API
4083 int lcb_is_redacting_logs(lcb_t instance);
4084 
4085 /* Post-include some other headers */
4086 #ifdef __cplusplus
4087 }
4088 #endif /* __cplusplus */
4089 #include <libcouchbase/subdoc.h>
4090 #include <libcouchbase/deprecated.h>
4091 #include <libcouchbase/api-legacy.h>
4092 #endif /* LIBCOUCHBASE_COUCHBASE_H */
Structure for performing an HTTP request.
Definition: couchbase.h:2758
const void * value
Value buffer for the item.
Definition: couchbase.h:870
Special pseudo-type, for ping endpoints in various services.
Definition: couchbase.h:2711
void lcb_dump(lcb_t instance, FILE *fp, lcb_U32 flags)
Write a textual dump to a file.
lcb_datatype_t datatype
Do not set this value for now.
Definition: couchbase.h:1123
int lcb_supports_feature(int n)
Execute an arbitrary request against a host and port.
Definition: couchbase.h:2695
int version
Indicates which field in the lcb_CRST_u union should be used.
Definition: couchbase.h:330
Dump memory usage/reservation information about buffers.
Definition: couchbase.h:3980
void lcb_set_auth(lcb_t instance, lcb_AUTHENTICATOR *auth)
Sets the authenticator object for the instance.
lcb_MULTICMD_CTX * lcb_observe3_ctxnew(lcb_t instance)
Create a new multi context for an observe operation.
void lcb_destroy_async(lcb_t instance, const void *arg)
Asynchronously schedule the destruction of an instance.
lcb_error_t lcb_cbflush3(lcb_t instance, const void *cookie, const lcb_CMDCBFLUSH *cmd)
lcb_stats3()
Definition: couchbase.h:719
The item missing on the disk and the memory.
Definition: couchbase.h:1810
Unknown or unspecified.
Definition: couchbase.h:258
Handle for administrative access.
Definition: couchbase.h:249
lcb_U32 ttr
Unused.
Definition: couchbase.h:1827
void lcb_refresh_config(lcb_t instance)
Force the library to refetch the cluster configuration.
lcb_RESPCALLBACK lcb_install_callback3(lcb_t instance, int cbtype, lcb_RESPCALLBACK cb)
LCB_INTERNAL_API void lcb_stop_loop(lcb_t instance)
Search a fulltext index.
Definition: couchbase.h:2701
lcb_observe3_ctxnew()
Definition: couchbase.h:723
Options for lcb_endure3_ctxnew() (wrapper)
Definition: couchbase.h:1509
struct lcb_io_opt_st * io
IO Options.
Definition: couchbase.h:296
void(* lcb_bootstrap_callback)(lcb_t instance, lcb_error_t err)
Bootstrap callback.
Definition: couchbase.h:424
int options
extra options, e.g.
Definition: couchbase.h:2508
Time is in nanoseconds.
Definition: couchbase.h:3790
Response structure for the version command.
Definition: couchbase.h:2320
Response structure for counter operations.
Definition: couchbase.h:2065
void(* lcb_destroy_callback)(const void *cookie)
Callback received when instance is about to be destroyed.
Definition: couchbase.h:3328
lcb_timeunit_t
Time units reported by lcb_get_timings()
Definition: couchbase.h:3789
Only return a node which is connected, or a node which is known to be up.
Definition: couchbase.h:3400
Response structure for cluster statistics.
Definition: couchbase.h:2262
lcb_verbosity_level_t
level field for lcb_server_verbosity3 ()
Definition: couchbase.h:2342
Execute an N1QL Query.
Definition: couchbase.h:2698
lcb_datatype_t datatype
Definition: couchbase.h:1699
lcb_error_t lcb_noop3(lcb_t instance, const void *cookie, const lcb_CMDNOOP *cmd)
lcb_error_t lcb_server_verbosity3(lcb_t instance, const void *cookie, const lcb_CMDVERBOSITY *cmd)
lcb_error_t lcb_unlock3(lcb_t instance, const void *cookie, const lcb_CMDUNLOCK *cmd)
Unlock a previously locked item using lcb_CMDGET::lock.
Use sequence-number based polling.
Definition: couchbase.h:1432
lcb_error_t lcb_wait(lcb_t instance)
Wait for the execution of all batched requests.
Use the preferred durability.
Definition: couchbase.h:1409
const char * id
optional, zero-terminated string to identify the report
Definition: couchbase.h:2509
void lcb_sched_enter(lcb_t instance)
Enter a scheduling context.
void lcb_sched_flush(lcb_t instance)
Request commands to be flushed to the network.
Query all the replicas sequentially, retrieving the first successful response.
Definition: couchbase.h:937
void(* lcb_timings_callback)(lcb_t instance, const void *cookie, lcb_timeunit_t timeunit, lcb_U32 min, lcb_U32 max, lcb_U32 total, lcb_U32 maxtotal)
The following function is called for each bucket in the timings histogram when you call lcb_get_timin...
Definition: couchbase.h:3839
lcb_U32 itmflags
User-defined flags for the item.
Definition: couchbase.h:874
const char * connstr
Connection string.
Definition: couchbase.h:282
const char * json
pointer to JSON string
Definition: couchbase.h:2567
Response structure for endure.
Definition: couchbase.h:1533
Data persisted and replicated.
Definition: couchbase.h:259
void lcb_histogram_read(const lcb_HISTOGRAM *hg, const void *cookie, lcb_HISTOGRAM_CALLBACK cb)
Response structure for lcb_observe_seqno3()
Definition: couchbase.h:1890
lcb_error_t lcb_get_bootstrap_status(lcb_t instance)
Gets the initial bootstrap status.
lcb_CMDBASE lcb_CMDTOUCH
Command structure for a touch request.
Definition: couchbase.h:2192
lcb_BTYPE
Type of the bucket.
Definition: couchbase.h:257
lcb_RESPBASE lcb_RESPREMOVE
Response structure for removal operation.
Definition: couchbase.h:1267
Default callback invoked as a fallback.
Definition: couchbase.h:712
Command structure for lcb_storedur3() This is much like lcb_CMDSTORE, but also includes durability op...
Definition: couchbase.h:1695
Time is in microseconds.
Definition: couchbase.h:3791
lcb_PINGSVCTYPE type
type of the service
Definition: couchbase.h:2545
LCB_EXTERN_VAR const lcb_U32 lcb_version_g
Global/extern variable containing the version of the library.
Definition: couchbase.h:3919
lcb_error_t lcb_diag(lcb_t instance, const void *cookie, const lcb_CMDDIAG *cmd)
Returns diagnostics report about network connections.
void lcb_wait3(lcb_t instance, lcb_WAITFLAGS flags)
Wait for completion of scheduled operations.
Response structure for lcb_store3()
Definition: couchbase.h:1135
Credentials store for Couchbase.
lcb_DURMODE
Type of durability polling to use.
Definition: couchbase.h:1403
lcb_U64 cur_uuid
UUID for this vBucket as known to the server.
Definition: couchbase.h:1894
Deprecated APIs.
Will cause the operation to fail unless the key already exists in the cluster.
Definition: couchbase.h:1068
void * lcb_mem_alloc(lcb_SIZE size)
Functions to allocate and free memory related to libcouchbase.
lcb_error_t lcb_http3(lcb_t instance, const void *cookie, const lcb_CMDHTTP *cmd)
lcb_error_t lcb_ping3(lcb_t instance, const void *cookie, const lcb_CMDPING *cmd)
Check connections by sending NOOP-like messages to all services.
lcb_PINGSVCTYPE
Type of the service.
Definition: couchbase.h:2517
lcb_error_t lcb_touch3(lcb_t instance, const void *cookie, const lcb_CMDTOUCH *cmd)
Spool a touch request.
int lock
If set to true, the exptime field inside options will take to mean the time the lock should be held.
Definition: couchbase.h:864
lcb_http_method_t
HTTP Request method enumeration These just enumerate the various types of HTTP request methods suppor...
Definition: couchbase.h:2722
lcb_error_t lcb_counter3(lcb_t instance, const void *cookie, const lcb_CMDCOUNTER *cmd)
Schedule single counter operation.
const char * lcb_strcbtype(int cbtype)
Returns the type of the callback as a string.
lcb_SIZE nvalue
Length of value.
Definition: couchbase.h:871
lcb_storage_t operation
Definition: couchbase.h:1700
Base structure for informational commands from servers This contains an additional lcb_RESPSERVERBASE...
Definition: couchbase.h:655
const char * scope
optional scope name (typically equals to the bucket name)
Definition: couchbase.h:2552
lcb_U32 lcb_cntl_getu32(lcb_t instance, int cmd)
Retrieve an lcb_U32 setting.
lcb_U32 flags
Definition: couchbase.h:1698
const char * local
server host:port
Definition: couchbase.h:2550
The response was a result of a not-my-vbucket error.
Definition: couchbase.h:684
Common ABI header for all commands.
Definition: couchbase.h:535
Like LCB_APPEND, but prepends the new value to the existing value.
Definition: couchbase.h:1093
lcb_U8 check_delete
this flag inverts the sense of the durability check and ensures that the key does not exist.
Definition: couchbase.h:1492
This union contains the set of current and historical options.
Definition: couchbase.h:334
lcb_server_versions3()
Definition: couchbase.h:720
struct lcb_create_st3 v3
Use this field.
Definition: couchbase.h:338
Response structure for an observe command.
Definition: couchbase.h:1822
lcb_U64 value
Contains the current value after the operation was performed.
Definition: couchbase.h:2068
lcb_error_t lcb_get_timings(lcb_t instance, const void *cookie, lcb_timings_callback callback)
Get the timings histogram.
lcb_storage_t
Values for lcb_CMDSTORE::operation.
Definition: couchbase.h:1057
lcb_get3()
Definition: couchbase.h:713
int index
Valid only when strategy is LCB_REPLICA_SELECT, specifies the replica index number to query.
Definition: couchbase.h:988
lcb_U16 nresponses
Total number of polls (i.e.
Definition: couchbase.h:1539
Execute a management API request.
Definition: couchbase.h:2690
Handle for data access (default)
Definition: couchbase.h:248
char replicate_to
Number of nodes to replicate to.
Definition: couchbase.h:1714
Equivalent to LCB_NODE_HTCONFIG|LCB_NODE_CONNECTED
Definition: couchbase.h:3409
Dump the raw vbucket configuration.
Definition: couchbase.h:3976
lcb_http3()
Definition: couchbase.h:726
lcb_error_t lcb_cntl_setu32(lcb_t instance, int cmd, lcb_U32 arg)
Convenience function to set a value as an lcb_U32.
lcb_VALUEFLAGS
Definition: couchbase.h:3374
int lcb_cntl_exists(int ctl)
Determine if a specific control code exists.
lcb_touch3()
Definition: couchbase.h:716
void lcb_histogram_destroy(lcb_HISTOGRAM *hg)
Options for lcb_endure3_ctxnew()
Definition: couchbase.h:1436
Structure for PING requests.
Definition: couchbase.h:2505
void lcb_destroy(lcb_t instance)
Destroy (and release all allocated resources) an instance of lcb.
lcb_error_t lcb_connect(lcb_t instance)
Schedule the initial connection This function will schedule the initial connection for the handle.
Get a view (CAPI) node.
Definition: couchbase.h:3398
lcb_destroy_callback lcb_set_destroy_callback(lcb_t, lcb_destroy_callback)
Set the callback to be invoked when the instance is destroyed asynchronously.
void(* lcb_RESPCALLBACK)(lcb_t instance, int cbtype, const lcb_RESPBASE *resp)
Callback invoked for responses.
Definition: couchbase.h:763
Definition of all of the error codes used by libcouchbase.
lcb_observe_t
Possible statuses for keys in OBSERVE response.
Definition: couchbase.h:1804
lcb_VALBUF value
Definition: couchbase.h:1697
lcb_error_t rc
raw return code of the operation
Definition: couchbase.h:2549
Command structure for endure.
Definition: couchbase.h:1527
Time is in milliseconds.
Definition: couchbase.h:3792
lcb_SIZE nvalue
Length of value.
Definition: couchbase.h:2266
The item found in the memory, but not yet on the disk.
Definition: couchbase.h:1806
lcb_U8 pollopts
Set the polling method to use.
Definition: couchbase.h:1504
lcb_cbflush3()
Definition: couchbase.h:727
const char * mcversion
The version string.
Definition: couchbase.h:2323
lcb_U32 interval
The durability check may involve more than a single call to observe - or more than a single packet se...
Definition: couchbase.h:1455
Structure representing a synchronization token.
Definition: couchbase.h:661
Multi Command Context API Some commands (notably, OBSERVE and its higher level equivalent,...
Definition: couchbase.h:1346
lcb_int64_t delta
Delta value.
Definition: couchbase.h:2052
lcb_CMDBASE lcb_CMDUNLOCK
Command for lcb_unlock3()
Definition: couchbase.h:2139
Equivalent to LCB_NODE_HTCONFIG|LCB_NODE_NEVERNULL.
Definition: couchbase.h:3415
Will cause the operation to fail if the key already exists in the cluster.
Definition: couchbase.h:1062
lcb_datatype_t datatype
Definition: couchbase.h:873
lcb_error_t lcb_store3(lcb_t instance, const void *cookie, const lcb_CMDSTORE *cmd)
Schedule a single storage request.
lcb_error_t lcb_durability_validate(lcb_t instance, lcb_U16 *persist_to, lcb_U16 *replicate_to, int options)
const lcb_MUTATION_TOKEN * lcb_get_mutation_token(lcb_t instance, const lcb_KEYBUF *kb, lcb_error_t *errp)
lcb_U32 timeout
Upper limit in microseconds from the scheduling of the command.
Definition: couchbase.h:1445
const lcb_RESPENDURE * dur_resp
Internal durability response structure.
Definition: couchbase.h:1723
const char * server
server host:port
Definition: couchbase.h:2547
lcb_flush3()
Definition: couchbase.h:722
lcb_U64 old_seqno
If old_uuid is nonzero, contains the highest sequence number persisted in the old_uuid snapshot.
Definition: couchbase.h:1908
The response was artificially generated inside the client.
Definition: couchbase.h:681
lcb_storage_t op
The type of operation which was performed.
Definition: couchbase.h:1139
lcb_U32 flags
Format flags used by clients to determine the underlying encoding of the value.
Definition: couchbase.h:1120
lcb_error_t lcb_observe_seqno3(lcb_t instance, const void *cookie, const lcb_CMDOBSEQNO *cmd)
Get the persistence/replication status for a given mutation token.
lcb_U64 old_uuid
In the case where the command's uuid is not the most current, this contains the last known UUID.
Definition: couchbase.h:1902
const char * lcb_resp_get_error_ref(int cbtype, const lcb_RESPBASE *rb)
Structure for an observe request.
Definition: couchbase.h:1793
lcb_unlock3()
Definition: couchbase.h:718
lcb_U16 vbid_
Use LCB_MUTATION_TOKEN_VB()
Definition: couchbase.h:664
lcb_S32 lcb_get_num_nodes(lcb_t instance)
Get the number of the nodes in the cluster.
Structure for PING responses.
Definition: couchbase.h:2561
Query all the replicas concurrently, retrieving all the responses.
Definition: couchbase.h:940
lcb_error_t lcb_tick_nowait(lcb_t instance)
Opaque pointer containing credentials for the library.
lcb_CALLBACKTYPE
The type of response passed to the callback.
Definition: couchbase.h:711
lcb_replica_t
Select get-replica mode.
Definition: couchbase.h:934
lcb_replica_t strategy
Strategy for selecting a replica.
Definition: couchbase.h:981
Command codes for libcouchbase.
lcb_SIZE nservices
number of the nodes, replied to ping
Definition: couchbase.h:2564
const char * password
Password to authenticate with, if left empty, will use the credentials passed to lcb_create()
Definition: couchbase.h:2787
const char * body
If the request requires a body (e.g.
Definition: couchbase.h:2769
lcb_http_type_t type
Type of request to issue.
Definition: couchbase.h:2764
lcb_U8 exists_master
Whether this item exists in the master in its current form.
Definition: couchbase.h:1545
Command for retrieving a single item.
Definition: couchbase.h:856
lcb_rget3()
Definition: couchbase.h:724
lcb_remove3()
Definition: couchbase.h:717
Data not persisted, but replicated.
Definition: couchbase.h:260
Command structure for lcb_observe_seqno3().
Definition: couchbase.h:1873
lcb_noop3()
Definition: couchbase.h:732
Low level structures used by commands for buffers.
Execute an Analytics Query.
Definition: couchbase.h:2704
Command for counter operations.
Definition: couchbase.h:2047
const char * username
Username to use for authentication.
Definition: couchbase.h:288
lcb_U8 nreplicated
Total number of replica nodes to which this mutation has been replicated.
Definition: couchbase.h:1563
lcb_error_t lcb_server_versions3(lcb_t instance, const void *cookie, const lcb_CMDBASE *cmd)
int lcb_is_redacting_logs(lcb_t instance)
lcb_bootstrap_callback lcb_set_bootstrap_callback(lcb_t instance, lcb_bootstrap_callback callback)
Set the callback for notification of success or failure of initial connection.
lcb_U16 replicate_to
how many nodes the key should be persisted to (excluding master).
Definition: couchbase.h:1485
Entry describing the status of the service in the cluster.
Definition: couchbase.h:2544
lcb_counter3()
Definition: couchbase.h:715
Query the specific replica specified by the lcb_rget3_cmd_t::index field.
Definition: couchbase.h:944
Structure for HTTP responses.
Definition: couchbase.h:2802
lcb_U16 server_index
Server index to target.
Definition: couchbase.h:1879
lcb_store3()
Definition: couchbase.h:714
lcb_U64 seqno_
Use LCB_MUTATION_TOKEN_SEQ()
Definition: couchbase.h:663
lcb_U64 uuid_
Use LCB_MUTATION_TOKEN_ID()
Definition: couchbase.h:662
Dump various metrics information.
Definition: couchbase.h:3982
const char * username
Username to authenticate with, if left empty, will use the credentials passed to lcb_create()
Definition: couchbase.h:2783
void lcb_sched_leave(lcb_t instance)
Leave the current scheduling context, scheduling the commands within the context to be flushed to the...
lcb_U8 cap_max
If replication/persistence requirements are excessive, cap to the maximum available.
Definition: couchbase.h:1498
short htstatus
HTTP status code.
Definition: couchbase.h:2807
lcb_PINGSTATUS status
status of the operation
Definition: couchbase.h:2553
const char *const * headers
List of key-value headers.
Definition: couchbase.h:2811
lcb_U64 persisted_seqno
Highest persisted sequence.
Definition: couchbase.h:1895
lcb_CMDBASE lcb_CMDREMOVE
Command for removing an item from the server.
Definition: couchbase.h:1255
lcb_U8 persisted_master
True if item was persisted on the master node.
Definition: couchbase.h:1551
Get a data (memcached) node.
Definition: couchbase.h:3396
const char * value
The value, if any, for the given statistic.
Definition: couchbase.h:2265
lcb_server_verbosity3()
Definition: couchbase.h:721
int create
Boolean value.
Definition: couchbase.h:2058
Data not persisted and not replicated.
Definition: couchbase.h:261
int services
bitmap for services to ping
Definition: couchbase.h:2507
lcb_SIZE njson
length of JSON string (when LCB_PINGOPT_F_JSON was specified)
Definition: couchbase.h:2566
const char * lcb_get_keynode(lcb_t instance, const void *key, size_t nkey)
Get the target server for a given key.
Response structure for `LCB_CALLBACK_STOREDUR.
Definition: couchbase.h:1720
lcb_U64 uuid
UUID known to client which should be queried.
Definition: couchbase.h:1881
lcb_U64 latency
latency in nanoseconds
Definition: couchbase.h:2548
lcb_PINGSTATUS
Status of the service.
Definition: couchbase.h:2531
lcb_logprocs * logger
Logger.
Definition: couchbase.h:319
struct lcb_st * lcb_t
Library handle representing a connection to a cluster and its data buckets.
Definition: couchbase.h:41
Base response structure for callbacks.
Definition: couchbase.h:641
const char * content_type
For views, set this to application/json
Definition: couchbase.h:2779
Wrapper structure for lcb_create()
Definition: couchbase.h:328
lcb_type_t
Handle types.
Definition: couchbase.h:247
lcb_error_t
Error codes returned by the library.
Definition: error.h:584
lcb_RESPFLAGS
Response flags.
Definition: couchbase.h:672
lcb_RESPCALLBACK lcb_get_callback3(lcb_t instance, int cbtype)
lcb_U8 npersisted
Total number of nodes (including master) on which this mutation has been persisted.
Definition: couchbase.h:1557
lcb_storage_t operation
Controls how the operation is perfomed.
Definition: couchbase.h:1129
void lcb_cancel_http_request(lcb_t instance, lcb_http_request_t request)
Cancel ongoing HTTP request.
Get an HTTP configuration (Rest API) node.
Definition: couchbase.h:3394
lcb_MULTICMD_CTX * lcb_endure3_ctxnew(lcb_t instance, const lcb_durability_opts_t *options, lcb_error_t *err)
Return a new command context for scheduling endure operations.
For lcb_observe_seqno3()
Definition: couchbase.h:728
lcb_error_t lcb_stats3(lcb_t instance, const void *cookie, const lcb_CMDSTATS *cmd)
Schedule a request for statistics from the cluster.
lcb_error_t lcb_enable_timings(lcb_t instance)
Start recording timing metrics for the different operations.
Specifying this flag adds additional semantics which instruct the library to search additional resour...
Definition: couchbase.h:3406
const char * lcb_get_version(lcb_U32 *version)
Get the version of the library.
Unconditionally store the item in the cluster.
Definition: couchbase.h:1071
Behave like the old lcb_wait()
Definition: couchbase.h:3049
Flag, only valid for subdoc responses, indicates that the response was processed using the single-ope...
Definition: couchbase.h:692
int lcb_is_waiting(lcb_t instance)
Check if instance is blocked in the event loop.
char persist_to
Number of nodes to persist to.
Definition: couchbase.h:1707
const char * lcb_get_node(lcb_t instance, lcb_GETNODETYPE type, unsigned index)
Return a string of host:port for a node of the given type.
lcb_PINGSVC * services
the nodes, replied to ping, if any
Definition: couchbase.h:2565
lcb_http_request_t * reqhandle
If non-NULL, will be assigned a handle which may be used to subsequently cancel the request.
Definition: couchbase.h:2776
lcb_error_t lcb_create(lcb_t *instance, const struct lcb_create_st *options)
Create an instance of lcb.
lcb_error_t lcb_get3(lcb_t instance, const void *cookie, const lcb_CMDGET *cmd)
Spool a single get operation.
lcb_RESPBASE lcb_RESPTOUCH
Response structure for a touch request.
Definition: couchbase.h:2196
Time is in seconds.
Definition: couchbase.h:3793
Command for requesting an item from a replica.
Definition: couchbase.h:958
LCB_INTERNAL_API void lcb_run_loop(lcb_t instance)
void lcb_breakout(lcb_t instance)
Forcefully break from the event loop.
lcb_RESPBASE lcb_RESPUNLOCK
Response structure for an unlock command.
Definition: couchbase.h:2143
lcb_error_t lcb_flush3(lcb_t instance, const void *cookie, const lcb_CMDFLUSH *cmd)
const char * lcb_resp_get_error_context(int cbtype, const lcb_RESPBASE *rb)
lcb_ping3()
Definition: couchbase.h:733
const char * host
If set, this must be a string in the form of http://host:port.
Definition: couchbase.h:2791
lcb_U8 status
Bit set of flags.
Definition: couchbase.h:1824
Logging context.
Definition: cntl.h:447
lcb_error_t lcb_disable_timings(lcb_t instance)
Stop recording (and release all resources from previous measurements) timing metrics.
lcb_U64 mem_seqno
Highest known sequence.
Definition: couchbase.h:1896
void lcb_sched_fail(lcb_t instance)
Fail all commands in the current scheduling context.
const char *const * lcb_get_server_list(lcb_t instance)
Get a list of nodes in the cluster.
Dump information about each packet.
Definition: couchbase.h:3978
lcb_DUMPFLAGS
Definition: couchbase.h:3974
lcb_diag()
Definition: couchbase.h:734
lcb_U16 vbid
vBucket ID to query
Definition: couchbase.h:1880
No more responses are to be received for this request.
Definition: couchbase.h:674
lcb_http_request_t _htreq
Definition: couchbase.h:2819
const void * body
If LCB_CMDHTTP_F_STREAM is true, contains the current chunk of response content.
Definition: couchbase.h:2815
lcb_GETNODETYPE
Type of node to retrieve for the lcb_get_node() function.
Definition: couchbase.h:3392
lcb_error_t lcb_cntl_string(lcb_t instance, const char *key, const char *value)
Alternatively one may change configuration settings by passing a string key and value.
Rather than setting the contents of the entire document, take the value specified in lcb_CMDSTORE::va...
Definition: couchbase.h:1088
Execute a request against the bucket.
Definition: couchbase.h:2682
Do not check pending operations before running the event loop.
Definition: couchbase.h:3058
lcb_U64 initial
If the item does not exist on the server (and create is true) then this will be the initial value for...
Definition: couchbase.h:2055
int store_ok
If the rc field is not LCB_SUCCESS, this field indicates what failed.
Definition: couchbase.h:1729
void lcb_histogram_print(lcb_HISTOGRAM *hg, FILE *stream)
Print the histogram to the specified FILE.
lcb_VALBUF value
Value to store on the server.
Definition: couchbase.h:1113
Command for storing an item to the server.
Definition: couchbase.h:1106
The response has extra error information as value (see SDK-RFC-28).
Definition: couchbase.h:695
lcb_SIZE nversion
Length of the version string.
Definition: couchbase.h:2324
void lcb_histogram_record(lcb_HISTOGRAM *hg, lcb_U64 duration)
Dump everything.
Definition: couchbase.h:3984
lcb_http_method_t method
HTTP Method to use.
Definition: couchbase.h:2765
The response has additional internal data.
Definition: couchbase.h:688
lcb_WAITFLAGS
Flags for lcb_wait3()
Definition: couchbase.h:3047
lcb_error_t lcb_storedur3(lcb_t instance, const void *cookie, const lcb_CMDSTOREDUR *cmd)
lcb_endure3_ctxnew()
Definition: couchbase.h:725
Common request header for all keys.
Definition: kvbuf.h:66
lcb_U8 ismaster
Set to true if this response came from the master node.
Definition: couchbase.h:1825
lcb_error_t lcb_cntl(lcb_t instance, int mode, int cmd, void *arg)
This function exposes an ioctl/fcntl-like interface to read and write various configuration propertie...
Response structure when retrieving a single item.
Definition: couchbase.h:868
lcb_CMDBASE lcb_CMDSTATS
Command structure for stats request The lcb_CMDSTATS::key field should contain the statistics key,...
Definition: couchbase.h:2249
Public I/O integration interface.
lcb_SIZE nbody
Length of the body for the request.
Definition: couchbase.h:2772
lcb_U16 persist_to
how many nodes the key should be persisted to (including master).
Definition: couchbase.h:1470
lcb_HISTOGRAM * lcb_histogram_create(void)
lcb_http_type_t
The type of HTTP request to execute.
Definition: couchbase.h:2677
The item hit the disk.
Definition: couchbase.h:1808
End to end tracing.
lcb_S32 lcb_get_num_replicas(lcb_t instance)
Get the number of the replicas in the cluster.
Explicitly request CAS-based durability.
Definition: couchbase.h:1423
Inner structure V3 for lcb_create().
Definition: couchbase.h:281
Inner structure V4 for lcb_create().
Definition: couchbase.h:305
Structure representing a value to be stored.
Definition: kvbuf.h:115
const char * passwd
Password for bucket.
Definition: couchbase.h:293
No knowledge of the key :)
Definition: couchbase.h:1812
The default storage mode.
Definition: couchbase.h:1081
void lcb_mem_free(void *ptr)
Use this to free memory allocated with lcb_mem_alloc.
<for lcb_storedur3()
Definition: couchbase.h:730
LCB_INTERNAL_API lcb_U64 lcb_nstime(void)
lcb_error_t lcb_rget3(lcb_t instance, const void *cookie, const lcb_CMDGETREPLICA *cmd)
Spool a single get-with-replica request.
const lcb_MUTATION_TOKEN * lcb_resp_get_mutation_token(int cbtype, const lcb_RESPBASE *rb)
Retrieves the mutation token from the response structure.
lcb_U32 ttp
Unused.
Definition: couchbase.h:1826
lcb_error_t lcb_remove3(lcb_t instance, const void *cookie, const lcb_CMDREMOVE *cmd)
Spool a removal of an item.
const lcb_U16 * servers_
For internal use: This determines the servers the command should be routed to.
Definition: couchbase.h:1797