couchbase 1.2.0.z.beta-x86-mingw32 → 1.2.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.travis.yml +1 -1
  2. data/Makefile +3 -0
  3. data/README.markdown +15 -4
  4. data/RELEASE_NOTES.markdown +526 -0
  5. data/couchbase.gemspec +0 -1
  6. data/ext/couchbase_ext/arguments.c +161 -244
  7. data/ext/couchbase_ext/arithmetic.c +29 -37
  8. data/ext/couchbase_ext/bucket.c +252 -219
  9. data/ext/couchbase_ext/couchbase_ext.c +540 -417
  10. data/ext/couchbase_ext/couchbase_ext.h +218 -191
  11. data/ext/couchbase_ext/delete.c +30 -27
  12. data/ext/couchbase_ext/extconf.rb +15 -3
  13. data/ext/couchbase_ext/get.c +45 -37
  14. data/ext/couchbase_ext/http.c +95 -74
  15. data/ext/couchbase_ext/multithread_plugin.c +1238 -0
  16. data/ext/couchbase_ext/observe.c +42 -37
  17. data/ext/couchbase_ext/result.c +17 -20
  18. data/ext/couchbase_ext/stats.c +30 -28
  19. data/ext/couchbase_ext/store.c +47 -39
  20. data/ext/couchbase_ext/timer.c +11 -11
  21. data/ext/couchbase_ext/touch.c +30 -27
  22. data/ext/couchbase_ext/unlock.c +30 -27
  23. data/ext/couchbase_ext/utils.c +166 -89
  24. data/ext/couchbase_ext/version.c +29 -26
  25. data/lib/action_dispatch/middleware/session/couchbase_store.rb +2 -2
  26. data/lib/active_support/cache/couchbase_store.rb +6 -6
  27. data/lib/couchbase.rb +1 -0
  28. data/lib/couchbase/bucket.rb +6 -11
  29. data/lib/couchbase/cluster.rb +105 -0
  30. data/lib/couchbase/utils.rb +8 -5
  31. data/lib/couchbase/version.rb +1 -1
  32. data/lib/couchbase/view.rb +51 -5
  33. data/lib/couchbase/view_row.rb +1 -1
  34. data/lib/ext/multi_json_fix.rb +13 -9
  35. data/lib/rack/session/couchbase.rb +11 -7
  36. data/tasks/compile.rake +1 -1
  37. data/tasks/test.rake +40 -34
  38. data/tasks/util.rake +1 -1
  39. data/test/setup.rb +9 -2
  40. data/test/test_arithmetic.rb +37 -0
  41. data/test/test_async.rb +22 -18
  42. data/test/test_unlock.rb +0 -1
  43. data/test/test_utils.rb +32 -0
  44. metadata +13 -23
  45. data/HISTORY.markdown +0 -219
@@ -23,6 +23,9 @@
23
23
  #endif
24
24
 
25
25
  #include "couchbase_config.h"
26
+ #ifdef HAVE_STDINT_H
27
+ #include <stdint.h>
28
+ #endif
26
29
  #ifndef HAVE_GETHRTIME
27
30
  typedef uint64_t hrtime_t;
28
31
  extern hrtime_t gethrtime(void);
@@ -48,54 +51,60 @@ extern hrtime_t gethrtime(void);
48
51
  #define va_init_list(a,b) va_start(a)
49
52
  #endif
50
53
 
51
- #define debug_object(OBJ) \
54
+ #ifndef HAVE_RB_HASH_LOOKUP2
55
+ VALUE rb_hash_lookup2(VALUE, VALUE, VALUE);
56
+ #endif
57
+
58
+ #define cb_debug_object(OBJ) \
52
59
  rb_funcall(rb_stderr, rb_intern("print"), 1, rb_funcall(OBJ, rb_intern("object_id"), 0)); \
53
60
  rb_funcall(rb_stderr, rb_intern("print"), 1, STR_NEW_CSTR(" ")); \
54
61
  rb_funcall(rb_stderr, rb_intern("print"), 1, rb_funcall(OBJ, rb_intern("class"), 0)); \
55
62
  rb_funcall(rb_stderr, rb_intern("print"), 1, STR_NEW_CSTR(" ")); \
56
63
  rb_funcall(rb_stderr, rb_intern("puts"), 1, rb_funcall(OBJ, rb_intern("inspect"), 0));
57
64
 
58
- #define FMT_MASK 0x3
59
- #define FMT_DOCUMENT 0x0
60
- #define FMT_MARSHAL 0x1
61
- #define FMT_PLAIN 0x2
65
+ #define CB_FMT_MASK 0x3
66
+ #define CB_FMT_DOCUMENT 0x0
67
+ #define CB_FMT_MARSHAL 0x1
68
+ #define CB_FMT_PLAIN 0x2
62
69
 
63
- #define PACKET_HEADER_SIZE 24
70
+ #define CB_PACKET_HEADER_SIZE 24
64
71
  /* Structs */
65
- struct bucket_st
72
+ struct cb_bucket_st
66
73
  {
67
74
  lcb_t handle;
75
+ lcb_type_t type;
68
76
  struct lcb_io_opt_st *io;
69
77
  uint16_t port;
70
- char *authority;
71
- char *hostname;
72
- char *pool;
73
- char *bucket;
74
- char *username;
75
- char *password;
78
+ VALUE authority;
79
+ VALUE hostname;
80
+ VALUE pool;
81
+ VALUE bucket;
82
+ VALUE username;
83
+ VALUE password;
76
84
  int async;
77
85
  int quiet;
78
86
  VALUE default_format; /* should update +default_flags+ on change */
79
87
  uint32_t default_flags;
80
88
  time_t default_ttl;
81
89
  time_t default_observe_timeout;
90
+ lcb_uint64_t default_arith_create; /* should the incr/decr create the key? if non-zero, will use arith_init */
91
+ lcb_uint64_t default_arith_init; /* default initial value for incr/decr */
82
92
  uint32_t timeout;
83
93
  size_t threshold; /* the number of bytes to trigger event loop, zero if don't care */
84
94
  size_t nbytes; /* the number of bytes scheduled to be sent */
85
95
  VALUE exception; /* error delivered by error_callback */
86
96
  VALUE on_error_proc; /* is using to deliver errors in async mode */
87
97
  VALUE environment; /* sym_development or sym_production */
88
- char *key_prefix;
89
98
  VALUE key_prefix_val;
90
- char *node_list;
99
+ VALUE node_list;
91
100
  VALUE object_space;
92
101
  VALUE self; /* the pointer to bucket representation in ruby land */
93
102
  };
94
103
 
95
- struct http_request_st;
96
- struct context_st
104
+ struct cb_http_request_st;
105
+ struct cb_context_st
97
106
  {
98
- struct bucket_st* bucket;
107
+ struct cb_bucket_st* bucket;
99
108
  int extended;
100
109
  VALUE proc;
101
110
  void *rv;
@@ -105,14 +114,15 @@ struct context_st
105
114
  VALUE operation;
106
115
  VALUE headers_val;
107
116
  int headers_built;
108
- struct http_request_st *request;
117
+ struct cb_http_request_st *request;
109
118
  int quiet;
110
119
  int arith; /* incr: +1, decr: -1, other: 0 */
120
+ int http_cancel_on_error;
111
121
  size_t nqueries;
112
122
  };
113
123
 
114
- struct http_request_st {
115
- struct bucket_st *bucket;
124
+ struct cb_http_request_st {
125
+ struct cb_bucket_st *bucket;
116
126
  VALUE bucket_obj;
117
127
  VALUE type;
118
128
  int extended;
@@ -120,13 +130,13 @@ struct http_request_st {
120
130
  int completed;
121
131
  lcb_http_request_t request;
122
132
  lcb_http_cmd_t cmd;
123
- struct context_st *ctx;
133
+ struct cb_context_st *ctx;
124
134
  VALUE on_body_callback;
125
135
  };
126
136
 
127
- struct timer_st
137
+ struct cb_timer_st
128
138
  {
129
- struct bucket_st *bucket;
139
+ struct cb_bucket_st *bucket;
130
140
  int periodic;
131
141
  uint32_t usec;
132
142
  lcb_timer_t timer;
@@ -135,171 +145,185 @@ struct timer_st
135
145
  };
136
146
 
137
147
  /* Classes */
138
- extern VALUE cBucket;
139
- extern VALUE cCouchRequest;
140
- extern VALUE cResult;
141
- extern VALUE cTimer;
148
+ extern VALUE cb_cBucket;
149
+ extern VALUE cb_cCouchRequest;
150
+ extern VALUE cb_cResult;
151
+ extern VALUE cb_cTimer;
142
152
 
143
153
  /* Modules */
144
- extern VALUE mCouchbase;
145
- extern VALUE mError;
146
- extern VALUE mMarshal;
147
- extern VALUE mMultiJson;
148
- extern VALUE mURI;
154
+ extern VALUE cb_mCouchbase;
155
+ extern VALUE cb_mError;
156
+ extern VALUE cb_mMarshal;
157
+ extern VALUE cb_mMultiJson;
158
+ extern VALUE cb_mURI;
149
159
 
150
160
  /* Symbols */
151
- extern ID sym_add;
152
- extern ID sym_append;
153
- extern ID sym_assemble_hash;
154
- extern ID sym_body;
155
- extern ID sym_bucket;
156
- extern ID sym_cas;
157
- extern ID sym_chunked;
158
- extern ID sym_content_type;
159
- extern ID sym_create;
160
- extern ID sym_decrement;
161
- extern ID sym_default_flags;
162
- extern ID sym_default_format;
163
- extern ID sym_default_observe_timeout;
164
- extern ID sym_default_ttl;
165
- extern ID sym_delete;
166
- extern ID sym_delta;
167
- extern ID sym_development;
168
- extern ID sym_document;
169
- extern ID sym_environment;
170
- extern ID sym_extended;
171
- extern ID sym_flags;
172
- extern ID sym_format;
173
- extern ID sym_found;
174
- extern ID sym_get;
175
- extern ID sym_hostname;
176
- extern ID sym_http_request;
177
- extern ID sym_increment;
178
- extern ID sym_initial;
179
- extern ID sym_key_prefix;
180
- extern ID sym_lock;
181
- extern ID sym_management;
182
- extern ID sym_marshal;
183
- extern ID sym_method;
184
- extern ID sym_node_list;
185
- extern ID sym_not_found;
186
- extern ID sym_num_replicas;
187
- extern ID sym_observe;
188
- extern ID sym_password;
189
- extern ID sym_periodic;
190
- extern ID sym_persisted;
191
- extern ID sym_plain;
192
- extern ID sym_pool;
193
- extern ID sym_port;
194
- extern ID sym_post;
195
- extern ID sym_prepend;
196
- extern ID sym_production;
197
- extern ID sym_put;
198
- extern ID sym_quiet;
199
- extern ID sym_replace;
200
- extern ID sym_replica;
201
- extern ID sym_send_threshold;
202
- extern ID sym_set;
203
- extern ID sym_stats;
204
- extern ID sym_timeout;
205
- extern ID sym_touch;
206
- extern ID sym_ttl;
207
- extern ID sym_type;
208
- extern ID sym_unlock;
209
- extern ID sym_username;
210
- extern ID sym_version;
211
- extern ID sym_view;
212
- extern ID id_arity;
213
- extern ID id_call;
214
- extern ID id_delete;
215
- extern ID id_dump;
216
- extern ID id_dup;
217
- extern ID id_flatten_bang;
218
- extern ID id_has_key_p;
219
- extern ID id_host;
220
- extern ID id_iv_cas;
221
- extern ID id_iv_completed;
222
- extern ID id_iv_error;
223
- extern ID id_iv_flags;
224
- extern ID id_iv_from_master;
225
- extern ID id_iv_headers;
226
- extern ID id_iv_key;
227
- extern ID id_iv_node;
228
- extern ID id_iv_operation;
229
- extern ID id_iv_status;
230
- extern ID id_iv_time_to_persist;
231
- extern ID id_iv_time_to_replicate;
232
- extern ID id_iv_value;
233
- extern ID id_load;
234
- extern ID id_match;
235
- extern ID id_observe_and_wait;
236
- extern ID id_parse;
237
- extern ID id_password;
238
- extern ID id_path;
239
- extern ID id_port;
240
- extern ID id_scheme;
241
- extern ID id_to_s;
242
- extern ID id_user;
243
- extern ID id_verify_observe_options;
161
+ extern ID cb_sym_add;
162
+ extern ID cb_sym_append;
163
+ extern ID cb_sym_assemble_hash;
164
+ extern ID cb_sym_body;
165
+ extern ID cb_sym_bucket;
166
+ extern ID cb_sym_cas;
167
+ extern ID cb_sym_chunked;
168
+ extern ID cb_sym_cluster;
169
+ extern ID cb_sym_content_type;
170
+ extern ID cb_sym_create;
171
+ extern ID cb_sym_decrement;
172
+ extern ID cb_sym_default_arithmetic_init;
173
+ extern ID cb_sym_default_flags;
174
+ extern ID cb_sym_default_format;
175
+ extern ID cb_sym_default_observe_timeout;
176
+ extern ID cb_sym_default_ttl;
177
+ extern ID cb_sym_delete;
178
+ extern ID cb_sym_delta;
179
+ extern ID cb_sym_development;
180
+ extern ID cb_sym_document;
181
+ extern ID cb_sym_environment;
182
+ extern ID cb_sym_extended;
183
+ extern ID cb_sym_flags;
184
+ extern ID cb_sym_format;
185
+ extern ID cb_sym_found;
186
+ extern ID cb_sym_get;
187
+ extern ID cb_sym_hostname;
188
+ extern ID cb_sym_http_request;
189
+ extern ID cb_sym_increment;
190
+ extern ID cb_sym_initial;
191
+ extern ID cb_sym_key_prefix;
192
+ extern ID cb_sym_lock;
193
+ extern ID cb_sym_management;
194
+ extern ID cb_sym_marshal;
195
+ extern ID cb_sym_method;
196
+ extern ID cb_sym_node_list;
197
+ extern ID cb_sym_not_found;
198
+ extern ID cb_sym_num_replicas;
199
+ extern ID cb_sym_observe;
200
+ extern ID cb_sym_password;
201
+ extern ID cb_sym_periodic;
202
+ extern ID cb_sym_persisted;
203
+ extern ID cb_sym_plain;
204
+ extern ID cb_sym_pool;
205
+ extern ID cb_sym_port;
206
+ extern ID cb_sym_post;
207
+ extern ID cb_sym_prepend;
208
+ extern ID cb_sym_production;
209
+ extern ID cb_sym_put;
210
+ extern ID cb_sym_quiet;
211
+ extern ID cb_sym_replace;
212
+ extern ID cb_sym_replica;
213
+ extern ID cb_sym_send_threshold;
214
+ extern ID cb_sym_set;
215
+ extern ID cb_sym_stats;
216
+ extern ID cb_sym_timeout;
217
+ extern ID cb_sym_touch;
218
+ extern ID cb_sym_ttl;
219
+ extern ID cb_sym_type;
220
+ extern ID cb_sym_unlock;
221
+ extern ID cb_sym_username;
222
+ extern ID cb_sym_version;
223
+ extern ID cb_sym_view;
224
+ extern ID cb_id_arity;
225
+ extern ID cb_id_call;
226
+ extern ID cb_id_delete;
227
+ extern ID cb_id_dump;
228
+ extern ID cb_id_dup;
229
+ extern ID cb_id_flatten_bang;
230
+ extern ID cb_id_has_key_p;
231
+ extern ID cb_id_host;
232
+ extern ID cb_id_iv_body;
233
+ extern ID cb_id_iv_cas;
234
+ extern ID cb_id_iv_completed;
235
+ extern ID cb_id_iv_error;
236
+ extern ID cb_id_iv_flags;
237
+ extern ID cb_id_iv_from_master;
238
+ extern ID cb_id_iv_headers;
239
+ extern ID cb_id_iv_inner_exception;
240
+ extern ID cb_id_iv_key;
241
+ extern ID cb_id_iv_node;
242
+ extern ID cb_id_iv_operation;
243
+ extern ID cb_id_iv_status;
244
+ extern ID cb_id_iv_time_to_persist;
245
+ extern ID cb_id_iv_time_to_replicate;
246
+ extern ID cb_id_iv_value;
247
+ extern ID cb_id_load;
248
+ extern ID cb_id_match;
249
+ extern ID cb_id_observe_and_wait;
250
+ extern ID cb_id_parse;
251
+ extern ID cb_id_parse_body_bang;
252
+ extern ID cb_id_password;
253
+ extern ID cb_id_path;
254
+ extern ID cb_id_port;
255
+ extern ID cb_id_scheme;
256
+ extern ID cb_id_sprintf;
257
+ extern ID cb_id_to_s;
258
+ extern ID cb_id_user;
259
+ extern ID cb_id_verify_observe_options;
244
260
 
245
261
  /* Errors */
246
- extern VALUE eBaseError;
247
- extern VALUE eValueFormatError;
262
+ extern VALUE cb_eBaseError;
263
+ extern VALUE cb_eValueFormatError;
264
+ extern VALUE cb_eHTTPError;
248
265
  /* LCB_SUCCESS = 0x00 */
249
266
  /* LCB_AUTH_CONTINUE = 0x01 */
250
- extern VALUE eAuthError; /* LCB_AUTH_ERROR = 0x02 */
251
- extern VALUE eDeltaBadvalError; /* LCB_DELTA_BADVAL = 0x03 */
252
- extern VALUE eTooBigError; /* LCB_E2BIG = 0x04 */
253
- extern VALUE eBusyError; /* LCB_EBUSY = 0x05 */
254
- extern VALUE eInternalError; /* LCB_EINTERNAL = 0x06 */
255
- extern VALUE eInvalidError; /* LCB_EINVAL = 0x07 */
256
- extern VALUE eNoMemoryError; /* LCB_ENOMEM = 0x08 */
257
- extern VALUE eRangeError; /* LCB_ERANGE = 0x09 */
258
- extern VALUE eLibcouchbaseError; /* LCB_ERROR = 0x0a */
259
- extern VALUE eTmpFailError; /* LCB_ETMPFAIL = 0x0b */
260
- extern VALUE eKeyExistsError; /* LCB_KEY_EEXISTS = 0x0c */
261
- extern VALUE eNotFoundError; /* LCB_KEY_ENOENT = 0x0d */
262
- extern VALUE eLibeventError; /* LCB_LIBEVENT_ERROR = 0x0e */
263
- extern VALUE eNetworkError; /* LCB_NETWORK_ERROR = 0x0f */
264
- extern VALUE eNotMyVbucketError; /* LCB_NOT_MY_VBUCKET = 0x10 */
265
- extern VALUE eNotStoredError; /* LCB_NOT_STORED = 0x11 */
266
- extern VALUE eNotSupportedError; /* LCB_NOT_SUPPORTED = 0x12 */
267
- extern VALUE eUnknownCommandError; /* LCB_UNKNOWN_COMMAND = 0x13 */
268
- extern VALUE eUnknownHostError; /* LCB_UNKNOWN_HOST = 0x14 */
269
- extern VALUE eProtocolError; /* LCB_PROTOCOL_ERROR = 0x15 */
270
- extern VALUE eTimeoutError; /* LCB_ETIMEDOUT = 0x16 */
271
- extern VALUE eConnectError; /* LCB_CONNECT_ERROR = 0x17 */
272
- extern VALUE eBucketNotFoundError; /* LCB_BUCKET_ENOENT = 0x18 */
273
- extern VALUE eClientNoMemoryError; /* LCB_CLIENT_ENOMEM = 0x19 */
274
- extern VALUE eClientTmpFailError; /* LCB_CLIENT_ETMPFAIL = 0x20 */
267
+ extern VALUE cb_eAuthError; /* LCB_AUTH_ERROR = 0x02 */
268
+ extern VALUE cb_eDeltaBadvalError; /* LCB_DELTA_BADVAL = 0x03 */
269
+ extern VALUE cb_eTooBigError; /* LCB_E2BIG = 0x04 */
270
+ extern VALUE cb_eBusyError; /* LCB_EBUSY = 0x05 */
271
+ extern VALUE cb_eInternalError; /* LCB_EINTERNAL = 0x06 */
272
+ extern VALUE cb_eInvalidError; /* LCB_EINVAL = 0x07 */
273
+ extern VALUE cb_eNoMemoryError; /* LCB_ENOMEM = 0x08 */
274
+ extern VALUE cb_eRangeError; /* LCB_ERANGE = 0x09 */
275
+ extern VALUE cb_eLibcouchbaseError; /* LCB_ERROR = 0x0a */
276
+ extern VALUE cb_eTmpFailError; /* LCB_ETMPFAIL = 0x0b */
277
+ extern VALUE cb_eKeyExistsError; /* LCB_KEY_EEXISTS = 0x0c */
278
+ extern VALUE cb_eNotFoundError; /* LCB_KEY_ENOENT = 0x0d */
279
+ extern VALUE cb_eDlopenFailedError; /* LCB_DLOPEN_FAILED = 0x0e */
280
+ extern VALUE cb_eDlsymFailedError; /* LCB_DLSYM_FAILED = 0x0f */
281
+ extern VALUE cb_eNetworkError; /* LCB_NETWORK_ERROR = 0x10 */
282
+ extern VALUE cb_eNotMyVbucketError; /* LCB_NOT_MY_VBUCKET = 0x11 */
283
+ extern VALUE cb_eNotStoredError; /* LCB_NOT_STORED = 0x12 */
284
+ extern VALUE cb_eNotSupportedError; /* LCB_NOT_SUPPORTED = 0x13 */
285
+ extern VALUE cb_eUnknownCommandError; /* LCB_UNKNOWN_COMMAND = 0x14 */
286
+ extern VALUE cb_eUnknownHostError; /* LCB_UNKNOWN_HOST = 0x15 */
287
+ extern VALUE cb_eProtocolError; /* LCB_PROTOCOL_ERROR = 0x16 */
288
+ extern VALUE cb_eTimeoutError; /* LCB_ETIMEDOUT = 0x17 */
289
+ extern VALUE cb_eConnectError; /* LCB_CONNECT_ERROR = 0x18 */
290
+ extern VALUE cb_eBucketNotFoundError; /* LCB_BUCKET_ENOENT = 0x19 */
291
+ extern VALUE cb_eClientNoMemoryError; /* LCB_CLIENT_ENOMEM = 0x1a */
292
+ extern VALUE cb_eClientTmpFailError; /* LCB_CLIENT_ETMPFAIL = 0x1b */
293
+ extern VALUE cb_eBadHandleError; /* LCB_EBADHANDLE = 0x1c */
294
+
295
+ /* Default Strings */
296
+ extern VALUE cb_vStrDefault;
297
+ extern VALUE cb_vStrEmpty;
275
298
 
276
- void strip_key_prefix(struct bucket_st *bucket, VALUE key);
299
+ void cb_strip_key_prefix(struct cb_bucket_st *bucket, VALUE key);
277
300
  VALUE cb_check_error(lcb_error_t rc, const char *msg, VALUE key);
278
301
  VALUE cb_check_error_with_status(lcb_error_t rc, const char *msg, VALUE key, lcb_http_status_t status);
279
- VALUE cb_gc_protect(struct bucket_st *bucket, VALUE val);
280
- VALUE cb_gc_unprotect(struct bucket_st *bucket, VALUE val);
281
- VALUE cb_proc_call(VALUE recv, int argc, ...);
302
+ VALUE cb_gc_protect(struct cb_bucket_st *bucket, VALUE val);
303
+ VALUE cb_gc_unprotect(struct cb_bucket_st *bucket, VALUE val);
304
+ VALUE cb_proc_call(struct cb_bucket_st *bucket, VALUE recv, int argc, ...);
282
305
  int cb_first_value_i(VALUE key, VALUE value, VALUE arg);
283
- void cb_build_headers(struct context_st *ctx, const char * const *headers);
284
- void maybe_do_loop(struct bucket_st *bucket);
285
- VALUE unify_key(struct bucket_st *bucket, VALUE key, int apply_prefix);
286
- VALUE encode_value(VALUE val, uint32_t flags);
287
- VALUE decode_value(VALUE blob, uint32_t flags, VALUE force_format);
288
- uint32_t flags_set_format(uint32_t flags, ID format);
289
- ID flags_get_format(uint32_t flags);
306
+ void cb_build_headers(struct cb_context_st *ctx, const char * const *headers);
307
+ void cb_maybe_do_loop(struct cb_bucket_st *bucket);
308
+ VALUE cb_unify_key(struct cb_bucket_st *bucket, VALUE key, int apply_prefix);
309
+ VALUE cb_encode_value(VALUE val, uint32_t flags);
310
+ VALUE cb_decode_value(VALUE blob, uint32_t flags, VALUE force_format);
311
+ uint32_t cb_flags_set_format(uint32_t flags, ID format);
312
+ ID cb_flags_get_format(uint32_t flags);
313
+ void cb_async_error_notify(struct cb_bucket_st *bucket, VALUE exc);
290
314
 
291
- void storage_callback(lcb_t handle, const void *cookie, lcb_storage_t operation, lcb_error_t error, const lcb_store_resp_t *resp);
292
- void get_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_get_resp_t *resp);
293
- void touch_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_touch_resp_t *resp);
294
- void delete_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_remove_resp_t *resp);
295
- void stat_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_server_stat_resp_t *resp);
296
- void arithmetic_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_arithmetic_resp_t *resp);
297
- void version_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_server_version_resp_t *resp);
298
- void http_complete_callback(lcb_http_request_t request, lcb_t handle, const void *cookie, lcb_error_t error, const lcb_http_resp_t *resp);
299
- void http_data_callback(lcb_http_request_t request, lcb_t handle, const void *cookie, lcb_error_t error, const lcb_http_resp_t *resp);
300
- void observe_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_observe_resp_t *resp);
301
- void unlock_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_unlock_resp_t *resp);
302
315
 
316
+ void cb_storage_callback(lcb_t handle, const void *cookie, lcb_storage_t operation, lcb_error_t error, const lcb_store_resp_t *resp);
317
+ void cb_get_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_get_resp_t *resp);
318
+ void cb_touch_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_touch_resp_t *resp);
319
+ void cb_delete_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_remove_resp_t *resp);
320
+ void cb_stat_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_server_stat_resp_t *resp);
321
+ void cb_arithmetic_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_arithmetic_resp_t *resp);
322
+ void cb_version_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_server_version_resp_t *resp);
323
+ void cb_http_complete_callback(lcb_http_request_t request, lcb_t handle, const void *cookie, lcb_error_t error, const lcb_http_resp_t *resp);
324
+ void cb_http_data_callback(lcb_http_request_t request, lcb_t handle, const void *cookie, lcb_error_t error, const lcb_http_resp_t *resp);
325
+ void cb_observe_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_observe_resp_t *resp);
326
+ void cb_unlock_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_unlock_resp_t *resp);
303
327
 
304
328
  VALUE cb_bucket_alloc(VALUE klass);
305
329
  void cb_bucket_free(void *ptr);
@@ -352,6 +376,8 @@ VALUE cb_bucket_environment_get(VALUE self);
352
376
  VALUE cb_bucket_num_replicas_get(VALUE self);
353
377
  VALUE cb_bucket_default_observe_timeout_get(VALUE self);
354
378
  VALUE cb_bucket_default_observe_timeout_set(VALUE self, VALUE val);
379
+ VALUE cb_bucket_default_arithmetic_init_get(VALUE self);
380
+ VALUE cb_bucket_default_arithmetic_init_set(VALUE self, VALUE val);
355
381
 
356
382
  VALUE cb_http_request_alloc(VALUE klass);
357
383
  VALUE cb_http_request_init(int argc, VALUE *argv, VALUE self);
@@ -374,21 +400,21 @@ VALUE cb_timer_init(int argc, VALUE *argv, VALUE self);
374
400
 
375
401
  /* Method arguments */
376
402
 
377
- enum command_t {
378
- cmd_touch = 0x01,
379
- cmd_remove = 0x02,
380
- cmd_store = 0x03,
381
- cmd_get = 0x04,
382
- cmd_arith = 0x05,
383
- cmd_stats = 0x06,
384
- cmd_version = 0x08,
385
- cmd_observe = 0x09,
386
- cmd_unlock = 0x10
403
+ enum cb_command_t {
404
+ cb_cmd_touch = 0x01,
405
+ cb_cmd_remove = 0x02,
406
+ cb_cmd_store = 0x03,
407
+ cb_cmd_get = 0x04,
408
+ cb_cmd_arith = 0x05,
409
+ cb_cmd_stats = 0x06,
410
+ cb_cmd_version = 0x08,
411
+ cb_cmd_observe = 0x09,
412
+ cb_cmd_unlock = 0x10
387
413
  };
388
414
 
389
- struct params_st
415
+ struct cb_params_st
390
416
  {
391
- enum command_t type;
417
+ enum cb_command_t type;
392
418
  union {
393
419
  struct {
394
420
  /* number of items */
@@ -504,16 +530,17 @@ struct params_st
504
530
  lcb_cas_t cas;
505
531
  } unlock;
506
532
  } cmd;
507
- struct bucket_st *bucket;
533
+ struct cb_bucket_st *bucket;
508
534
  /* helper index for iterators */
509
535
  size_t idx;
510
536
  /* the approximate size of the data to be sent */
511
537
  size_t npayload;
512
538
  };
513
539
 
514
- void cb_params_destroy(struct params_st *params);
515
- void cb_params_build(struct params_st *params, int argc, VALUE argv);
516
-
540
+ void cb_params_destroy(struct cb_params_st *params);
541
+ void cb_params_build(struct cb_params_st *params, int argc, VALUE argv);
517
542
 
543
+ LIBCOUCHBASE_API
544
+ lcb_error_t cb_create_ruby_mt_io_opts(int version, lcb_io_opt_t *io, void *arg);
518
545
  #endif
519
546