Couchbase C Client  2.4.4
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-2012 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 
21 #define LCB_CONFIG_MCD_PORT 11210
22 #define LCB_CONFIG_MCD_SSL_PORT 11207
23 #define LCB_CONFIG_HTTP_PORT 8091
24 #define LCB_CONFIG_HTTP_SSL_PORT 18091
25 #define LCB_CONFIG_MCCOMPAT_PORT 11211
26 
27 struct lcb_st;
28 typedef struct lcb_st *lcb_t;
29 struct lcb_http_request_st;
30 typedef struct lcb_http_request_st *lcb_http_request_t;
31 
32 #include <stddef.h>
33 #include <time.h>
34 #include <stdarg.h>
35 #include <stdio.h>
36 #include <libcouchbase/sysdefs.h>
37 #include <libcouchbase/assert.h>
38 #include <libcouchbase/visibility.h>
39 #include <libcouchbase/error.h>
40 #include <libcouchbase/iops.h>
41 #include <libcouchbase/http.h>
42 #include <libcouchbase/configuration.h>
43 #include <libcouchbase/_cxxwrap.h>
44 
45 #ifdef __cplusplus
46 extern "C"{
47 #endif
48 
49 typedef lcb_U8 lcb_datatype_t;
50 typedef lcb_U32 lcb_USECS;
51 
57 /******************************************************************************
58  ******************************************************************************
59  ******************************************************************************
60  ** INITIALIZATION **
61  ******************************************************************************
62  ******************************************************************************
63  ******************************************************************************/
64 
230 typedef enum {
233 } lcb_type_t;
234 
235 #ifndef __LCB_DOXYGEN__
236 /* These are definitions for some of the older fields of the `lcb_create_st`
237  * structure. They are here for backwards compatibility and should not be
238  * used by new code */
239 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;
240 #define LCB_CREATE_V0_FIELDS const char *host; const char *user; const char *passwd; const char *bucket; struct lcb_io_opt_st *io;
241 #define LCB_CREATE_V1_FIELDS LCB_CREATE_V0_FIELDS lcb_type_t type;
242 #define LCB_CREATE_V2_FIELDS LCB_CREATE_V1_FIELDS const char *mchosts; const lcb_config_transport_t* transports;
243 struct lcb_create_st0 { LCB_CREATE_V0_FIELDS };
244 struct lcb_create_st1 { LCB_CREATE_V1_FIELDS };
245 struct lcb_create_st2 { LCB_CREATE_V2_FIELDS };
246 #endif
247 
253  const char *connstr;
254  const char *username;
255  const char *passwd;
256  void *_pad_bucket; /* Padding. Unused */
257  struct lcb_io_opt_st *io;
258  lcb_type_t type;
259 };
260 
265  int version;
266 
269  union lcb_CRST_u {
270  struct lcb_create_st0 v0;
271  struct lcb_create_st1 v1;
272  struct lcb_create_st2 v2;
274  } v;
275 
276 #define LCB_CREATEOPT_INIT(cropt, s, iops) do { \
277  memset(cropt, 0, sizeof(*cropt)); \
278  (cropt)->version = 3; \
279  (cropt)->v.v3.connstr = s; \
280  (cropt)->v.v3.iops = iops; \
281 } while (0);
282 
283  LCB_DEPR_CTORS_CRST
284 };
285 
329 LIBCOUCHBASE_API
330 lcb_error_t lcb_create(lcb_t *instance, const struct lcb_create_st *options);
331 
343 LIBCOUCHBASE_API
344 lcb_error_t lcb_connect(lcb_t instance);
345 
389 LIBCOUCHBASE_API
390 void lcb_set_cookie(lcb_t instance, const void *cookie);
391 
399 LIBCOUCHBASE_API
400 const void *lcb_get_cookie(lcb_t instance);
401 
419 LIBCOUCHBASE_API
420 lcb_error_t lcb_wait(lcb_t instance);
421 
423 typedef enum {
426 
435 } lcb_WAITFLAGS;
436 
444 LIBCOUCHBASE_API
445 void lcb_wait3(lcb_t instance, lcb_WAITFLAGS flags);
446 
458 LIBCOUCHBASE_API
459 void lcb_breakout(lcb_t instance);
460 
461 
471 typedef void (*lcb_bootstrap_callback)(lcb_t instance, lcb_error_t err);
472 
482 LIBCOUCHBASE_API
484 lcb_set_bootstrap_callback(lcb_t instance, lcb_bootstrap_callback callback);
485 
498 LIBCOUCHBASE_API
500 lcb_get_bootstrap_status(lcb_t instance);
501 
558 LIBCOUCHBASE_API
559 void
560 lcb_refresh_config(lcb_t instance);
561 
572 LIBCOUCHBASE_API
573 void lcb_destroy(lcb_t instance);
574 
579 typedef void (*lcb_destroy_callback)(const void *cookie);
580 
586 LIBCOUCHBASE_API
615 LIBCOUCHBASE_API
616 void lcb_destroy_async(lcb_t instance, const void *arg);
617 
618 /******************************************************************************
619  ******************************************************************************
620  ** IO CREATION **
621  ******************************************************************************
622  ******************************************************************************/
623 
628 typedef enum {
629  LCB_IO_OPS_INVALID = 0x00,
630  LCB_IO_OPS_DEFAULT = 0x01,
634  LCB_IO_OPS_WINSOCK = 0x03,
635  LCB_IO_OPS_LIBEV = 0x04,
636  LCB_IO_OPS_SELECT = 0x05,
637  LCB_IO_OPS_WINIOCP = 0x06,
638  LCB_IO_OPS_LIBUV = 0x07
640 
642 typedef struct {
644  void *cookie;
646 
647 #ifndef __LCB_DOXYGEN__
648 /* These are mostly internal structures which may be in use by older applications.*/
649 typedef struct { const char *sofile; const char *symbol; void *cookie; } lcb_IOCREATEOPTS_DSO;
650 typedef struct { lcb_io_create_fn create; void *cookie; } lcb_IOCREATEOPS_FUNCTIONPOINTER;
651 #endif
652 
655  int version;
656  union {
658  lcb_IOCREATEOPTS_DSO v1;
659  lcb_IOCREATEOPS_FUNCTIONPOINTER v2;
660  } v;
661 };
662 
685 LIBCOUCHBASE_API
686 lcb_error_t lcb_create_io_ops(lcb_io_opt_t *op, const struct lcb_create_io_ops_st *options);
687 
694 LIBCOUCHBASE_API
695 lcb_error_t lcb_destroy_io_ops(lcb_io_opt_t op);
708 #define LCB__HKFIELDS \
709  \
714  const void *hashkey; \
715  \
716  lcb_SIZE nhashkey;
757 /******************************************************************************
758  ******************************************************************************
759  ******************************************************************************
760  ** GET **
761  ******************************************************************************
762  ******************************************************************************
763  ******************************************************************************/
764 
780 typedef struct {
781  const void *key;
782  lcb_SIZE nkey;
791  lcb_time_t exptime;
792 
807  int lock;
809 } lcb_GETCMDv0;
810 
815 typedef struct lcb_get_cmd_st {
816  int version;
817  union { lcb_GETCMDv0 v0; } v;
818  LCB_DEPR_CTORS_GET
819 } lcb_get_cmd_t;
820 
822 #define LCB_DATATYPE_JSON 0x01
823 
828 typedef enum {
829  LCB_VALUE_RAW = 0x00,
836 typedef struct {
837  const void *key;
838  lcb_SIZE nkey;
839  const void *bytes;
840  lcb_SIZE nbytes;
841  lcb_U32 flags;
842  lcb_cas_t cas;
843  lcb_U8 datatype;
844 } lcb_GETRESPv0;
845 
850 typedef struct {
851  int version;
852  union {
853  lcb_GETRESPv0 v0;
854  } v;
856 
867 typedef void (*lcb_get_callback)(lcb_t instance,
868  const void *cookie,
869  lcb_error_t error,
870  const lcb_get_resp_t *resp);
871 
881 LIBCOUCHBASE_API
883 
933 LIBCOUCHBASE_API
934 lcb_error_t lcb_get(lcb_t instance,
935  const void *command_cookie,
936  lcb_SIZE num,
937  const lcb_get_cmd_t *const *commands);
940 /******************************************************************************
941  ******************************************************************************
942  ******************************************************************************
943  ** GET ITEM FROM REPLICA **
944  ******************************************************************************
945  ******************************************************************************
946  ******************************************************************************/
947 
1010 typedef struct { const void *key; lcb_SIZE nkey; LCB__HKFIELDS } lcb_GETREPLICACMDv0;
1011 
1014 typedef enum {
1018 
1021 
1025 } lcb_replica_t;
1026 
1030 typedef struct {
1031  const void *key;
1032  lcb_SIZE nkey;
1036  int index;
1038 
1043 typedef struct lcb_get_replica_cmd_st {
1044  int version;
1045  union {
1046  lcb_GETREPLICACMDv0 v0;
1048  } v;
1049  LCB_DEPR_CTORS_RGET
1051 
1073 LIBCOUCHBASE_API
1074 lcb_error_t lcb_get_replica(lcb_t instance,
1075  const void *command_cookie,
1076  lcb_SIZE num,
1077  const lcb_get_replica_cmd_t *const *commands);
1078 
1081 /******************************************************************************
1082  ******************************************************************************
1083  ******************************************************************************
1084  ** UNLOCK **
1085  ******************************************************************************
1086  ******************************************************************************
1087  ******************************************************************************/
1100 typedef struct {
1101  const void *key;
1102  lcb_SIZE nkey;
1103  lcb_cas_t cas;
1105 } lcb_UNLOCKCMDv0;
1106 
1109 typedef struct lcb_unlock_cmd_st {
1110  int version;
1111  union {
1112  lcb_UNLOCKCMDv0 v0;
1113  } v;
1114  LCB_DEPR_CTORS_UNL
1116 
1118 typedef struct {
1119  const void *key;
1120  lcb_SIZE nkey;
1122 
1125 typedef struct {
1126  int version;
1127  union {
1128  lcb_UNLOCKRESPv0 v0;
1129  } v;
1131 
1141 typedef void (*lcb_unlock_callback)(lcb_t instance,
1142  const void *cookie,
1143  lcb_error_t error,
1144  const lcb_unlock_resp_t *resp);
1146 LIBCOUCHBASE_API
1148 
1174 LIBCOUCHBASE_API
1175 lcb_error_t lcb_unlock(lcb_t instance,
1176  const void *command_cookie,
1177  lcb_SIZE num,
1178  const lcb_unlock_cmd_t *const *commands);
1181 /******************************************************************************
1182  ******************************************************************************
1183  ******************************************************************************
1184  ** STORE **
1185  ******************************************************************************
1186  ******************************************************************************
1187  ******************************************************************************/
1203 typedef enum {
1205  LCB_ADD = 0x01,
1207  LCB_REPLACE = 0x02,
1209  LCB_SET = 0x03,
1211  LCB_APPEND = 0x04,
1214 } lcb_storage_t;
1215 
1221 typedef struct {
1222  const void *key;
1223  lcb_SIZE nkey;
1224  const void *bytes;
1225  lcb_SIZE nbytes;
1226  lcb_U32 flags;
1233  lcb_cas_t cas;
1234  lcb_U8 datatype;
1238  lcb_time_t exptime;
1241 } lcb_STORECMDv0;
1242 
1244 typedef struct lcb_store_cmd_st {
1245  int version;
1246  union {
1247  lcb_STORECMDv0 v0;
1248  } v;
1249  LCB_DEPR_CTORS_STORE
1250 } lcb_store_cmd_t;
1251 
1252 typedef struct {
1253  const void *key;
1254  lcb_SIZE nkey;
1255  lcb_cas_t cas;
1256 } lcb_STORERESPv0;
1257 
1259 typedef struct {
1260  int version;
1261  union {
1262  lcb_STORERESPv0 v0;
1263  } v;
1265 
1278 typedef void (*lcb_store_callback)(lcb_t instance,
1279  const void *cookie,
1280  lcb_storage_t operation,
1281  lcb_error_t error,
1282  const lcb_store_resp_t *resp);
1283 
1292 LIBCOUCHBASE_API
1294 
1328 LIBCOUCHBASE_API
1329 lcb_error_t lcb_store(lcb_t instance,
1330  const void *command_cookie,
1331  lcb_SIZE num,
1332  const lcb_store_cmd_t *const *commands);
1335 /******************************************************************************
1336  ******************************************************************************
1337  ******************************************************************************
1338  ** INCR/DECR/ARITHMETIC **
1339  ******************************************************************************
1340  ******************************************************************************
1341  ******************************************************************************/
1353 typedef struct {
1354  const void *key;
1355  lcb_SIZE nkey;
1356 
1359  lcb_time_t exptime;
1360 
1366  int create;
1367 
1380  lcb_S64 delta;
1381 
1386  lcb_U64 initial;
1388 } lcb_ARITHCMDv0;
1389 
1391 typedef struct lcb_arithmetic_cmd_st {
1392  int version;
1394  union { lcb_ARITHCMDv0 v0; } v;
1395 
1396  LCB_DEPR_CTORS_ARITH
1398 
1399 typedef struct {
1400  const void *key;
1401  lcb_SIZE nkey;
1402  lcb_U64 value;
1403  lcb_cas_t cas;
1404 } lcb_ARITHRESPv0;
1405 
1406 typedef struct {
1407  int version;
1408  union {
1409  lcb_ARITHRESPv0 v0;
1410  } v;
1411 } lcb_arithmetic_resp_t;
1412 
1423 typedef void (*lcb_arithmetic_callback)(lcb_t instance,
1424  const void *cookie,
1425  lcb_error_t error,
1426  const lcb_arithmetic_resp_t *resp);
1427 
1429 LIBCOUCHBASE_API
1432 
1462 LIBCOUCHBASE_API
1463 lcb_error_t lcb_arithmetic(lcb_t instance,
1464  const void *command_cookie,
1465  lcb_SIZE num,
1466  const lcb_arithmetic_cmd_t *const *commands);
1467 
1470 /******************************************************************************
1471  ******************************************************************************
1472  ******************************************************************************
1473  ** OBSERVE **
1474  ******************************************************************************
1475  ******************************************************************************
1476  ******************************************************************************/
1485 typedef enum {
1493 
1494 #define LCB_OBSERVE_FIELDS_COMMON \
1495  const void *key; \
1496  lcb_SIZE nkey; \
1497  LCB__HKFIELDS
1499 typedef struct {
1500  LCB_OBSERVE_FIELDS_COMMON
1501 } lcb_OBSERVECMDv0;
1502 
1504 typedef struct {
1505  LCB_OBSERVE_FIELDS_COMMON
1508 
1511 typedef struct lcb_observe_cmd_st {
1512  int version;
1513  union {
1514  lcb_OBSERVECMDv0 v0;
1515  lcb_OBSERVECMDv1 v1;
1516  } v;
1517 
1518  LCB_DEPR_CTORS_OBS
1520 
1524 typedef enum {
1533 
1534  LCB_OBSERVE_MAX = 0x82
1535 } lcb_observe_t;
1536 
1540 typedef struct {
1541  const void *key;
1542  lcb_SIZE nkey;
1543  lcb_cas_t cas;
1546  lcb_time_t ttp;
1547  lcb_time_t ttr;
1549 
1550 typedef struct {
1551  int version;
1552  union {
1553  lcb_OBSERVERESPv0 v0;
1554  } v;
1555 } lcb_observe_resp_t;
1556 
1566 typedef void (*lcb_observe_callback)(lcb_t instance,
1567  const void *cookie,
1568  lcb_error_t error,
1569  const lcb_observe_resp_t *resp);
1570 
1571 LIBCOUCHBASE_API
1572 lcb_observe_callback lcb_set_observe_callback(lcb_t, lcb_observe_callback);
1573 
1594 LIBCOUCHBASE_API
1595 lcb_error_t lcb_observe(lcb_t instance,
1596  const void *command_cookie,
1597  lcb_SIZE num,
1598  const lcb_observe_cmd_t *const *commands);
1601 /******************************************************************************
1602  ******************************************************************************
1603  ******************************************************************************
1604  ** REMOVE/DELETE **
1605  ******************************************************************************
1606  ******************************************************************************
1607  ******************************************************************************/
1608 
1616 typedef struct {
1617  const void *key;
1618  lcb_SIZE nkey;
1619  lcb_cas_t cas;
1620  LCB__HKFIELDS
1621 } lcb_REMOVECMDv0;
1622 
1623 typedef struct lcb_remove_cmd_st {
1624  int version;
1625  union {
1626  lcb_REMOVECMDv0 v0;
1627  } v;
1628  LCB_DEPR_CTORS_RM
1629 } lcb_remove_cmd_t;
1630 
1631 
1632 typedef struct {
1633  const void *key;
1634  lcb_SIZE nkey;
1635  lcb_cas_t cas;
1636 } lcb_REMOVERESPv0;
1637 
1638 typedef struct {
1639  int version;
1640  union {
1641  lcb_REMOVERESPv0 v0;
1642  } v;
1643 } lcb_remove_resp_t;
1644 
1645 
1654 typedef void (*lcb_remove_callback)(lcb_t instance,
1655  const void *cookie,
1656  lcb_error_t error,
1657  const lcb_remove_resp_t *resp);
1658 
1659 LIBCOUCHBASE_API
1660 lcb_remove_callback lcb_set_remove_callback(lcb_t, lcb_remove_callback);
1661 
1682 LIBCOUCHBASE_API
1683 lcb_error_t lcb_remove(lcb_t instance,
1684  const void *command_cookie,
1685  lcb_SIZE num,
1686  const lcb_remove_cmd_t *const *commands);
1687 
1690 /******************************************************************************
1691  ******************************************************************************
1692  ******************************************************************************
1693  ** TOUCH **
1694  ******************************************************************************
1695  ******************************************************************************
1696  ******************************************************************************/
1706 typedef struct {
1707  const void *key;
1708  lcb_SIZE nkey;
1709  lcb_cas_t cas;
1710 } lcb_TOUCHRESPv0;
1711 typedef struct {
1712  int version;
1713  union {
1714  lcb_TOUCHRESPv0 v0;
1715  } v;
1716 } lcb_touch_resp_t;
1717 
1727 typedef void (*lcb_touch_callback)(lcb_t instance,
1728  const void *cookie,
1729  lcb_error_t error,
1730  const lcb_touch_resp_t *resp);
1732 LIBCOUCHBASE_API
1734 
1758 LIBCOUCHBASE_API
1759 lcb_error_t lcb_touch(lcb_t instance,
1760  const void *cookie,
1761  lcb_SIZE num,
1762  const lcb_touch_cmd_t *const *commands);
1765 /******************************************************************************
1766  ******************************************************************************
1767  ******************************************************************************
1768  ** DURABILITY **
1769  ******************************************************************************
1770  ******************************************************************************
1771  ******************************************************************************/
1772 
1833 typedef struct {
1834  const void *key;
1835  size_t nkey;
1836  LCB__HKFIELDS
1843  lcb_cas_t cas;
1845 
1850 typedef struct lcb_durability_cmd_st {
1851  int version;
1852  union {
1854  } v;
1856 
1858 typedef struct {
1864  lcb_U32 timeout;
1865 
1874  lcb_U32 interval;
1875 
1877  lcb_U16 persist_to;
1878 
1880  lcb_U16 replicate_to;
1881 
1887 
1892  lcb_U8 cap_max;
1894 
1897 typedef struct lcb_durability_opts_st {
1898  int version;
1899  union {
1901  } v;
1903 
1905 typedef struct {
1906  const void *key;
1907  lcb_SIZE nkey;
1917 
1919  lcb_cas_t cas;
1920 
1925  unsigned char persisted_master;
1926 
1931  unsigned char exists_master;
1932 
1934  unsigned char npersisted;
1935 
1937  unsigned char nreplicated;
1938 
1944  unsigned short nresponses;
1946 
1947 typedef struct lcb_durability_resp_st {
1948  int version;
1949  union {
1951  } v;
1952 } lcb_durability_resp_t;
1953 
2035 LIBCOUCHBASE_API
2036 lcb_error_t lcb_durability_poll(lcb_t instance,
2037  const void *cookie,
2038  const lcb_durability_opts_t *options,
2039  lcb_SIZE ncmds,
2040  const lcb_durability_cmd_t *const *cmds);
2041 
2051 typedef void (*lcb_durability_callback)(lcb_t instance,
2052  const void *cookie,
2053  lcb_error_t err,
2054  const lcb_durability_resp_t *res);
2055 
2056 LIBCOUCHBASE_API
2057 lcb_durability_callback lcb_set_durability_callback(lcb_t,
2061 /******************************************************************************
2062  ******************************************************************************
2063  ******************************************************************************
2064  ** STATS **
2065  ******************************************************************************
2066  ******************************************************************************
2067  ******************************************************************************/
2074 typedef struct {
2075  const void *name;
2076  lcb_SIZE nname;
2077 } lcb_STATSCMDv0;
2078 
2079 typedef struct lcb_server_stats_cmd_st {
2080  int version;
2081  union { lcb_STATSCMDv0 v0; } v;
2082  LCB_DEPR_CTORS_STATS
2083 } lcb_server_stats_cmd_t;
2084 
2104 typedef struct {
2105  const char *server_endpoint;
2106  const void *key;
2107  lcb_SIZE nkey;
2108  const void *bytes;
2109  lcb_SIZE nbytes;
2110 } lcb_STATSRESPv0;
2111 
2113 typedef struct lcb_server_stat_resp_st {
2114  int version;
2115  union {
2116  lcb_STATSRESPv0 v0;
2117  } v;
2119 
2128 typedef void (*lcb_stat_callback)(lcb_t instance,
2129  const void *cookie,
2130  lcb_error_t error,
2131  const lcb_server_stat_resp_t *resp);
2132 LIBCOUCHBASE_API
2133 lcb_stat_callback lcb_set_stat_callback(lcb_t, lcb_stat_callback);
2134 
2166 LIBCOUCHBASE_API
2167 lcb_error_t lcb_server_stats(lcb_t instance,
2168  const void *command_cookie,
2169  lcb_SIZE num,
2170  const lcb_server_stats_cmd_t *const *commands);
2171 
2181 /******************************************************************************
2182  ******************************************************************************
2183  ******************************************************************************
2184  ** MEMCACHED VERSION (LEGACY) **
2185  ******************************************************************************
2186  ******************************************************************************
2187  ******************************************************************************/
2188 typedef struct lcb_server_version_cmd_st {
2189  int version;
2190  union { struct { const void *notused; } v0; } v;
2191  LCB_DEPR_CTORS_VERSIONS
2192 } lcb_server_version_cmd_t;
2193 
2197 typedef struct lcb_server_version_resp_st {
2198  int version;
2199  union {
2200  struct {
2201  const char *server_endpoint;
2202  const char *vstring;
2203  lcb_SIZE nvstring;
2204  } v0;
2205  } v;
2207 
2235 LIBCOUCHBASE_API
2236 lcb_error_t lcb_server_versions(lcb_t instance,
2237  const void *command_cookie,
2238  lcb_SIZE num,
2239  const lcb_server_version_cmd_t *const *commands);
2240 
2249 typedef void (*lcb_version_callback)(lcb_t instance,
2250  const void *cookie,
2251  lcb_error_t error,
2252  const lcb_server_version_resp_t *resp);
2253 
2254 LIBCOUCHBASE_API
2255 lcb_version_callback lcb_set_version_callback(lcb_t, lcb_version_callback);
2256 
2257 
2258 /******************************************************************************
2259  ******************************************************************************
2260  ******************************************************************************
2261  ** MEMCACHED VERBOSITY **
2262  ******************************************************************************
2263  ******************************************************************************
2264  ******************************************************************************/
2266 typedef enum {
2270 
2274 
2278 
2282 
2283 typedef struct {
2284  const char *server;
2285  lcb_verbosity_level_t level;
2286 } lcb_VERBOSITYCMDv0;
2287 
2288 typedef struct lcb_verbosity_cmd_st {
2289  int version;
2290  union {
2291  lcb_VERBOSITYCMDv0 v0;
2292  } v;
2293  LCB_DEPR_CTORS_VERBOSITY
2294 } lcb_verbosity_cmd_t;
2295 
2296 typedef struct lcb_verbosity_resp_st {
2297  int version;
2298  union {
2299  struct {
2300  const char *server_endpoint;
2301  } v0;
2302  } v;
2303 } lcb_verbosity_resp_t;
2304 
2323 LIBCOUCHBASE_API
2324 lcb_error_t lcb_set_verbosity(lcb_t instance,
2325  const void *command_cookie,
2326  lcb_SIZE num,
2327  const lcb_verbosity_cmd_t *const *commands);
2328 
2337 typedef void (*lcb_verbosity_callback)(lcb_t instance,
2338  const void *cookie,
2339  lcb_error_t error,
2340  const lcb_verbosity_resp_t *resp);
2341 
2342 LIBCOUCHBASE_API
2343 lcb_verbosity_callback lcb_set_verbosity_callback(lcb_t,
2345 
2346 /******************************************************************************
2347  ******************************************************************************
2348  ******************************************************************************
2349  ** MEMCACHED FLUSH **
2350  ******************************************************************************
2351  ******************************************************************************
2352  ******************************************************************************/
2353 typedef struct lcb_flush_cmd_st {
2354  int version;
2355  union { struct { int unused; } v0; } v;
2356  LCB_DEPR_CTORS_FLUSH
2357 } lcb_flush_cmd_t;
2358 
2359 typedef struct lcb_flush_resp_st {
2360  int version;
2361  union {
2362  struct {
2363  const char *server_endpoint;
2364  } v0;
2365  } v;
2366 } lcb_flush_resp_t;
2367 
2385 LIBCOUCHBASE_API
2386 lcb_error_t lcb_flush(lcb_t instance, const void *cookie,
2387  lcb_SIZE num,
2388  const lcb_flush_cmd_t *const *commands);
2389 
2398 typedef void (*lcb_flush_callback)(lcb_t instance,
2399  const void *cookie,
2400  lcb_error_t error,
2401  const lcb_flush_resp_t *resp);
2402 LIBCOUCHBASE_API
2403 lcb_flush_callback lcb_set_flush_callback(lcb_t, lcb_flush_callback);
2404 
2407 /******************************************************************************
2408  ******************************************************************************
2409  ******************************************************************************
2410  ** HTTP **
2411  ******************************************************************************
2412  ******************************************************************************
2413  ******************************************************************************/
2427 typedef enum {
2433 
2441 
2446  LCB_HTTP_TYPE_MAX = 3
2447 } lcb_http_type_t;
2448 
2455 typedef enum {
2456  LCB_HTTP_METHOD_GET = 0,
2457  LCB_HTTP_METHOD_POST = 1,
2458  LCB_HTTP_METHOD_PUT = 2,
2459  LCB_HTTP_METHOD_DELETE = 3,
2460  LCB_HTTP_METHOD_MAX = 4
2462 
2466 typedef struct {
2468  const char *path;
2469  lcb_SIZE npath;
2470  const void *body;
2471  lcb_SIZE nbody;
2472  lcb_http_method_t method;
2476  int chunked;
2480  const char *content_type;
2481 } lcb_HTTPCMDv0;
2482 
2488 typedef struct {
2489  const char *path;
2490  lcb_SIZE npath;
2491  const void *body;
2492  lcb_SIZE nbody;
2493  lcb_http_method_t method;
2494  int chunked;
2495  const char *content_type;
2496  const char *host;
2497  const char *username;
2498  const char *password;
2499 } lcb_HTTPCMDv1;
2500 
2505 typedef struct lcb_http_cmd_st {
2506  int version;
2507  union {
2508  lcb_HTTPCMDv0 v0;
2509  lcb_HTTPCMDv1 v1;
2510  } v;
2511  LCB_DEPR_CTORS_HTTP
2512 } lcb_http_cmd_t;
2513 
2527 typedef struct {
2528  lcb_http_status_t status;
2529  const char *path;
2530  lcb_SIZE npath;
2531  const char *const *headers;
2532  const void *bytes;
2533  lcb_SIZE nbytes;
2534 } lcb_HTTPRESPv0;
2535 
2536 typedef struct {
2537  int version;
2538  union {
2539  lcb_HTTPRESPv0 v0;
2540  } v;
2541 } lcb_http_resp_t;
2542 
2554 typedef void (*lcb_http_res_callback)(
2555  lcb_http_request_t request, lcb_t instance, const void *cookie,
2556  lcb_error_t error, const lcb_http_resp_t *resp);
2557 
2558 typedef lcb_http_res_callback lcb_http_data_callback;
2559 typedef lcb_http_res_callback lcb_http_complete_callback;
2560 
2569 LIBCOUCHBASE_API
2570 lcb_http_complete_callback
2571 lcb_set_http_complete_callback(lcb_t, lcb_http_complete_callback);
2572 
2582 LIBCOUCHBASE_API
2583 lcb_http_data_callback
2584 lcb_set_http_data_callback(lcb_t, lcb_http_data_callback);
2585 
2666 LIBCOUCHBASE_API
2667 lcb_error_t lcb_make_http_request(lcb_t instance,
2668  const void *command_cookie,
2669  lcb_http_type_t type,
2670  const lcb_http_cmd_t *cmd,
2671  lcb_http_request_t *request);
2672 
2684 LIBCOUCHBASE_API
2685 void lcb_cancel_http_request(lcb_t instance,
2686  lcb_http_request_t request);
2707 typedef enum {
2716 
2722 
2725 
2731 } lcb_GETNODETYPE;
2732 
2735 #define LCB_GETNODE_UNAVAILABLE "invalid_host:0"
2736 
2779 LIBCOUCHBASE_API
2780 const char *
2781 lcb_get_node(lcb_t instance, lcb_GETNODETYPE type, unsigned index);
2782 
2791 LIBCOUCHBASE_API
2792 lcb_S32 lcb_get_num_replicas(lcb_t instance);
2793 
2800 LIBCOUCHBASE_API
2801 lcb_S32 lcb_get_num_nodes(lcb_t instance);
2802 
2803 
2821 LIBCOUCHBASE_API
2822 const char *const *lcb_get_server_list(lcb_t instance);
2823 
2832 LIBCOUCHBASE_API
2833 int lcb_is_waiting(lcb_t instance);
2834 
2835 
2880 LIBCOUCHBASE_API
2881 lcb_error_t lcb_cntl(lcb_t instance, int mode, int cmd, void *arg);
2882 
2931 LIBCOUCHBASE_API
2933 lcb_cntl_string(lcb_t instance, const char *key, const char *value);
2934 
2943 LIBCOUCHBASE_API
2944 lcb_error_t lcb_cntl_setu32(lcb_t instance, int cmd, lcb_U32 arg);
2945 
2955 LIBCOUCHBASE_API
2956 lcb_U32 lcb_cntl_getu32(lcb_t instance, int cmd);
2957 
2963 LIBCOUCHBASE_API
2964 int
2965 lcb_cntl_exists(int ctl); /* settings */ /* lcbt_info */
2968 
3050 };
3051 typedef enum lcb_timeunit_t lcb_timeunit_t;
3052 
3065 LIBCOUCHBASE_API
3066 lcb_error_t lcb_enable_timings(lcb_t instance);
3067 
3068 
3077 LIBCOUCHBASE_API
3078 lcb_error_t lcb_disable_timings(lcb_t instance);
3079 
3095 typedef void (*lcb_timings_callback)(lcb_t instance,
3096  const void *cookie,
3097  lcb_timeunit_t timeunit,
3098  lcb_U32 min,
3099  lcb_U32 max,
3100  lcb_U32 total,
3101  lcb_U32 maxtotal);
3102 
3112 LIBCOUCHBASE_API
3113 lcb_error_t lcb_get_timings(lcb_t instance,
3114  const void *cookie,
3115  lcb_timings_callback callback);
3129 #if !defined(LCB_VERSION_STRING) || defined(__LCB_DOXYGEN__)
3130 
3131 #define LCB_VERSION_STRING "unknown"
3132 #endif
3133 
3134 #if !defined(LCB_VERSION) || defined(__LCB_DOXYGEN__)
3135 
3150 #define LCB_VERSION 0x000000
3151 #endif
3152 
3153 #if !defined(LCB_VERSION_CHANGESET) || defined(__LCB_DOXYGEN__)
3154 
3155 #define LCB_VERSION_CHANGESET "0xdeadbeef"
3156 #endif
3157 
3168 LIBCOUCHBASE_API
3169 const char *lcb_get_version(lcb_U32 *version);
3170 
3172 #define LCB_SUPPORTS_SSL 1
3173 
3174 #define LCB_SUPPORTS_SNAPPY 2
3175 
3182 LIBCOUCHBASE_API
3183 int
3184 lcb_supports_feature(int n);
3185 
3193 LIBCOUCHBASE_API
3194 lcb_error_t lcb_errmap_default(lcb_t instance, lcb_U16 code);
3195 
3204 typedef lcb_error_t (*lcb_errmap_callback)(lcb_t instance, lcb_U16 bincode);
3205 
3207 LIBCOUCHBASE_API
3209 
3215 LIBCOUCHBASE_API
3216 void *lcb_mem_alloc(lcb_SIZE size);
3217 
3219 LIBCOUCHBASE_API
3220 void lcb_mem_free(void *ptr);
3221 
3229 LCB_INTERNAL_API
3230 void lcb_run_loop(lcb_t instance);
3231 
3232 LCB_INTERNAL_API
3233 void lcb_stop_loop(lcb_t instance);
3234 
3235 typedef enum {
3244 } lcb_DUMPFLAGS;
3245 
3260 LIBCOUCHBASE_API
3261 void
3262 lcb_dump(lcb_t instance, FILE *fp, lcb_U32 flags);
3263 
3264 /* Post-include some other headers */
3265 #ifdef __cplusplus
3266 }
3267 #endif /* __cplusplus */
3268 
3269 #include <libcouchbase/cntl.h>
3270 #include <libcouchbase/deprecated.h>
3271 #endif /* LIBCOUCHBASE_COUCHBASE_H */
lcb_error_t lcb_server_stats(lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_server_stats_cmd_t *const *commands)
Request server statistics.
int lcb_supports_feature(int n)
Execute an arbitrary request against a host and port.
Definition: couchbase.h:2445
int version
Indicates which field in the lcb_CRST_u union should be used.
Definition: couchbase.h:265
Dump memory usage/reservation information about buffers.
Definition: couchbase.h:3241
Specifying this flag adds additional semantics which instruct the library to search additional resour...
Definition: couchbase.h:2721
lcb_error_t(* lcb_io_create_fn)(int version, lcb_io_opt_t *io, void *cookie)
Signature for a loadable plugin's IOPS initializer.
Definition: iops.h:908
lcb_unlock() Wrapper structure
Definition: couchbase.h:1109
No knowledge of the key :)
Definition: couchbase.h:1532
const void * key
Key to retrieve.
Definition: couchbase.h:781
Handle for administrative access.
Definition: couchbase.h:232
void(* lcb_unlock_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_unlock_resp_t *resp)
The callback function for an unlock request.
Definition: couchbase.h:1141
lcb_error_t lcb_create_io_ops(lcb_io_opt_t *op, const struct lcb_create_io_ops_st *options)
Create a new instance of one of the library-supplied io ops types.
lcb_observe_options_t
Definition: couchbase.h:1485
unsigned char persisted_master
Whether the key was persisted to the master.
Definition: couchbase.h:1925
Wrapper structure for lcb_STORECMDv0.
Definition: couchbase.h:1244
void(* lcb_http_res_callback)(lcb_http_request_t request, lcb_t instance, const void *cookie, lcb_error_t error, const lcb_http_resp_t *resp)
Callback invoked for HTTP requests.
Definition: couchbase.h:2554
const char * server_endpoint
Server which the statistic is from.
Definition: couchbase.h:2105
void(* lcb_observe_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_observe_resp_t *resp)
The callback function for an observe request.
Definition: couchbase.h:1566
Options for lcb_durability_poll() (wrapper)
Definition: couchbase.h:1897
struct lcb_io_opt_st * io
IO Options.
Definition: couchbase.h:257
lcb_errmap_callback lcb_set_errmap_callback(lcb_t, lcb_errmap_callback)
lcb_observe() Command structure
Definition: couchbase.h:1504
Time is in nanoseconds.
Definition: couchbase.h:3046
lcb_get() response wrapper structure
Definition: couchbase.h:850
lcb_error_t lcb_errmap_default(lcb_t instance, lcb_U16 code)
This may be used in conjunction with the errmap callback if it wishes to fallback for default behavio...
lcb_unlock() response structure
Definition: couchbase.h:1118
lcb_timeunit_t
Time units reported by lcb_get_timings()
Definition: couchbase.h:3045
lcb_U8 datatype
See lcb_VALUEFLAGS.
Definition: couchbase.h:1234
int lcb_is_waiting(lcb_t instance)
Check if instance is blocked in the event loop.
lcb_SIZE nkey
Key length.
Definition: couchbase.h:782
Wrapper structure for lcb_STORERESPv0.
Definition: couchbase.h:1259
lcb_WAITFLAGS
Flags for lcb_wait3()
Definition: couchbase.h:423
lcb_verbosity_level_t
level field for lcb_set_verbosity()
Definition: couchbase.h:2266
Query all the replicas sequentially, retrieving the first successful response.
Definition: couchbase.h:1017
IO Creation for builtin plugins.
Definition: couchbase.h:642
const char * connstr
Connection string.
Definition: couchbase.h:253
Equivalent to LCB_NODE_HTCONFIG|LCB_NODE_NEVERNULL.
Definition: couchbase.h:2730
Do not check pending operations before running the event loop.
Definition: couchbase.h:434
lcb_error_t lcb_get_bootstrap_status(lcb_t instance)
Gets the initial bootstrap status.
lcb_error_t lcb_durability_poll(lcb_t instance, const void *cookie, const lcb_durability_opts_t *options, lcb_SIZE ncmds, const lcb_durability_cmd_t *const *cmds)
Schedule a durability check on a set of keys.
Per-server, per-stat response structure for lcb_server_stats()
Definition: couchbase.h:2104
Get a data (memcached) node.
Definition: couchbase.h:2711
Time is in microseconds.
Definition: couchbase.h:3047
void lcb_wait3(lcb_t instance, lcb_WAITFLAGS flags)
Wait for completion of scheduled operations.
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_error_t lcb_touch(lcb_t instance, const void *cookie, lcb_SIZE num, const lcb_touch_cmd_t *const *commands)
Touch (set expiration time) on a number of values in the cache.
Command for lcb_get_replica()
Definition: couchbase.h:1030
Single-key command structure for lcb_durability_poll()
Definition: couchbase.h:1833
LCB__HKFIELDS lcb_observe_options_t options
<@private
Definition: couchbase.h:1506
unsigned char npersisted
how many nodes (including master) this item was persisted to
Definition: couchbase.h:1934
void(* lcb_flush_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_flush_resp_t *resp)
The callback function for a flush request.
Definition: couchbase.h:2398
lcb_SIZE npath
Length of the path.
Definition: couchbase.h:2469
Deprecated APIs.
Replace the existing object in the cache.
Definition: couchbase.h:1207
void * lcb_mem_alloc(lcb_SIZE size)
Functions to allocate and free memory related to libcouchbase.
Response Structure for lcb_observe()
Definition: couchbase.h:1540
int lcb_cntl_exists(int ctl)
Determine if a specific control code exists.
void(* lcb_touch_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_touch_resp_t *resp)
The callback function for a touch request.
Definition: couchbase.h:1727
int lock
If this parameter is set then the server will in addition to retrieving the item also lock the item...
Definition: couchbase.h:807
lcb_http_method_t
HTTP Request method enumeration These just enumerate the various types of HTTP request methods suppor...
Definition: couchbase.h:2455
const void * key
Statistic name.
Definition: couchbase.h:2106
lcb_store_callback lcb_set_store_callback(lcb_t, lcb_store_callback callback)
Set the callback to be received when an item has been stored.
lcb_durability_poll() Command wrapper
Definition: couchbase.h:1850
lcb_U64 initial
If the create field is true, this is the initial value for the counter iff the item does not yet exis...
Definition: couchbase.h:1386
int from_master
zero if key came from replica
Definition: couchbase.h:1545
lcb_unlock_callback lcb_set_unlock_callback(lcb_t, lcb_unlock_callback)
#define LCB__HKFIELDS
Note that hashkey/groupid is not a supported feature of Couchbase Server and this client...
Definition: couchbase.h:708
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:3095
Prepend this object to the existing object.
Definition: couchbase.h:1213
Integrate with the libevent loop.
Definition: couchbase.h:633
lcb_U8 check_delete
this flag inverts the sense of the durability check and ensures that the key does not exist ...
Definition: couchbase.h:1886
This union contains the set of current and historical options.
Definition: couchbase.h:269
lcb_error_t lcb_get(lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_get_cmd_t *const *commands)
Get a number of values from the cache.
struct lcb_create_st3 v3
Use this field.
Definition: couchbase.h:273
lcb_error_t lcb_get_timings(lcb_t instance, const void *cookie, lcb_timings_callback callback)
Get the timings histogram.
const void * lcb_get_cookie(lcb_t instance)
Retrieve the cookie associated with this instance.
lcb_io_ops_type_t
Built-in I/O plugins.
Definition: couchbase.h:628
lcb_storage_t
operation parameter for lcb_store()
Definition: couchbase.h:1203
lcb_U8 datatype
Currently unused.
Definition: couchbase.h:843
lcb_observe_t
Possible statuses for keys in OBSERVE response.
Definition: couchbase.h:1524
void(* lcb_remove_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_remove_resp_t *resp)
The callback function for a remove request.
Definition: couchbase.h:1654
int index
If strategy is LCB_REPLICA_SELECT, specific the replica index to use.
Definition: couchbase.h:1036
Execute a management API request.
Definition: couchbase.h:2440
Handle for data access (default)
Definition: couchbase.h:231
lcb_U32 lcb_cntl_getu32(lcb_t instance, int cmd)
Retrieve an lcb_U32 setting.
Dump the raw vbucket configuration.
Definition: couchbase.h:3237
lcb_time_t exptime
Expiration time for the item.
Definition: couchbase.h:1359
Get Command Structure.
Definition: couchbase.h:780
lcb_http_data_callback lcb_set_http_data_callback(lcb_t, lcb_http_data_callback)
Set the HTTP data stream callback for streaming responses.
lcb_io_ops_type_t type
The predefined type you want to create.
Definition: couchbase.h:643
Options for lcb_durability_poll()
Definition: couchbase.h:1858
const char * path
A view path string with optional query params (e.g.
Definition: couchbase.h:2468
lcb_error_t lcb_connect(lcb_t instance)
Schedule the initial connection This function will schedule the initial connection for the handle...
lcb_cas_t cas
if found with a different CAS, this is the CAS
Definition: couchbase.h:1919
Definition of all of the error codes used by libcouchbase.
lcb_destroy_callback lcb_set_destroy_callback(lcb_t, lcb_destroy_callback)
Set the callback to be invoked when the instance is destroyed asynchronously.
Time is in milliseconds.
Definition: couchbase.h:3048
Behave like the old lcb_wait()
Definition: couchbase.h:425
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:1874
Add the item to the cache, but fail if the object exists alread.
Definition: couchbase.h:1205
int chunked
If true the client will use lcb_http_data_callback to notify about response and will call lcb_http_co...
Definition: couchbase.h:2476
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_U32 timeout
Upper limit in microseconds from the scheduling of the command.
Definition: couchbase.h:1864
const void * bytes
Value to store.
Definition: couchbase.h:1224
void lcb_destroy(lcb_t instance)
Destroy (and release all allocated resources) an instance of lcb.
lcb_touch_callback lcb_set_touch_callback(lcb_t, lcb_touch_callback)
const void * bytes
Body (if any)
Definition: couchbase.h:2532
lcb_U32 flags
User-defined flags stored along with the item.
Definition: couchbase.h:1226
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...
const char *const * lcb_get_server_list(lcb_t instance)
Get a list of nodes in the cluster.
void(* lcb_version_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_server_version_resp_t *resp)
The callback function for a version request.
Definition: couchbase.h:2249
void lcb_refresh_config(lcb_t instance)
Force the library to refetch the cluster configuration.
lcb_error_t lcb_observe(lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_observe_cmd_t *const *commands)
Observe key.
lcb_http_status_t status
HTTP status code.
Definition: couchbase.h:2528
lcb_error_t lcb_arithmetic(lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_arithmetic_cmd_t *const *commands)
Perform arithmetic operation on a keys value.
Query all the replicas concurrently, retrieving all the responses.
Definition: couchbase.h:1020
lcb_GETNODETYPE
Type of node to retrieve for the lcb_get_node() function.
Definition: couchbase.h:2707
lcb_replica_t
Select get-replica mode.
Definition: couchbase.h:1014
Command codes for libcouchbase.
lcb_replica_t strategy
Strategy to use.
Definition: couchbase.h:1034
Value is JSON.
Definition: couchbase.h:830
lcb_cas_t cas
You must populate this with the CAS.
Definition: couchbase.h:1103
lcb_error_t lcb_unlock(lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_unlock_cmd_t *const *commands)
Unlock the key locked with lcb_get() with the lcb_GETCMDv0::lock option.
lcb_observe_t status
Status flags.
Definition: couchbase.h:1544
unsigned short nresponses
Total number of observe responses received for the node.
Definition: couchbase.h:1944
Structure for lcb_make_http_request()
Definition: couchbase.h:2466
v1 is used by the raw http requests.
Definition: couchbase.h:2488
lcb_error_t lcb_flush(lcb_t instance, const void *cookie, lcb_SIZE num, const lcb_flush_cmd_t *const *commands)
Flush the entire couchbase cluster!
void(* lcb_verbosity_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_verbosity_resp_t *resp)
The callback function for a verbosity command.
Definition: couchbase.h:2337
const char * username
Username for bucket.
Definition: couchbase.h:254
lcb_VALUEFLAGS
Flags which can be returned int the the lcb_GETRESPv0::datatype field.
Definition: couchbase.h:828
lcb_error_t lcb_cntl_string(lcb_t instance, const char *key, const char *value)
Alternate way to set configuration settings by passing a string key and value.
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 replicated to (excluding master)
Definition: couchbase.h:1880
Query the specific replica specified by the lcb_rget3_cmd_t::index field.
Definition: couchbase.h:1024
Response structure received for HTTP requests.
Definition: couchbase.h:2527
Wrapper structure for lcb_ARITHCMDv0.
Definition: couchbase.h:1391
This level traces all commands and generates a fair amount of output.
Definition: couchbase.h:2277
lcb_U8 cap_max
If replication/persistence requirements are excessive, cap to the maximum available.
Definition: couchbase.h:1892
lcb_time_t ttp
average time to persist on this server
Definition: couchbase.h:1546
Wrapper structure for lcb_make_http_request.
Definition: couchbase.h:2505
lcb_U32 flags
Server side flags stored with the item.
Definition: couchbase.h:841
const char *const * headers
List of headers.
Definition: couchbase.h:2531
This is the most verbose level and generates a lot of output on the server.
Definition: couchbase.h:2269
Value is raw bytes.
Definition: couchbase.h:829
lcb_error_t lcb_server_versions(lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_server_version_cmd_t *const *commands)
Request server versions.
lcb_error_t lcb_make_http_request(lcb_t instance, const void *command_cookie, lcb_http_type_t type, const lcb_http_cmd_t *cmd, lcb_http_request_t *request)
Execute HTTP request matching given path and yield JSON result object.
Inner response structure for a get operation.
Definition: couchbase.h:836
lcb_error_t lcb_remove(lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_remove_cmd_t *const *commands)
Remove a key from the cluster.
int create
If the item does not exist on the server, set this to true to force the creation of the item...
Definition: couchbase.h:1366
const void * bytes
Statistic value.
Definition: couchbase.h:2108
lcb_error_t lcb_destroy_io_ops(lcb_io_opt_t op)
Destroy the plugin handle created by lcb_create_io_ops()
const char * content_type
The Content-Type header for request.
Definition: couchbase.h:2480
Only return a node which is connected, or a node which is known to be up.
Definition: couchbase.h:2715
Wrapper structure for lcb_create()
Definition: couchbase.h:263
lcb_type_t
Handle types.
Definition: couchbase.h:230
lcb_error_t
Error codes returned by the library.
Definition: error.h:425
Command structure for arithmetic operations This is contained within the lcb_arithmetic_cmd_t structu...
Definition: couchbase.h:1353
lcb_storage_t operation
Mandatory.
Definition: couchbase.h:1239
void lcb_cancel_http_request(lcb_t instance, lcb_http_request_t request)
Cancel ongoing HTTP request.
wrapper structure for lcb_get_replica()
Definition: couchbase.h:1043
lcb_error_t lcb_set_verbosity(lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_verbosity_cmd_t *const *commands)
Set the loglevel on the servers.
lcb_error_t lcb_wait(lcb_t instance)
Wait for the execution of all batched requests.
lcb_error_t lcb_enable_timings(lcb_t instance)
Start recording timing metrics for the different operations.
const char * lcb_get_version(lcb_U32 *version)
Get the version of the library.
Unconditionally set the object in the cache.
Definition: couchbase.h:1209
lcb_time_t ttr
average time to replicate on this server
Definition: couchbase.h:1547
lcb_error_t lcb_store(lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_store_cmd_t *const *commands)
Store an item in the cluster.
lcb_get() Command Wrapper Structure
Definition: couchbase.h:815
void(* lcb_stat_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_server_stat_resp_t *resp)
The callback function for a stat request.
Definition: couchbase.h:2128
lcb_error_t lcb_create(lcb_t *instance, const struct lcb_create_st *options)
Create an instance of lcb.
void(* lcb_durability_callback)(lcb_t instance, const void *cookie, lcb_error_t err, const lcb_durability_resp_t *res)
Callback for durability status.
Definition: couchbase.h:2051
Time is in seconds.
Definition: couchbase.h:3049
lcb_store() Command structure
Definition: couchbase.h:1221
void * cookie
Plugin-specific argument.
Definition: couchbase.h:644
Value is compressed as Snappy.
Definition: couchbase.h:831
LCB_INTERNAL_API void lcb_run_loop(lcb_t instance)
These two functions unconditionally start and stop the event loop.
Response structure for lcb_durability_poll()
Definition: couchbase.h:1905
This is the default level and only errors and warnings will be logged.
Definition: couchbase.h:2280
void(* lcb_store_callback)(lcb_t instance, const void *cookie, lcb_storage_t operation, lcb_error_t error, const lcb_store_resp_t *resp)
The callback function for a storage request.
Definition: couchbase.h:1278
The item missing on the disk and the memory.
Definition: couchbase.h:1530
lcb_arithmetic_callback lcb_set_arithmetic_callback(lcb_t, lcb_arithmetic_callback)
Response structure for lcb_server_versions()
Definition: couchbase.h:2197
Wrapper structure for lcb_STATSRESPv0.
Definition: couchbase.h:2113
lcb_error_t lcb_disable_timings(lcb_t instance)
Stop recording (and release all resources from previous measurements) timing metrics.
lcb_observe() Command wrapper structure
Definition: couchbase.h:1511
Dump information about each packet.
Definition: couchbase.h:3239
lcb_error_t(* lcb_errmap_callback)(lcb_t instance, lcb_U16 bincode)
Callback for error mappings.
Definition: couchbase.h:3204
void lcb_set_cookie(lcb_t instance, const void *cookie)
Associate a cookie with an instance of lcb.
lcb_unlock() wrapper response structure
Definition: couchbase.h:1125
lcb_error_t lcb_get_replica(lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_get_replica_cmd_t *const *commands)
Get a number of replca values from the cache.
void(* lcb_get_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_get_resp_t *resp)
The callback function for a "get-style" request.
Definition: couchbase.h:867
lcb_DUMPFLAGS
Definition: couchbase.h:3235
lcb_S64 delta
This number will be added to the current value on the server; if this is negative then the current va...
Definition: couchbase.h:1380
lcb_http_complete_callback lcb_set_http_complete_callback(lcb_t, lcb_http_complete_callback)
Set the HTTP completion callback for HTTP request completion.
This level generates a lot of output.
Definition: couchbase.h:2273
const void * body
The POST body for HTTP request.
Definition: couchbase.h:2470
Append this object to the existing object.
Definition: couchbase.h:1211
Execute a request against the bucket.
Definition: couchbase.h:2432
void(* lcb_bootstrap_callback)(lcb_t instance, lcb_error_t err)
Bootstrap callback.
Definition: couchbase.h:471
lcb_S32 lcb_get_num_nodes(lcb_t instance)
Get the number of the nodes in the cluster.
lcb_SIZE nbytes
Length of value to store.
Definition: couchbase.h:1225
void(* lcb_destroy_callback)(const void *cookie)
Callback received when instance is about to be destroyed.
Definition: couchbase.h:579
lcb_cas_t cas
If present, the server will check that the item's current CAS matches the value specified here...
Definition: couchbase.h:1233
lcb_cas_t cas
CAS of the item on this server.
Definition: couchbase.h:1543
void lcb_breakout(lcb_t instance)
Forcefully break from the event loop.
The item found in the memory, but not yet on the disk.
Definition: couchbase.h:1526
Dump everything.
Definition: couchbase.h:3243
unsigned char nreplicated
how many nodes (excluding master) this item was replicated to
Definition: couchbase.h:1937
lcb_S32 lcb_get_num_replicas(lcb_t instance)
Get the number of the replicas in the cluster.
The item hit the disk.
Definition: couchbase.h:1528
Only sends a command to the master.
Definition: couchbase.h:1491
void(* lcb_arithmetic_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_arithmetic_resp_t *resp)
The callback function for an arithmetic request.
Definition: couchbase.h:1423
lcb_error_t err
if this entry failed, this contains the reason, e.g.
Definition: couchbase.h:1916
lcb_cas_t cas
CAS representing current mutation state of the item.
Definition: couchbase.h:842
Get a view (CAPI) node.
Definition: couchbase.h:2713
Public I/O integration interface.
lcb_SIZE nbody
Length of the body.
Definition: couchbase.h:2471
lcb_U16 persist_to
how many nodes the key should be persisted to (including master)
Definition: couchbase.h:1877
lcb_get_callback lcb_set_get_callback(lcb_t, lcb_get_callback callback)
Set the callback to be invoked when an item is received as a result of an lcb_get() operation...
lcb_time_t exptime
If this parameter is specified and lock is not set then the server will also update the object's expi...
Definition: couchbase.h:791
void lcb_destroy_async(lcb_t instance, const void *arg)
Asynchronously schedule the destruction of an instance.
lcb_http_type_t
The type of HTTP request to execute.
Definition: couchbase.h:2427
lcb_time_t exptime
Expiration for the item.
Definition: couchbase.h:1238
uncommitted
Definition: couchbase.h:654
unsigned char exists_master
Whether the key exists on the master.
Definition: couchbase.h:1931
Get an HTTP configuration (Rest API) node.
Definition: couchbase.h:2709
Structure for lcb_create().
Definition: couchbase.h:252
const char * passwd
Password for bucket.
Definition: couchbase.h:255
void lcb_dump(lcb_t instance, FILE *fp, lcb_U32 flags)
Write a textual dump to a file.
void lcb_mem_free(void *ptr)
Use this to free memory allocated with lcb_mem_alloc.
Equivalent to LCB_NODE_HTCONFIG|LCB_NODE_CONNECTED
Definition: couchbase.h:2724
lcb_unlock() Command structure
Definition: couchbase.h:1100