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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +513 -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 +1201 -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 +46 -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 -215
@@ -19,318 +19,404 @@
19
19
  #include "couchbase_ext.h"
20
20
 
21
21
  /* Classes */
22
- VALUE cBucket;
23
- VALUE cCouchRequest;
24
- VALUE cResult;
25
- VALUE cTimer;
22
+ VALUE cb_cBucket;
23
+ VALUE cb_cCouchRequest;
24
+ VALUE cb_cResult;
25
+ VALUE cb_cTimer;
26
26
 
27
27
  /* Modules */
28
- VALUE mCouchbase;
29
- VALUE mError;
30
- VALUE mMarshal;
31
- VALUE mMultiJson;
32
- VALUE mURI;
28
+ VALUE cb_mCouchbase;
29
+ VALUE cb_mError;
30
+ VALUE cb_mMarshal;
31
+ VALUE cb_mMultiJson;
32
+ VALUE cb_mURI;
33
33
 
34
34
  /* Symbols */
35
- ID sym_add;
36
- ID sym_append;
37
- ID sym_assemble_hash;
38
- ID sym_body;
39
- ID sym_bucket;
40
- ID sym_cas;
41
- ID sym_chunked;
42
- ID sym_content_type;
43
- ID sym_create;
44
- ID sym_decrement;
45
- ID sym_default_flags;
46
- ID sym_default_format;
47
- ID sym_default_observe_timeout;
48
- ID sym_default_ttl;
49
- ID sym_delete;
50
- ID sym_delta;
51
- ID sym_development;
52
- ID sym_document;
53
- ID sym_environment;
54
- ID sym_extended;
55
- ID sym_flags;
56
- ID sym_format;
57
- ID sym_found;
58
- ID sym_get;
59
- ID sym_hostname;
60
- ID sym_http_request;
61
- ID sym_increment;
62
- ID sym_initial;
63
- ID sym_key_prefix;
64
- ID sym_lock;
65
- ID sym_management;
66
- ID sym_marshal;
67
- ID sym_method;
68
- ID sym_node_list;
69
- ID sym_not_found;
70
- ID sym_num_replicas;
71
- ID sym_observe;
72
- ID sym_password;
73
- ID sym_periodic;
74
- ID sym_persisted;
75
- ID sym_plain;
76
- ID sym_pool;
77
- ID sym_port;
78
- ID sym_post;
79
- ID sym_prepend;
80
- ID sym_production;
81
- ID sym_put;
82
- ID sym_quiet;
83
- ID sym_replace;
84
- ID sym_replica;
85
- ID sym_send_threshold;
86
- ID sym_set;
87
- ID sym_stats;
88
- ID sym_timeout;
89
- ID sym_touch;
90
- ID sym_ttl;
91
- ID sym_type;
92
- ID sym_unlock;
93
- ID sym_username;
94
- ID sym_version;
95
- ID sym_view;
96
- ID id_arity;
97
- ID id_call;
98
- ID id_delete;
99
- ID id_dump;
100
- ID id_dup;
101
- ID id_flatten_bang;
102
- ID id_has_key_p;
103
- ID id_host;
104
- ID id_iv_cas;
105
- ID id_iv_completed;
106
- ID id_iv_error;
107
- ID id_iv_flags;
108
- ID id_iv_from_master;
109
- ID id_iv_headers;
110
- ID id_iv_key;
111
- ID id_iv_node;
112
- ID id_iv_operation;
113
- ID id_iv_status;
114
- ID id_iv_time_to_persist;
115
- ID id_iv_time_to_replicate;
116
- ID id_iv_value;
117
- ID id_load;
118
- ID id_match;
119
- ID id_observe_and_wait;
120
- ID id_parse;
121
- ID id_password;
122
- ID id_path;
123
- ID id_port;
124
- ID id_scheme;
125
- ID id_to_s;
126
- ID id_user;
127
- ID id_verify_observe_options;
35
+ ID cb_sym_add;
36
+ ID cb_sym_append;
37
+ ID cb_sym_assemble_hash;
38
+ ID cb_sym_body;
39
+ ID cb_sym_bucket;
40
+ ID cb_sym_cas;
41
+ ID cb_sym_chunked;
42
+ ID cb_sym_content_type;
43
+ ID cb_sym_create;
44
+ ID cb_sym_cluster;
45
+ ID cb_sym_decrement;
46
+ ID cb_sym_default_arithmetic_init;
47
+ ID cb_sym_default_flags;
48
+ ID cb_sym_default_format;
49
+ ID cb_sym_default_observe_timeout;
50
+ ID cb_sym_default_ttl;
51
+ ID cb_sym_delete;
52
+ ID cb_sym_delta;
53
+ ID cb_sym_development;
54
+ ID cb_sym_document;
55
+ ID cb_sym_environment;
56
+ ID cb_sym_extended;
57
+ ID cb_sym_flags;
58
+ ID cb_sym_format;
59
+ ID cb_sym_found;
60
+ ID cb_sym_get;
61
+ ID cb_sym_hostname;
62
+ ID cb_sym_http_request;
63
+ ID cb_sym_increment;
64
+ ID cb_sym_initial;
65
+ ID cb_sym_key_prefix;
66
+ ID cb_sym_lock;
67
+ ID cb_sym_management;
68
+ ID cb_sym_marshal;
69
+ ID cb_sym_method;
70
+ ID cb_sym_node_list;
71
+ ID cb_sym_not_found;
72
+ ID cb_sym_num_replicas;
73
+ ID cb_sym_observe;
74
+ ID cb_sym_password;
75
+ ID cb_sym_periodic;
76
+ ID cb_sym_persisted;
77
+ ID cb_sym_plain;
78
+ ID cb_sym_pool;
79
+ ID cb_sym_port;
80
+ ID cb_sym_post;
81
+ ID cb_sym_prepend;
82
+ ID cb_sym_production;
83
+ ID cb_sym_put;
84
+ ID cb_sym_quiet;
85
+ ID cb_sym_replace;
86
+ ID cb_sym_replica;
87
+ ID cb_sym_send_threshold;
88
+ ID cb_sym_set;
89
+ ID cb_sym_stats;
90
+ ID cb_sym_timeout;
91
+ ID cb_sym_touch;
92
+ ID cb_sym_ttl;
93
+ ID cb_sym_type;
94
+ ID cb_sym_unlock;
95
+ ID cb_sym_username;
96
+ ID cb_sym_version;
97
+ ID cb_sym_view;
98
+ ID cb_id_arity;
99
+ ID cb_id_call;
100
+ ID cb_id_delete;
101
+ ID cb_id_dump;
102
+ ID cb_id_dup;
103
+ ID cb_id_flatten_bang;
104
+ ID cb_id_has_key_p;
105
+ ID cb_id_host;
106
+ ID cb_id_iv_body;
107
+ ID cb_id_iv_cas;
108
+ ID cb_id_iv_completed;
109
+ ID cb_id_iv_error;
110
+ ID cb_id_iv_flags;
111
+ ID cb_id_iv_from_master;
112
+ ID cb_id_iv_headers;
113
+ ID cb_id_iv_inner_exception;
114
+ ID cb_id_iv_key;
115
+ ID cb_id_iv_node;
116
+ ID cb_id_iv_operation;
117
+ ID cb_id_iv_status;
118
+ ID cb_id_iv_time_to_persist;
119
+ ID cb_id_iv_time_to_replicate;
120
+ ID cb_id_iv_value;
121
+ ID cb_id_load;
122
+ ID cb_id_match;
123
+ ID cb_id_observe_and_wait;
124
+ ID cb_id_parse;
125
+ ID cb_id_parse_body_bang;
126
+ ID cb_id_password;
127
+ ID cb_id_path;
128
+ ID cb_id_port;
129
+ ID cb_id_scheme;
130
+ ID cb_id_sprintf;
131
+ ID cb_id_to_s;
132
+ ID cb_id_user;
133
+ ID cb_id_verify_observe_options;
128
134
 
129
135
  /* Errors */
130
- VALUE eBaseError;
131
- VALUE eValueFormatError;
132
- /* LCB_SUCCESS = 0x00 */
133
- /* LCB_AUTH_CONTINUE = 0x01 */
134
- VALUE eAuthError; /* LCB_AUTH_ERROR = 0x02 */
135
- VALUE eDeltaBadvalError; /* LCB_DELTA_BADVAL = 0x03 */
136
- VALUE eTooBigError; /* LCB_E2BIG = 0x04 */
137
- VALUE eBusyError; /* LCB_EBUSY = 0x05 */
138
- VALUE eInternalError; /* LCB_EINTERNAL = 0x06 */
139
- VALUE eInvalidError; /* LCB_EINVAL = 0x07 */
140
- VALUE eNoMemoryError; /* LCB_ENOMEM = 0x08 */
141
- VALUE eRangeError; /* LCB_ERANGE = 0x09 */
142
- VALUE eLibcouchbaseError; /* LCB_ERROR = 0x0a */
143
- VALUE eTmpFailError; /* LCB_ETMPFAIL = 0x0b */
144
- VALUE eKeyExistsError; /* LCB_KEY_EEXISTS = 0x0c */
145
- VALUE eNotFoundError; /* LCB_KEY_ENOENT = 0x0d */
146
- VALUE eLibeventError; /* LCB_LIBEVENT_ERROR = 0x0e */
147
- VALUE eNetworkError; /* LCB_NETWORK_ERROR = 0x0f */
148
- VALUE eNotMyVbucketError; /* LCB_NOT_MY_VBUCKET = 0x10 */
149
- VALUE eNotStoredError; /* LCB_NOT_STORED = 0x11 */
150
- VALUE eNotSupportedError; /* LCB_NOT_SUPPORTED = 0x12 */
151
- VALUE eUnknownCommandError; /* LCB_UNKNOWN_COMMAND = 0x13 */
152
- VALUE eUnknownHostError; /* LCB_UNKNOWN_HOST = 0x14 */
153
- VALUE eProtocolError; /* LCB_PROTOCOL_ERROR = 0x15 */
154
- VALUE eTimeoutError; /* LCB_ETIMEDOUT = 0x16 */
155
- VALUE eConnectError; /* LCB_CONNECT_ERROR = 0x17 */
156
- VALUE eBucketNotFoundError; /* LCB_BUCKET_ENOENT = 0x18 */
157
- VALUE eClientNoMemoryError; /* LCB_CLIENT_ENOMEM = 0x19 */
158
- VALUE eClientTmpFailError; /* LCB_CLIENT_ETMPFAIL = 0x20 */
136
+ VALUE cb_eBaseError;
137
+ VALUE cb_eValueFormatError;
138
+ VALUE cb_eHTTPError;
159
139
 
140
+ /* LCB_SUCCESS = 0x00 */
141
+ /* LCB_AUTH_CONTINUE = 0x01 */
142
+ VALUE cb_eAuthError; /* LCB_AUTH_ERROR = 0x02 */
143
+ VALUE cb_eDeltaBadvalError; /* LCB_DELTA_BADVAL = 0x03 */
144
+ VALUE cb_eTooBigError; /* LCB_E2BIG = 0x04 */
145
+ VALUE cb_eBusyError; /* LCB_EBUSY = 0x05 */
146
+ VALUE cb_eInternalError; /* LCB_EINTERNAL = 0x06 */
147
+ VALUE cb_eInvalidError; /* LCB_EINVAL = 0x07 */
148
+ VALUE cb_eNoMemoryError; /* LCB_ENOMEM = 0x08 */
149
+ VALUE cb_eRangeError; /* LCB_ERANGE = 0x09 */
150
+ VALUE cb_eLibcouchbaseError; /* LCB_ERROR = 0x0a */
151
+ VALUE cb_eTmpFailError; /* LCB_ETMPFAIL = 0x0b */
152
+ VALUE cb_eKeyExistsError; /* LCB_KEY_EEXISTS = 0x0c */
153
+ VALUE cb_eNotFoundError; /* LCB_KEY_ENOENT = 0x0d */
154
+ VALUE cb_eDlopenFailedError; /* LCB_DLOPEN_FAILED = 0x0e */
155
+ VALUE cb_eDlsymFailedError; /* LCB_DLSYM_FAILED = 0x0f */
156
+ VALUE cb_eNetworkError; /* LCB_NETWORK_ERROR = 0x10 */
157
+ VALUE cb_eNotMyVbucketError; /* LCB_NOT_MY_VBUCKET = 0x11 */
158
+ VALUE cb_eNotStoredError; /* LCB_NOT_STORED = 0x12 */
159
+ VALUE cb_eNotSupportedError; /* LCB_NOT_SUPPORTED = 0x13 */
160
+ VALUE cb_eUnknownCommandError; /* LCB_UNKNOWN_COMMAND = 0x14 */
161
+ VALUE cb_eUnknownHostError; /* LCB_UNKNOWN_HOST = 0x15 */
162
+ VALUE cb_eProtocolError; /* LCB_PROTOCOL_ERROR = 0x16 */
163
+ VALUE cb_eTimeoutError; /* LCB_ETIMEDOUT = 0x17 */
164
+ VALUE cb_eConnectError; /* LCB_CONNECT_ERROR = 0x18 */
165
+ VALUE cb_eBucketNotFoundError; /* LCB_BUCKET_ENOENT = 0x19 */
166
+ VALUE cb_eClientNoMemoryError; /* LCB_CLIENT_ENOMEM = 0x1a */
167
+ VALUE cb_eClientTmpFailError; /* LCB_CLIENT_ETMPFAIL = 0x1b */
168
+ VALUE cb_eBadHandleError; /* LCB_EBADHANDLE = 0x1c */
169
+
170
+ /* Default Strings */
171
+ VALUE cb_vStrDefault;
172
+ VALUE cb_vStrEmpty;
160
173
 
161
174
  /* Ruby Extension initializer */
162
175
  void
163
176
  Init_couchbase_ext(void)
164
177
  {
165
- mMultiJson = rb_const_get(rb_cObject, rb_intern("MultiJson"));
166
- mURI = rb_const_get(rb_cObject, rb_intern("URI"));
167
- mMarshal = rb_const_get(rb_cObject, rb_intern("Marshal"));
168
- mCouchbase = rb_define_module("Couchbase");
178
+ cb_mMultiJson = rb_const_get(rb_cObject, rb_intern("MultiJson"));
179
+ cb_mURI = rb_const_get(rb_cObject, rb_intern("URI"));
180
+ cb_mMarshal = rb_const_get(rb_cObject, rb_intern("Marshal"));
181
+ cb_mCouchbase = rb_define_module("Couchbase");
169
182
 
170
- mError = rb_define_module_under(mCouchbase, "Error");
183
+ cb_mError = rb_define_module_under(cb_mCouchbase, "Error");
171
184
  /* Document-class: Couchbase::Error::Base
172
185
  * The base error class
173
186
  *
174
187
  * @since 1.0.0
175
188
  */
176
- eBaseError = rb_define_class_under(mError, "Base", rb_eStandardError);
189
+ cb_eBaseError = rb_define_class_under(cb_mError, "Base", rb_eStandardError);
177
190
  /* Document-class: Couchbase::Error::Auth
178
191
  * Authentication error
179
192
  *
193
+ * You provided an invalid username/password combination.
194
+ *
180
195
  * @since 1.0.0
181
196
  */
182
- eAuthError = rb_define_class_under(mError, "Auth", eBaseError);
197
+ cb_eAuthError = rb_define_class_under(cb_mError, "Auth", cb_eBaseError);
183
198
  /* Document-class: Couchbase::Error::BucketNotFound
184
- * The given bucket not found in the cluster
199
+ * Bucket not found
200
+ *
201
+ * The requested bucket not found in the cluster
185
202
  *
186
203
  * @since 1.0.0
187
204
  */
188
- eBucketNotFoundError = rb_define_class_under(mError, "BucketNotFound", eBaseError);
205
+ cb_eBucketNotFoundError = rb_define_class_under(cb_mError, "BucketNotFound", cb_eBaseError);
189
206
  /* Document-class: Couchbase::Error::Busy
190
- * The cluster is too busy now. Try again later
207
+ * The cluster is too busy
208
+ *
209
+ * The server is too busy to handle your request right now.
210
+ * please back off and try again at a later time.
191
211
  *
192
212
  * @since 1.0.0
193
213
  */
194
- eBusyError = rb_define_class_under(mError, "Busy", eBaseError);
214
+ cb_eBusyError = rb_define_class_under(cb_mError, "Busy", cb_eBaseError);
195
215
  /* Document-class: Couchbase::Error::DeltaBadval
196
216
  * The given value is not a number
197
217
  *
198
218
  * @since 1.0.0
199
219
  */
200
- eDeltaBadvalError = rb_define_class_under(mError, "DeltaBadval", eBaseError);
220
+ cb_eDeltaBadvalError = rb_define_class_under(cb_mError, "DeltaBadval", cb_eBaseError);
201
221
  /* Document-class: Couchbase::Error::Internal
202
222
  * Internal error
203
223
  *
224
+ * Internal error inside the library. You would have
225
+ * to destroy the instance and create a new one to recover.
226
+ *
204
227
  * @since 1.0.0
205
228
  */
206
- eInternalError = rb_define_class_under(mError, "Internal", eBaseError);
229
+ cb_eInternalError = rb_define_class_under(cb_mError, "Internal", cb_eBaseError);
207
230
  /* Document-class: Couchbase::Error::Invalid
208
231
  * Invalid arguments
209
232
  *
210
233
  * @since 1.0.0
211
234
  */
212
- eInvalidError = rb_define_class_under(mError, "Invalid", eBaseError);
235
+ cb_eInvalidError = rb_define_class_under(cb_mError, "Invalid", cb_eBaseError);
213
236
  /* Document-class: Couchbase::Error::KeyExists
214
237
  * Key already exists
215
238
  *
239
+ * The key already exists (with another CAS value)
240
+ *
216
241
  * @since 1.0.0
217
242
  */
218
- eKeyExistsError = rb_define_class_under(mError, "KeyExists", eBaseError);
243
+ cb_eKeyExistsError = rb_define_class_under(cb_mError, "KeyExists", cb_eBaseError);
219
244
  /* Document-class: Couchbase::Error::Libcouchbase
220
245
  * Generic error
221
246
  *
222
247
  * @since 1.0.0
223
248
  */
224
- eLibcouchbaseError = rb_define_class_under(mError, "Libcouchbase", eBaseError);
225
- /* Document-class: Couchbase::Error::Libevent
226
- * Problem using libevent
227
- *
228
- * @since 1.0.0
229
- */
230
- eLibeventError = rb_define_class_under(mError, "Libevent", eBaseError);
249
+ cb_eLibcouchbaseError = rb_define_class_under(cb_mError, "Libcouchbase", cb_eBaseError);
231
250
  /* Document-class: Couchbase::Error::Network
232
251
  * Network error
233
252
  *
253
+ * A network related problem occured (name lookup, read/write/connect
254
+ * etc)
255
+ *
234
256
  * @since 1.0.0
235
257
  */
236
- eNetworkError = rb_define_class_under(mError, "Network", eBaseError);
258
+ cb_eNetworkError = rb_define_class_under(cb_mError, "Network", cb_eBaseError);
237
259
  /* Document-class: Couchbase::Error::NoMemory
238
260
  * Out of memory error (on Server)
239
261
  *
262
+ * The client ran out of memory
263
+ *
240
264
  * @since 1.0.0
241
265
  */
242
- eNoMemoryError = rb_define_class_under(mError, "NoMemory", eBaseError);
266
+ cb_eNoMemoryError = rb_define_class_under(cb_mError, "NoMemory", cb_eBaseError);
243
267
  /* Document-class: Couchbase::Error::ClientNoMemory
244
268
  * Out of memory error (on Client)
245
269
  *
246
270
  * @since 1.2.0.dp6
247
271
  */
248
- eClientNoMemoryError = rb_define_class_under(mError, "ClientNoMemory", eBaseError);
272
+ cb_eClientNoMemoryError = rb_define_class_under(cb_mError, "ClientNoMemory", cb_eBaseError);
249
273
  /* Document-class: Couchbase::Error::NotFound
250
274
  * No such key
251
275
  *
252
276
  * @since 1.0.0
253
277
  */
254
- eNotFoundError = rb_define_class_under(mError, "NotFound", eBaseError);
278
+ cb_eNotFoundError = rb_define_class_under(cb_mError, "NotFound", cb_eBaseError);
255
279
  /* Document-class: Couchbase::Error::NotMyVbucket
256
280
  * The vbucket is not located on this server
257
281
  *
282
+ * The server who received the request is not responsible for the
283
+ * object anymore. (This happens during changes in the cluster
284
+ * topology)
285
+ *
258
286
  * @since 1.0.0
259
287
  */
260
- eNotMyVbucketError = rb_define_class_under(mError, "NotMyVbucket", eBaseError);
288
+ cb_eNotMyVbucketError = rb_define_class_under(cb_mError, "NotMyVbucket", cb_eBaseError);
261
289
  /* Document-class: Couchbase::Error::NotStored
262
290
  * Not stored
263
291
  *
292
+ * The object was not stored on the server
293
+ *
264
294
  * @since 1.0.0
265
295
  */
266
- eNotStoredError = rb_define_class_under(mError, "NotStored", eBaseError);
296
+ cb_eNotStoredError = rb_define_class_under(cb_mError, "NotStored", cb_eBaseError);
267
297
  /* Document-class: Couchbase::Error::NotSupported
268
298
  * Not supported
269
299
  *
300
+ * The server doesn't support the requested command. This error differs
301
+ * from {Couchbase::Error::UnknownCommand} by that the server knows
302
+ * about the command, but for some reason decided to not support it.
303
+ *
270
304
  * @since 1.0.0
271
305
  */
272
- eNotSupportedError = rb_define_class_under(mError, "NotSupported", eBaseError);
306
+ cb_eNotSupportedError = rb_define_class_under(cb_mError, "NotSupported", cb_eBaseError);
273
307
  /* Document-class: Couchbase::Error::Range
274
308
  * Invalid range
275
309
  *
310
+ * An invalid range specified
311
+ *
276
312
  * @since 1.0.0
277
313
  */
278
- eRangeError = rb_define_class_under(mError, "Range", eBaseError);
314
+ cb_eRangeError = rb_define_class_under(cb_mError, "Range", cb_eBaseError);
279
315
  /* Document-class: Couchbase::Error::TemporaryFail
280
- * Temporary failure. Try again later
316
+ * Temporary failure
317
+ *
318
+ * The server tried to perform the requested operation, but failed
319
+ * due to a temporary constraint. Retrying the operation may work.
281
320
  *
282
321
  * @since 1.0.0
283
322
  */
284
- eTmpFailError = rb_define_class_under(mError, "TemporaryFail", eBaseError);
323
+ cb_eTmpFailError = rb_define_class_under(cb_mError, "TemporaryFail", cb_eBaseError);
285
324
  /* Document-class: Couchbase::Error::ClientTemporaryFail
286
325
  * Temporary failure (on Client)
287
326
  *
327
+ * The client encountered a temporary error (retry might resolve
328
+ * the problem)
329
+ *
288
330
  * @since 1.2.0
289
331
  */
290
- eClientTmpFailError = rb_define_class_under(mError, "ClientTemporaryFail", eBaseError);
332
+ cb_eClientTmpFailError = rb_define_class_under(cb_mError, "ClientTemporaryFail", cb_eBaseError);
291
333
  /* Document-class: Couchbase::Error::TooBig
292
334
  * Object too big
293
335
  *
336
+ * The sever reported that this object is too big
337
+ *
294
338
  * @since 1.0.0
295
339
  */
296
- eTooBigError = rb_define_class_under(mError, "TooBig", eBaseError);
340
+ cb_eTooBigError = rb_define_class_under(cb_mError, "TooBig", cb_eBaseError);
297
341
  /* Document-class: Couchbase::Error::UnknownCommand
298
342
  * Unknown command
299
343
  *
344
+ * The server doesn't know what that command is.
345
+ *
300
346
  * @since 1.0.0
301
347
  */
302
- eUnknownCommandError = rb_define_class_under(mError, "UnknownCommand", eBaseError);
348
+ cb_eUnknownCommandError = rb_define_class_under(cb_mError, "UnknownCommand", cb_eBaseError);
303
349
  /* Document-class: Couchbase::Error::UnknownHost
304
350
  * Unknown host
305
351
  *
352
+ * The server failed to resolve the requested hostname
353
+ *
306
354
  * @since 1.0.0
307
355
  */
308
- eUnknownHostError = rb_define_class_under(mError, "UnknownHost", eBaseError);
356
+ cb_eUnknownHostError = rb_define_class_under(cb_mError, "UnknownHost", cb_eBaseError);
309
357
  /* Document-class: Couchbase::Error::ValueFormat
310
358
  * Failed to decode or encode value
311
359
  *
312
360
  * @since 1.0.0
313
361
  */
314
- eValueFormatError = rb_define_class_under(mError, "ValueFormat", eBaseError);
362
+ cb_eValueFormatError = rb_define_class_under(cb_mError, "ValueFormat", cb_eBaseError);
315
363
  /* Document-class: Couchbase::Error::Protocol
316
364
  * Protocol error
317
365
  *
366
+ * There is something wrong with the datastream received from
367
+ * the server
368
+ *
318
369
  * @since 1.0.0
319
370
  */
320
- eProtocolError = rb_define_class_under(mError, "Protocol", eBaseError);
371
+ cb_eProtocolError = rb_define_class_under(cb_mError, "Protocol", cb_eBaseError);
321
372
  /* Document-class: Couchbase::Error::Timeout
322
373
  * Timeout error
323
374
  *
375
+ * The operation timed out
376
+ *
324
377
  * @since 1.1.0
325
378
  */
326
- eTimeoutError = rb_define_class_under(mError, "Timeout", eBaseError);
379
+ cb_eTimeoutError = rb_define_class_under(cb_mError, "Timeout", cb_eBaseError);
327
380
  /* Document-class: Couchbase::Error::Connect
328
381
  * Connect error
329
382
  *
330
383
  * @since 1.1.0
331
384
  */
332
- eConnectError = rb_define_class_under(mError, "Connect", eBaseError);
385
+ cb_eConnectError = rb_define_class_under(cb_mError, "Connect", cb_eBaseError);
386
+ /* Document-class: Couchbase::Error::BadHandle
387
+ * Invalid handle type.
388
+ *
389
+ * The requested operation isn't allowed for given type.
390
+ *
391
+ * @since 1.2.0
392
+ */
393
+ cb_eBadHandleError = rb_define_class_under(cb_mError, "BadHandle", cb_eBaseError);
333
394
 
395
+ /* Document-class: Couchbase::Error::DlopenFailed
396
+ * dlopen() failed
397
+ *
398
+ * Failed to open shared object
399
+ *
400
+ * @since 1.2.0
401
+ */
402
+ cb_eDlopenFailedError = rb_define_class_under(cb_mError, "DlopenFailed", cb_eBaseError);
403
+
404
+ /* Document-class: Couchbase::Error::DlsymFailed
405
+ * dlsym() failed
406
+ *
407
+ * Failed to locate the requested cb_symbol in the shared object
408
+ *
409
+ * @since 1.2.0
410
+ */
411
+ cb_eDlsymFailedError = rb_define_class_under(cb_mError, "DlsymFailed", cb_eBaseError);
412
+
413
+ /* Document-class: Couchbase::Error::HTTP
414
+ * HTTP error with status code
415
+ *
416
+ * @since 1.2.0
417
+ */
418
+ cb_eHTTPError = rb_define_class_under(cb_mError, "HTTP", cb_eBaseError);
419
+ cb_id_iv_body = rb_intern("@body");
334
420
  /* Document-method: error
335
421
  *
336
422
  * The underlying libcouchbase library could return one of the following
@@ -342,62 +428,74 @@ Init_couchbase_ext(void)
342
428
  * 0x02 :: LCB_AUTH_ERROR (Authentication error)
343
429
  * 0x03 :: LCB_DELTA_BADVAL (Not a number)
344
430
  * 0x04 :: LCB_E2BIG (Object too big)
345
- * 0x05 :: LCB_EBUSY (Too busy. Try again later)
431
+ * 0x05 :: LCB_EBUSY (Too busy)
346
432
  * 0x06 :: LCB_EINTERNAL (Internal error)
347
433
  * 0x07 :: LCB_EINVAL (Invalid arguments)
348
434
  * 0x08 :: LCB_ENOMEM (Out of memory)
349
435
  * 0x09 :: LCB_ERANGE (Invalid range)
350
436
  * 0x0a :: LCB_ERROR (Generic error)
351
- * 0x0b :: LCB_ETMPFAIL (Temporary failure. Try again later)
437
+ * 0x0b :: LCB_ETMPFAIL (Temporary failure)
352
438
  * 0x0c :: LCB_KEY_EEXISTS (Key exists (with a different CAS value))
353
439
  * 0x0d :: LCB_KEY_ENOENT (No such key)
354
- * 0x0e :: LCB_LIBEVENT_ERROR (Problem using libevent)
355
- * 0x0f :: LCB_NETWORK_ERROR (Network error)
356
- * 0x10 :: LCB_NOT_MY_VBUCKET (The vbucket is not located on this server)
357
- * 0x11 :: LCB_NOT_STORED (Not stored)
358
- * 0x12 :: LCB_NOT_SUPPORTED (Not supported)
359
- * 0x13 :: LCB_UNKNOWN_COMMAND (Unknown command)
360
- * 0x14 :: LCB_UNKNOWN_HOST (Unknown host)
361
- * 0x15 :: LCB_PROTOCOL_ERROR (Protocol error)
362
- * 0x16 :: LCB_ETIMEDOUT (Operation timed out)
363
- * 0x17 :: LCB_CONNECT_ERROR (Connection failure)
364
- * 0x18 :: LCB_BUCKET_ENOENT (No such bucket)
365
- * 0x18 :: LCB_CLIENT_ENOMEM (Out of memory on the client)
440
+ * 0x0e :: LCB_DLOPEN_FAILED (Failed to open shared object)
441
+ * 0x0f :: LCB_DLSYM_FAILED (Failed to locate the requested cb_symbol in shared object)
442
+ * 0x10 :: LCB_NETWORK_ERROR (Network error)
443
+ * 0x11 :: LCB_NOT_MY_VBUCKET (The vbucket is not located on this server)
444
+ * 0x12 :: LCB_NOT_STORED (Not stored)
445
+ * 0x13 :: LCB_NOT_SUPPORTED (Not supported)
446
+ * 0x14 :: LCB_UNKNOWN_COMMAND (Unknown command)
447
+ * 0x15 :: LCB_UNKNOWN_HOST (Unknown host)
448
+ * 0x16 :: LCB_PROTOCOL_ERROR (Protocol error)
449
+ * 0x17 :: LCB_ETIMEDOUT (Operation timed out)
450
+ * 0x18 :: LCB_CONNECT_ERROR (Connection failure)
451
+ * 0x19 :: LCB_BUCKET_ENOENT (No such bucket)
452
+ * 0x1a :: LCB_CLIENT_ENOMEM (Out of memory on the client)
453
+ * 0x1b :: LCB_CLIENT_ETMPFAIL (Temporary failure on the client)
454
+ * 0x1c :: LCB_EBADHANDLE (Invalid handle type)
455
+ *
366
456
  *
367
457
  * @since 1.0.0
368
458
  *
369
459
  * @return [Fixnum] the error code from libcouchbase
370
460
  */
371
- rb_define_attr(eBaseError, "error", 1, 0);
372
- id_iv_error = rb_intern("@error");
461
+ rb_define_attr(cb_eBaseError, "error", 1, 0);
462
+ cb_id_iv_error = rb_intern("@error");
373
463
  /* Document-method: status
374
464
  *
375
465
  * @since 1.2.0.beta
376
466
  *
377
467
  * @return [Fixnum] The HTTP status code */
378
- rb_define_attr(eBaseError, "status", 1, 0);
379
- id_iv_status = rb_intern("@status");
468
+ rb_define_attr(cb_eBaseError, "status", 1, 0);
469
+ cb_id_iv_status = rb_intern("@status");
380
470
  /* Document-method: key
381
471
  *
382
472
  * @since 1.0.0
383
473
  *
384
474
  * @return [String] the key which generated error */
385
- rb_define_attr(eBaseError, "key", 1, 0);
386
- id_iv_key = rb_intern("@key");
475
+ rb_define_attr(cb_eBaseError, "key", 1, 0);
476
+ cb_id_iv_key = rb_intern("@key");
387
477
  /* Document-method: cas
388
478
  *
389
479
  * @since 1.0.0
390
480
  *
391
481
  * @return [Fixnum] the version of the key (+nil+ unless accessible) */
392
- rb_define_attr(eBaseError, "cas", 1, 0);
393
- id_iv_cas = rb_intern("@cas");
482
+ rb_define_attr(cb_eBaseError, "cas", 1, 0);
483
+ cb_id_iv_cas = rb_intern("@cas");
394
484
  /* Document-method: operation
395
485
  *
396
486
  * @since 1.0.0
397
487
  *
398
488
  * @return [Symbol] the operation (+nil+ unless accessible) */
399
- rb_define_attr(eBaseError, "operation", 1, 0);
400
- id_iv_operation = rb_intern("@operation");
489
+ rb_define_attr(cb_eBaseError, "operation", 1, 0);
490
+ cb_id_iv_operation = rb_intern("@operation");
491
+ /* Document-method: inner_exception
492
+ *
493
+ * @since 1.2.0.beta4
494
+ *
495
+ * @return [Exception] the inner exception or +nil+. Some exceptions like
496
+ * {Error::ValueFormat} wrap the original exception */
497
+ rb_define_attr(cb_eBaseError, "inner_exception", 1, 0);
498
+ cb_id_iv_inner_exception = rb_intern("@inner_exception");
401
499
 
402
500
  /* Document-class: Couchbase::Result
403
501
  *
@@ -405,63 +503,63 @@ Init_couchbase_ext(void)
405
503
  *
406
504
  * @since 1.0.0
407
505
  */
408
- cResult = rb_define_class_under(mCouchbase, "Result", rb_cObject);
409
- rb_define_method(cResult, "inspect", cb_result_inspect, 0);
410
- rb_define_method(cResult, "success?", cb_result_success_p, 0);
506
+ cb_cResult = rb_define_class_under(cb_mCouchbase, "Result", rb_cObject);
507
+ rb_define_method(cb_cResult, "inspect", cb_result_inspect, 0);
508
+ rb_define_method(cb_cResult, "success?", cb_result_success_p, 0);
411
509
  /* Document-method: operation
412
510
  *
413
511
  * @since 1.0.0
414
512
  *
415
513
  * @return [Symbol]
416
514
  */
417
- rb_define_attr(cResult, "operation", 1, 0);
515
+ rb_define_attr(cb_cResult, "operation", 1, 0);
418
516
  /* Document-method: error
419
517
  *
420
518
  * @since 1.0.0
421
519
  *
422
520
  * @return [Couchbase::Error::Base]
423
521
  */
424
- rb_define_attr(cResult, "error", 1, 0);
522
+ rb_define_attr(cb_cResult, "error", 1, 0);
425
523
  /* Document-method: key
426
524
  *
427
525
  * @since 1.0.0
428
526
  *
429
527
  * @return [String]
430
528
  */
431
- rb_define_attr(cResult, "key", 1, 0);
432
- id_iv_key = rb_intern("@key");
529
+ rb_define_attr(cb_cResult, "key", 1, 0);
530
+ cb_id_iv_key = rb_intern("@key");
433
531
  /* Document-method: value
434
532
  *
435
533
  * @since 1.0.0
436
534
  *
437
535
  * @return [String]
438
536
  */
439
- rb_define_attr(cResult, "value", 1, 0);
440
- id_iv_value = rb_intern("@value");
537
+ rb_define_attr(cb_cResult, "value", 1, 0);
538
+ cb_id_iv_value = rb_intern("@value");
441
539
  /* Document-method: cas
442
540
  *
443
541
  * @since 1.0.0
444
542
  *
445
543
  * @return [Fixnum]
446
544
  */
447
- rb_define_attr(cResult, "cas", 1, 0);
448
- id_iv_cas = rb_intern("@cas");
545
+ rb_define_attr(cb_cResult, "cas", 1, 0);
546
+ cb_id_iv_cas = rb_intern("@cas");
449
547
  /* Document-method: flags
450
548
  *
451
549
  * @since 1.0.0
452
550
  *
453
551
  * @return [Fixnum]
454
552
  */
455
- rb_define_attr(cResult, "flags", 1, 0);
456
- id_iv_flags = rb_intern("@flags");
553
+ rb_define_attr(cb_cResult, "flags", 1, 0);
554
+ cb_id_iv_flags = rb_intern("@flags");
457
555
  /* Document-method: node
458
556
  *
459
557
  * @since 1.0.0
460
558
  *
461
559
  * @return [String]
462
560
  */
463
- rb_define_attr(cResult, "node", 1, 0);
464
- id_iv_node = rb_intern("@node");
561
+ rb_define_attr(cb_cResult, "node", 1, 0);
562
+ cb_id_iv_node = rb_intern("@node");
465
563
  /* Document-method: headers
466
564
  *
467
565
  * @since 1.2.0
@@ -470,14 +568,14 @@ Init_couchbase_ext(void)
470
568
  *
471
569
  * @return [Hash]
472
570
  */
473
- rb_define_attr(cResult, "headers", 1, 0);
474
- id_iv_headers = rb_intern("@headers");
571
+ rb_define_attr(cb_cResult, "headers", 1, 0);
572
+ cb_id_iv_headers = rb_intern("@headers");
475
573
  /* Document-method: completed
476
574
  * In {Bucket::CouchRequest} operations used to mark the final call
477
575
  * @return [Boolean] */
478
- rb_define_attr(cResult, "completed", 1, 0);
479
- rb_define_alias(cResult, "completed?", "completed");
480
- id_iv_completed = rb_intern("@completed");
576
+ rb_define_attr(cb_cResult, "completed", 1, 0);
577
+ rb_define_alias(cb_cResult, "completed?", "completed");
578
+ cb_id_iv_completed = rb_intern("@completed");
481
579
  /* Document-method: status
482
580
  *
483
581
  * @since 1.2.0.dp6
@@ -491,8 +589,8 @@ Init_couchbase_ext(void)
491
589
  *
492
590
  * @return [Symbol]
493
591
  */
494
- rb_define_attr(cResult, "status", 1, 0);
495
- id_iv_status = rb_intern("@status");
592
+ rb_define_attr(cb_cResult, "status", 1, 0);
593
+ cb_id_iv_status = rb_intern("@status");
496
594
  /* Document-method: from_master
497
595
  *
498
596
  * @since 1.2.0.dp6
@@ -502,9 +600,9 @@ Init_couchbase_ext(void)
502
600
  * True if key stored on master
503
601
  * @return [Boolean]
504
602
  */
505
- rb_define_attr(cResult, "from_master", 1, 0);
506
- rb_define_alias(cResult, "from_master?", "from_master");
507
- id_iv_from_master = rb_intern("@from_master");
603
+ rb_define_attr(cb_cResult, "from_master", 1, 0);
604
+ rb_define_alias(cb_cResult, "from_master?", "from_master");
605
+ cb_id_iv_from_master = rb_intern("@from_master");
508
606
  /* Document-method: time_to_persist
509
607
  *
510
608
  * @since 1.2.0.dp6
@@ -514,9 +612,9 @@ Init_couchbase_ext(void)
514
612
  * Average time needed to persist key on the disk (zero if unavailable)
515
613
  * @return [Fixnum]
516
614
  */
517
- rb_define_attr(cResult, "time_to_persist", 1, 0);
518
- rb_define_alias(cResult, "ttp", "time_to_persist");
519
- id_iv_time_to_persist = rb_intern("@time_to_persist");
615
+ rb_define_attr(cb_cResult, "time_to_persist", 1, 0);
616
+ rb_define_alias(cb_cResult, "ttp", "time_to_persist");
617
+ cb_id_iv_time_to_persist = rb_intern("@time_to_persist");
520
618
  /* Document-method: time_to_persist
521
619
  *
522
620
  * @since 1.2.0.dp6
@@ -526,9 +624,9 @@ Init_couchbase_ext(void)
526
624
  * Average time needed to replicate key on the disk (zero if unavailable)
527
625
  * @return [Fixnum]
528
626
  */
529
- rb_define_attr(cResult, "time_to_replicate", 1, 0);
530
- rb_define_alias(cResult, "ttr", "time_to_replicate");
531
- id_iv_time_to_replicate = rb_intern("@time_to_replicate");
627
+ rb_define_attr(cb_cResult, "time_to_replicate", 1, 0);
628
+ rb_define_alias(cb_cResult, "ttr", "time_to_replicate");
629
+ cb_id_iv_time_to_replicate = rb_intern("@time_to_replicate");
532
630
 
533
631
  /* Document-class: Couchbase::Bucket
534
632
  *
@@ -537,60 +635,60 @@ Init_couchbase_ext(void)
537
635
  *
538
636
  * @since 1.0.0
539
637
  */
540
- cBucket = rb_define_class_under(mCouchbase, "Bucket", rb_cObject);
638
+ cb_cBucket = rb_define_class_under(cb_mCouchbase, "Bucket", rb_cObject);
541
639
 
542
640
  /* 0x03: Bitmask for flag bits responsible for format */
543
- rb_define_const(cBucket, "FMT_MASK", INT2FIX(FMT_MASK));
641
+ rb_define_const(cb_cBucket, "FMT_MASK", INT2FIX(CB_FMT_MASK));
544
642
  /* 0x00: Document format. The (default) format supports most of ruby
545
643
  * types which could be mapped to JSON data (hashes, arrays, strings,
546
644
  * numbers). Future version will be able to run map/reduce queries on
547
645
  * the values in the document form (hashes). */
548
- rb_define_const(cBucket, "FMT_DOCUMENT", INT2FIX(FMT_DOCUMENT));
646
+ rb_define_const(cb_cBucket, "FMT_DOCUMENT", INT2FIX(CB_FMT_DOCUMENT));
549
647
  /* 0x01: Marshal format. The format which supports transparent
550
648
  * serialization of ruby objects with standard <tt>Marshal.dump</tt> and
551
649
  * <tt>Marhal.load</tt> methods. */
552
- rb_define_const(cBucket, "FMT_MARSHAL", INT2FIX(FMT_MARSHAL));
650
+ rb_define_const(cb_cBucket, "FMT_MARSHAL", INT2FIX(CB_FMT_MARSHAL));
553
651
  /* 0x02: Plain format. The format which force client don't apply any
554
652
  * conversions to the value, but it should be passed as String. It
555
653
  * could be useful for building custom algorithms or formats. For
556
654
  * example implement set:
557
655
  * http://dustin.github.com/2011/02/17/memcached-set.html */
558
- rb_define_const(cBucket, "FMT_PLAIN", INT2FIX(FMT_PLAIN));
559
-
560
- rb_define_alloc_func(cBucket, cb_bucket_alloc);
561
- rb_define_method(cBucket, "initialize", cb_bucket_init, -1);
562
- rb_define_method(cBucket, "initialize_copy", cb_bucket_init_copy, 1);
563
- rb_define_method(cBucket, "inspect", cb_bucket_inspect, 0);
564
-
565
- rb_define_method(cBucket, "add", cb_bucket_add, -1);
566
- rb_define_method(cBucket, "append", cb_bucket_append, -1);
567
- rb_define_method(cBucket, "prepend", cb_bucket_prepend, -1);
568
- rb_define_method(cBucket, "replace", cb_bucket_replace, -1);
569
- rb_define_method(cBucket, "set", cb_bucket_set, -1);
570
- rb_define_method(cBucket, "get", cb_bucket_get, -1);
571
- rb_define_method(cBucket, "run", cb_bucket_run, -1);
572
- rb_define_method(cBucket, "stop", cb_bucket_stop, 0);
573
- rb_define_method(cBucket, "touch", cb_bucket_touch, -1);
574
- rb_define_method(cBucket, "delete", cb_bucket_delete, -1);
575
- rb_define_method(cBucket, "stats", cb_bucket_stats, -1);
576
- rb_define_method(cBucket, "version", cb_bucket_version, -1);
577
- rb_define_method(cBucket, "incr", cb_bucket_incr, -1);
578
- rb_define_method(cBucket, "decr", cb_bucket_decr, -1);
579
- rb_define_method(cBucket, "unlock", cb_bucket_unlock, -1);
580
- rb_define_method(cBucket, "disconnect", cb_bucket_disconnect, 0);
581
- rb_define_method(cBucket, "reconnect", cb_bucket_reconnect, -1);
582
- rb_define_method(cBucket, "make_http_request", cb_bucket_make_http_request, -1);
583
- rb_define_method(cBucket, "observe", cb_bucket_observe, -1);
584
-
585
- rb_define_alias(cBucket, "decrement", "decr");
586
- rb_define_alias(cBucket, "increment", "incr");
587
-
588
- rb_define_alias(cBucket, "[]", "get");
589
- rb_define_alias(cBucket, "[]=", "set");
590
- rb_define_method(cBucket, "[]=", cb_bucket_aset, -1);
591
-
592
- rb_define_method(cBucket, "connected?", cb_bucket_connected_p, 0);
593
- rb_define_method(cBucket, "async?", cb_bucket_async_p, 0);
656
+ rb_define_const(cb_cBucket, "FMT_PLAIN", INT2FIX(CB_FMT_PLAIN));
657
+
658
+ rb_define_alloc_func(cb_cBucket, cb_bucket_alloc);
659
+ rb_define_method(cb_cBucket, "initialize", cb_bucket_init, -1);
660
+ rb_define_method(cb_cBucket, "initialize_copy", cb_bucket_init_copy, 1);
661
+ rb_define_method(cb_cBucket, "inspect", cb_bucket_inspect, 0);
662
+
663
+ rb_define_method(cb_cBucket, "add", cb_bucket_add, -1);
664
+ rb_define_method(cb_cBucket, "append", cb_bucket_append, -1);
665
+ rb_define_method(cb_cBucket, "prepend", cb_bucket_prepend, -1);
666
+ rb_define_method(cb_cBucket, "replace", cb_bucket_replace, -1);
667
+ rb_define_method(cb_cBucket, "set", cb_bucket_set, -1);
668
+ rb_define_method(cb_cBucket, "get", cb_bucket_get, -1);
669
+ rb_define_method(cb_cBucket, "run", cb_bucket_run, -1);
670
+ rb_define_method(cb_cBucket, "stop", cb_bucket_stop, 0);
671
+ rb_define_method(cb_cBucket, "touch", cb_bucket_touch, -1);
672
+ rb_define_method(cb_cBucket, "delete", cb_bucket_delete, -1);
673
+ rb_define_method(cb_cBucket, "stats", cb_bucket_stats, -1);
674
+ rb_define_method(cb_cBucket, "version", cb_bucket_version, -1);
675
+ rb_define_method(cb_cBucket, "incr", cb_bucket_incr, -1);
676
+ rb_define_method(cb_cBucket, "decr", cb_bucket_decr, -1);
677
+ rb_define_method(cb_cBucket, "unlock", cb_bucket_unlock, -1);
678
+ rb_define_method(cb_cBucket, "disconnect", cb_bucket_disconnect, 0);
679
+ rb_define_method(cb_cBucket, "reconnect", cb_bucket_reconnect, -1);
680
+ rb_define_method(cb_cBucket, "make_http_request", cb_bucket_make_http_request, -1);
681
+ rb_define_method(cb_cBucket, "observe", cb_bucket_observe, -1);
682
+
683
+ rb_define_alias(cb_cBucket, "decrement", "decr");
684
+ rb_define_alias(cb_cBucket, "increment", "incr");
685
+
686
+ rb_define_alias(cb_cBucket, "[]", "get");
687
+ rb_define_alias(cb_cBucket, "[]=", "set");
688
+ rb_define_method(cb_cBucket, "[]=", cb_bucket_aset, -1);
689
+
690
+ rb_define_method(cb_cBucket, "connected?", cb_bucket_connected_p, 0);
691
+ rb_define_method(cb_cBucket, "async?", cb_bucket_async_p, 0);
594
692
 
595
693
  /* Document-method: quiet
596
694
  * Flag specifying behaviour for operations on missing keys
@@ -609,10 +707,10 @@ Init_couchbase_ext(void)
609
707
  * connection.get("miss") #=> will raise Couchbase::Error::NotFound
610
708
  *
611
709
  * @return [true, false] */
612
- /* rb_define_attr(cBucket, "quiet", 1, 1); */
613
- rb_define_method(cBucket, "quiet", cb_bucket_quiet_get, 0);
614
- rb_define_method(cBucket, "quiet=", cb_bucket_quiet_set, 1);
615
- rb_define_alias(cBucket, "quiet?", "quiet");
710
+ /* rb_define_attr(cb_cBucket, "quiet", 1, 1); */
711
+ rb_define_method(cb_cBucket, "quiet", cb_bucket_quiet_get, 0);
712
+ rb_define_method(cb_cBucket, "quiet=", cb_bucket_quiet_set, 1);
713
+ rb_define_alias(cb_cBucket, "quiet?", "quiet");
616
714
 
617
715
  /* Document-method: default_flags
618
716
  * Default flags for new values.
@@ -631,9 +729,9 @@ Init_couchbase_ext(void)
631
729
  * @note Amending format bit will also change #default_format value
632
730
  *
633
731
  * @return [Fixnum] the effective flags */
634
- /* rb_define_attr(cBucket, "default_flags", 1, 1); */
635
- rb_define_method(cBucket, "default_flags", cb_bucket_default_flags_get, 0);
636
- rb_define_method(cBucket, "default_flags=", cb_bucket_default_flags_set, 1);
732
+ /* rb_define_attr(cb_cBucket, "default_flags", 1, 1); */
733
+ rb_define_method(cb_cBucket, "default_flags", cb_bucket_default_flags_get, 0);
734
+ rb_define_method(cb_cBucket, "default_flags=", cb_bucket_default_flags_set, 1);
637
735
 
638
736
  /* Document-method: default_format
639
737
  * Default format for new values.
@@ -663,7 +761,7 @@ Init_couchbase_ext(void)
663
761
  * your ruby object with standard <tt>Marshal.dump</tt> and
664
762
  * <tt>Marhal.load</tt> methods.
665
763
  *
666
- * @example Selecting plain format using symbol
764
+ * @example Selecting plain format using cb_symbol
667
765
  * connection.format = :document
668
766
  *
669
767
  * @example Selecting plain format using Fixnum constant
@@ -672,9 +770,9 @@ Init_couchbase_ext(void)
672
770
  * @note Amending default_format will also change #default_flags value
673
771
  *
674
772
  * @return [Symbol] the effective format */
675
- /* rb_define_attr(cBucket, "default_format", 1, 1); */
676
- rb_define_method(cBucket, "default_format", cb_bucket_default_format_get, 0);
677
- rb_define_method(cBucket, "default_format=", cb_bucket_default_format_set, 1);
773
+ /* rb_define_attr(cb_cBucket, "default_format", 1, 1); */
774
+ rb_define_method(cb_cBucket, "default_format", cb_bucket_default_format_get, 0);
775
+ rb_define_method(cb_cBucket, "default_format=", cb_bucket_default_format_set, 1);
678
776
 
679
777
  /* Document-method: timeout
680
778
  *
@@ -683,9 +781,23 @@ Init_couchbase_ext(void)
683
781
  * @return [Fixnum] The timeout for the operations in microseconds. The
684
782
  * client will raise {Couchbase::Error::Timeout} exception for all
685
783
  * commands which weren't completed in given timeslot. */
686
- /* rb_define_attr(cBucket, "timeout", 1, 1); */
687
- rb_define_method(cBucket, "timeout", cb_bucket_timeout_get, 0);
688
- rb_define_method(cBucket, "timeout=", cb_bucket_timeout_set, 1);
784
+ /* rb_define_attr(cb_cBucket, "timeout", 1, 1); */
785
+ rb_define_method(cb_cBucket, "timeout", cb_bucket_timeout_get, 0);
786
+ rb_define_method(cb_cBucket, "timeout=", cb_bucket_timeout_set, 1);
787
+
788
+ /* Document-method: default_arithmetic_init
789
+ *
790
+ * @since 1.2.0
791
+ *
792
+ * @return [Fixnum, true] The initial value for arithmetic operations
793
+ * {Bucket#incr} and {Bucket#decr}. Setting this attribute will force
794
+ * aforementioned operations create keys unless they exists in the
795
+ * bucket and will use given value. You can also just specify +true+
796
+ * if you'd like just force key creation with zero default value.
797
+ */
798
+ /* rb_define_attr(cb_cBucket, "default_arithmetic_init", 1, 1); */
799
+ rb_define_method(cb_cBucket, "default_arithmetic_init", cb_bucket_default_arithmetic_init_get, 0);
800
+ rb_define_method(cb_cBucket, "default_arithmetic_init=", cb_bucket_default_arithmetic_init_set, 1);
689
801
 
690
802
  /* Document-method: key_prefix
691
803
  *
@@ -693,9 +805,9 @@ Init_couchbase_ext(void)
693
805
  *
694
806
  * @return [String] The library will prepend +key_prefix+ to each key to
695
807
  * provide simple namespacing. */
696
- /* rb_define_attr(cBucket, "key_prefix", 1, 1); */
697
- rb_define_method(cBucket, "key_prefix", cb_bucket_key_prefix_get, 0);
698
- rb_define_method(cBucket, "key_prefix=", cb_bucket_key_prefix_set, 1);
808
+ /* rb_define_attr(cb_cBucket, "key_prefix", 1, 1); */
809
+ rb_define_method(cb_cBucket, "key_prefix", cb_bucket_key_prefix_get, 0);
810
+ rb_define_method(cb_cBucket, "key_prefix=", cb_bucket_key_prefix_set, 1);
699
811
 
700
812
  /* Document-method: on_error
701
813
  * Error callback for asynchronous mode.
@@ -721,9 +833,9 @@ Init_couchbase_ext(void)
721
833
  * ...
722
834
  *
723
835
  * @return [Proc] the effective callback */
724
- /* rb_define_attr(cBucket, "on_error", 1, 1); */
725
- rb_define_method(cBucket, "on_error", cb_bucket_on_error_get, 0);
726
- rb_define_method(cBucket, "on_error=", cb_bucket_on_error_set, 1);
836
+ /* rb_define_attr(cb_cBucket, "on_error", 1, 1); */
837
+ rb_define_method(cb_cBucket, "on_error", cb_bucket_on_error_get, 0);
838
+ rb_define_method(cb_cBucket, "on_error=", cb_bucket_on_error_set, 1);
727
839
 
728
840
  /* Document-method: url
729
841
  *
@@ -737,8 +849,8 @@ Init_couchbase_ext(void)
737
849
  *
738
850
  * @return [String] the address of the cluster management interface
739
851
  */
740
- /* rb_define_attr(cBucket, "url", 1, 0); */
741
- rb_define_method(cBucket, "url", cb_bucket_url_get, 0);
852
+ /* rb_define_attr(cb_cBucket, "url", 1, 0); */
853
+ rb_define_method(cb_cBucket, "url", cb_bucket_url_get, 0);
742
854
  /* Document-method: hostname
743
855
  *
744
856
  * The hostname of the current node
@@ -749,8 +861,8 @@ Init_couchbase_ext(void)
749
861
  *
750
862
  * @return [String] the host name of the management interface (default: "localhost")
751
863
  */
752
- /* rb_define_attr(cBucket, "hostname", 1, 0); */
753
- rb_define_method(cBucket, "hostname", cb_bucket_hostname_get, 0);
864
+ /* rb_define_attr(cb_cBucket, "hostname", 1, 0); */
865
+ rb_define_method(cb_cBucket, "hostname", cb_bucket_hostname_get, 0);
754
866
  /* Document-method: port
755
867
  *
756
868
  * The port of the current node
@@ -761,8 +873,8 @@ Init_couchbase_ext(void)
761
873
  *
762
874
  * @return [Fixnum] the port number of the management interface (default: 8091)
763
875
  */
764
- /* rb_define_attr(cBucket, "port", 1, 0); */
765
- rb_define_method(cBucket, "port", cb_bucket_port_get, 0);
876
+ /* rb_define_attr(cb_cBucket, "port", 1, 0); */
877
+ rb_define_method(cb_cBucket, "port", cb_bucket_port_get, 0);
766
878
  /* Document-method: authority
767
879
  *
768
880
  * The authority ("hostname:port") of the current node
@@ -773,8 +885,8 @@ Init_couchbase_ext(void)
773
885
  *
774
886
  * @return [String] host with port
775
887
  */
776
- /* rb_define_attr(cBucket, "authority", 1, 0); */
777
- rb_define_method(cBucket, "authority", cb_bucket_authority_get, 0);
888
+ /* rb_define_attr(cb_cBucket, "authority", 1, 0); */
889
+ rb_define_method(cb_cBucket, "authority", cb_bucket_authority_get, 0);
778
890
  /* Document-method: bucket
779
891
  *
780
892
  * The bucket name of the current connection
@@ -785,9 +897,9 @@ Init_couchbase_ext(void)
785
897
  *
786
898
  * @return [String] the bucket name
787
899
  */
788
- /* rb_define_attr(cBucket, "bucket", 1, 0); */
789
- rb_define_method(cBucket, "bucket", cb_bucket_bucket_get, 0);
790
- rb_define_alias(cBucket, "name", "bucket");
900
+ /* rb_define_attr(cb_cBucket, "bucket", 1, 0); */
901
+ rb_define_method(cb_cBucket, "bucket", cb_bucket_bucket_get, 0);
902
+ rb_define_alias(cb_cBucket, "name", "bucket");
791
903
  /* Document-method: pool
792
904
  *
793
905
  * The pool name of the current connection
@@ -798,8 +910,8 @@ Init_couchbase_ext(void)
798
910
  *
799
911
  * @return [String] the pool name (usually "default")
800
912
  */
801
- /* rb_define_attr(cBucket, "pool", 1, 0); */
802
- rb_define_method(cBucket, "pool", cb_bucket_pool_get, 0);
913
+ /* rb_define_attr(cb_cBucket, "pool", 1, 0); */
914
+ rb_define_method(cb_cBucket, "pool", cb_bucket_pool_get, 0);
803
915
  /* Document-method: username
804
916
  *
805
917
  * The user name used to connect to the cluster
@@ -811,8 +923,8 @@ Init_couchbase_ext(void)
811
923
  * @return [String] the username for protected buckets (usually matches
812
924
  * the bucket name)
813
925
  */
814
- /* rb_define_attr(cBucket, "username", 1, 0); */
815
- rb_define_method(cBucket, "username", cb_bucket_username_get, 0);
926
+ /* rb_define_attr(cb_cBucket, "username", 1, 0); */
927
+ rb_define_method(cb_cBucket, "username", cb_bucket_username_get, 0);
816
928
  /* Document-method: password
817
929
  *
818
930
  * The password used to connect to the cluster
@@ -821,8 +933,8 @@ Init_couchbase_ext(void)
821
933
  *
822
934
  * @return [String] the password for protected buckets
823
935
  */
824
- /* rb_define_attr(cBucket, "password", 1, 0); */
825
- rb_define_method(cBucket, "password", cb_bucket_password_get, 0);
936
+ /* rb_define_attr(cb_cBucket, "password", 1, 0); */
937
+ rb_define_method(cb_cBucket, "password", cb_bucket_password_get, 0);
826
938
  /* Document-method: environment
827
939
  *
828
940
  * The environment of the connection (+:development+ or +:production+)
@@ -831,8 +943,8 @@ Init_couchbase_ext(void)
831
943
  *
832
944
  * @return [Symbol]
833
945
  */
834
- /* rb_define_attr(cBucket, "environment", 1, 0); */
835
- rb_define_method(cBucket, "environment", cb_bucket_environment_get, 0);
946
+ /* rb_define_attr(cb_cBucket, "environment", 1, 0); */
947
+ rb_define_method(cb_cBucket, "environment", cb_bucket_environment_get, 0);
836
948
  /* Document-method: num_replicas
837
949
  *
838
950
  * @since 1.2.0.dp6
@@ -841,8 +953,8 @@ Init_couchbase_ext(void)
841
953
  *
842
954
  * @return [Fixnum]
843
955
  */
844
- /* rb_define_attr(cBucket, "num_replicas", 1, 0); */
845
- rb_define_method(cBucket, "num_replicas", cb_bucket_num_replicas_get, 0);
956
+ /* rb_define_attr(cb_cBucket, "num_replicas", 1, 0); */
957
+ rb_define_method(cb_cBucket, "num_replicas", cb_bucket_num_replicas_get, 0);
846
958
  /* Document-method: default_observe_timeout
847
959
  *
848
960
  * @since 1.2.0.dp6
@@ -852,114 +964,125 @@ Init_couchbase_ext(void)
852
964
  *
853
965
  * @return [Fixnum]
854
966
  */
855
- /* rb_define_attr(cBucket, "default_observe_timeout", 1, 1); */
856
- rb_define_method(cBucket, "default_observe_timeout", cb_bucket_default_observe_timeout_get, 0);
857
- rb_define_method(cBucket, "default_observe_timeout=", cb_bucket_default_observe_timeout_set, 1);
858
-
859
- cCouchRequest = rb_define_class_under(cBucket, "CouchRequest", rb_cObject);
860
- rb_define_alloc_func(cCouchRequest, cb_http_request_alloc);
861
-
862
- rb_define_method(cCouchRequest, "initialize", cb_http_request_init, -1);
863
- rb_define_method(cCouchRequest, "inspect", cb_http_request_inspect, 0);
864
- rb_define_method(cCouchRequest, "on_body", cb_http_request_on_body, 0);
865
- rb_define_method(cCouchRequest, "perform", cb_http_request_perform, 0);
866
- rb_define_method(cCouchRequest, "pause", cb_http_request_pause, 0);
867
- rb_define_method(cCouchRequest, "continue", cb_http_request_continue, 0);
868
-
869
- /* rb_define_attr(cCouchRequest, "path", 1, 0); */
870
- rb_define_method(cCouchRequest, "path", cb_http_request_path_get, 0);
871
- /* rb_define_attr(cCouchRequest, "extended", 1, 0); */
872
- rb_define_method(cCouchRequest, "extended", cb_http_request_extended_get, 0);
873
- rb_define_alias(cCouchRequest, "extended?", "extended");
874
- /* rb_define_attr(cCouchRequest, "chunked", 1, 0); */
875
- rb_define_method(cCouchRequest, "chunked", cb_http_request_chunked_get, 0);
876
- rb_define_alias(cCouchRequest, "chunked?", "chunked");
877
-
878
- cTimer = rb_define_class_under(mCouchbase, "Timer", rb_cObject);
879
- rb_define_alloc_func(cTimer, cb_timer_alloc);
880
- rb_define_method(cTimer, "initialize", cb_timer_init, -1);
881
- rb_define_method(cTimer, "inspect", cb_timer_inspect, 0);
882
- rb_define_method(cTimer, "cancel", cb_timer_cancel, 0);
883
-
884
- /* Define symbols */
885
- id_arity = rb_intern("arity");
886
- id_call = rb_intern("call");
887
- id_delete = rb_intern("delete");
888
- id_dump = rb_intern("dump");
889
- id_dup = rb_intern("dup");
890
- id_flatten_bang = rb_intern("flatten!");
891
- id_has_key_p = rb_intern("has_key?");
892
- id_host = rb_intern("host");
893
- id_load = rb_intern("load");
894
- id_match = rb_intern("match");
895
- id_observe_and_wait = rb_intern("observe_and_wait");
896
- id_parse = rb_intern("parse");
897
- id_password = rb_intern("password");
898
- id_path = rb_intern("path");
899
- id_port = rb_intern("port");
900
- id_scheme = rb_intern("scheme");
901
- id_to_s = rb_intern("to_s");
902
- id_user = rb_intern("user");
903
- id_verify_observe_options = rb_intern("verify_observe_options");
904
-
905
- sym_add = ID2SYM(rb_intern("add"));
906
- sym_append = ID2SYM(rb_intern("append"));
907
- sym_assemble_hash = ID2SYM(rb_intern("assemble_hash"));
908
- sym_body = ID2SYM(rb_intern("body"));
909
- sym_bucket = ID2SYM(rb_intern("bucket"));
910
- sym_cas = ID2SYM(rb_intern("cas"));
911
- sym_chunked = ID2SYM(rb_intern("chunked"));
912
- sym_content_type = ID2SYM(rb_intern("content_type"));
913
- sym_create = ID2SYM(rb_intern("create"));
914
- sym_decrement = ID2SYM(rb_intern("decrement"));
915
- sym_default_flags = ID2SYM(rb_intern("default_flags"));
916
- sym_default_format = ID2SYM(rb_intern("default_format"));
917
- sym_default_ttl = ID2SYM(rb_intern("default_ttl"));
918
- sym_delete = ID2SYM(rb_intern("delete"));
919
- sym_delta = ID2SYM(rb_intern("delta"));
920
- sym_development = ID2SYM(rb_intern("development"));
921
- sym_document = ID2SYM(rb_intern("document"));
922
- sym_environment = ID2SYM(rb_intern("environment"));
923
- sym_extended = ID2SYM(rb_intern("extended"));
924
- sym_flags = ID2SYM(rb_intern("flags"));
925
- sym_format = ID2SYM(rb_intern("format"));
926
- sym_found = ID2SYM(rb_intern("found"));
927
- sym_get = ID2SYM(rb_intern("get"));
928
- sym_hostname = ID2SYM(rb_intern("hostname"));
929
- sym_http_request = ID2SYM(rb_intern("http_request"));
930
- sym_increment = ID2SYM(rb_intern("increment"));
931
- sym_initial = ID2SYM(rb_intern("initial"));
932
- sym_key_prefix = ID2SYM(rb_intern("key_prefix"));
933
- sym_lock = ID2SYM(rb_intern("lock"));
934
- sym_management = ID2SYM(rb_intern("management"));
935
- sym_marshal = ID2SYM(rb_intern("marshal"));
936
- sym_method = ID2SYM(rb_intern("method"));
937
- sym_node_list = ID2SYM(rb_intern("node_list"));
938
- sym_not_found = ID2SYM(rb_intern("not_found"));
939
- sym_num_replicas = ID2SYM(rb_intern("num_replicas"));
940
- sym_observe = ID2SYM(rb_intern("observe"));
941
- sym_password = ID2SYM(rb_intern("password"));
942
- sym_periodic = ID2SYM(rb_intern("periodic"));
943
- sym_persisted = ID2SYM(rb_intern("persisted"));
944
- sym_plain = ID2SYM(rb_intern("plain"));
945
- sym_pool = ID2SYM(rb_intern("pool"));
946
- sym_port = ID2SYM(rb_intern("port"));
947
- sym_post = ID2SYM(rb_intern("post"));
948
- sym_prepend = ID2SYM(rb_intern("prepend"));
949
- sym_production = ID2SYM(rb_intern("production"));
950
- sym_put = ID2SYM(rb_intern("put"));
951
- sym_quiet = ID2SYM(rb_intern("quiet"));
952
- sym_replace = ID2SYM(rb_intern("replace"));
953
- sym_replica = ID2SYM(rb_intern("replica"));
954
- sym_send_threshold = ID2SYM(rb_intern("send_threshold"));
955
- sym_set = ID2SYM(rb_intern("set"));
956
- sym_stats = ID2SYM(rb_intern("stats"));
957
- sym_timeout = ID2SYM(rb_intern("timeout"));
958
- sym_touch = ID2SYM(rb_intern("touch"));
959
- sym_ttl = ID2SYM(rb_intern("ttl"));
960
- sym_type = ID2SYM(rb_intern("type"));
961
- sym_unlock = ID2SYM(rb_intern("unlock"));
962
- sym_username = ID2SYM(rb_intern("username"));
963
- sym_version = ID2SYM(rb_intern("version"));
964
- sym_view = ID2SYM(rb_intern("view"));
967
+ /* rb_define_attr(cb_cBucket, "default_observe_timeout", 1, 1); */
968
+ rb_define_method(cb_cBucket, "default_observe_timeout", cb_bucket_default_observe_timeout_get, 0);
969
+ rb_define_method(cb_cBucket, "default_observe_timeout=", cb_bucket_default_observe_timeout_set, 1);
970
+
971
+ cb_cCouchRequest = rb_define_class_under(cb_cBucket, "CouchRequest", rb_cObject);
972
+ rb_define_alloc_func(cb_cCouchRequest, cb_http_request_alloc);
973
+
974
+ rb_define_method(cb_cCouchRequest, "initialize", cb_http_request_init, -1);
975
+ rb_define_method(cb_cCouchRequest, "inspect", cb_http_request_inspect, 0);
976
+ rb_define_method(cb_cCouchRequest, "on_body", cb_http_request_on_body, 0);
977
+ rb_define_method(cb_cCouchRequest, "perform", cb_http_request_perform, 0);
978
+ rb_define_method(cb_cCouchRequest, "pause", cb_http_request_pause, 0);
979
+ rb_define_method(cb_cCouchRequest, "continue", cb_http_request_continue, 0);
980
+
981
+ /* rb_define_attr(cb_cCouchRequest, "path", 1, 0); */
982
+ rb_define_method(cb_cCouchRequest, "path", cb_http_request_path_get, 0);
983
+ /* rb_define_attr(cb_cCouchRequest, "extended", 1, 0); */
984
+ rb_define_method(cb_cCouchRequest, "extended", cb_http_request_extended_get, 0);
985
+ rb_define_alias(cb_cCouchRequest, "extended?", "extended");
986
+ /* rb_define_attr(cb_cCouchRequest, "chunked", 1, 0); */
987
+ rb_define_method(cb_cCouchRequest, "chunked", cb_http_request_chunked_get, 0);
988
+ rb_define_alias(cb_cCouchRequest, "chunked?", "chunked");
989
+
990
+ cb_cTimer = rb_define_class_under(cb_mCouchbase, "Timer", rb_cObject);
991
+ rb_define_alloc_func(cb_cTimer, cb_timer_alloc);
992
+ rb_define_method(cb_cTimer, "initialize", cb_timer_init, -1);
993
+ rb_define_method(cb_cTimer, "inspect", cb_timer_inspect, 0);
994
+ rb_define_method(cb_cTimer, "cancel", cb_timer_cancel, 0);
995
+
996
+ /* Define cb_symbols */
997
+ cb_id_arity = rb_intern("arity");
998
+ cb_id_call = rb_intern("call");
999
+ cb_id_delete = rb_intern("delete");
1000
+ cb_id_dump = rb_intern("dump");
1001
+ cb_id_dup = rb_intern("dup");
1002
+ cb_id_flatten_bang = rb_intern("flatten!");
1003
+ cb_id_has_key_p = rb_intern("has_key?");
1004
+ cb_id_host = rb_intern("host");
1005
+ cb_id_load = rb_intern("load");
1006
+ cb_id_match = rb_intern("match");
1007
+ cb_id_observe_and_wait = rb_intern("observe_and_wait");
1008
+ cb_id_parse = rb_intern("parse");
1009
+ cb_id_parse_body_bang = rb_intern("parse_body!");
1010
+ cb_id_password = rb_intern("password");
1011
+ cb_id_path = rb_intern("path");
1012
+ cb_id_port = rb_intern("port");
1013
+ cb_id_scheme = rb_intern("scheme");
1014
+ cb_id_sprintf = rb_intern("sprintf");
1015
+ cb_id_to_s = rb_intern("to_s");
1016
+ cb_id_user = rb_intern("user");
1017
+ cb_id_verify_observe_options = rb_intern("verify_observe_options");
1018
+
1019
+ cb_sym_add = ID2SYM(rb_intern("add"));
1020
+ cb_sym_append = ID2SYM(rb_intern("append"));
1021
+ cb_sym_assemble_hash = ID2SYM(rb_intern("assemble_hash"));
1022
+ cb_sym_body = ID2SYM(rb_intern("body"));
1023
+ cb_sym_bucket = ID2SYM(rb_intern("bucket"));
1024
+ cb_sym_cas = ID2SYM(rb_intern("cas"));
1025
+ cb_sym_chunked = ID2SYM(rb_intern("chunked"));
1026
+ cb_sym_cluster = ID2SYM(rb_intern("cluster"));
1027
+ cb_sym_content_type = ID2SYM(rb_intern("content_type"));
1028
+ cb_sym_create = ID2SYM(rb_intern("create"));
1029
+ cb_sym_decrement = ID2SYM(rb_intern("decrement"));
1030
+ cb_sym_default_arithmetic_init = ID2SYM(rb_intern("default_arithmetic_init"));
1031
+ cb_sym_default_flags = ID2SYM(rb_intern("default_flags"));
1032
+ cb_sym_default_format = ID2SYM(rb_intern("default_format"));
1033
+ cb_sym_default_ttl = ID2SYM(rb_intern("default_ttl"));
1034
+ cb_sym_delete = ID2SYM(rb_intern("delete"));
1035
+ cb_sym_delta = ID2SYM(rb_intern("delta"));
1036
+ cb_sym_development = ID2SYM(rb_intern("development"));
1037
+ cb_sym_document = ID2SYM(rb_intern("document"));
1038
+ cb_sym_environment = ID2SYM(rb_intern("environment"));
1039
+ cb_sym_extended = ID2SYM(rb_intern("extended"));
1040
+ cb_sym_flags = ID2SYM(rb_intern("flags"));
1041
+ cb_sym_format = ID2SYM(rb_intern("format"));
1042
+ cb_sym_found = ID2SYM(rb_intern("found"));
1043
+ cb_sym_get = ID2SYM(rb_intern("get"));
1044
+ cb_sym_hostname = ID2SYM(rb_intern("hostname"));
1045
+ cb_sym_http_request = ID2SYM(rb_intern("http_request"));
1046
+ cb_sym_increment = ID2SYM(rb_intern("increment"));
1047
+ cb_sym_initial = ID2SYM(rb_intern("initial"));
1048
+ cb_sym_key_prefix = ID2SYM(rb_intern("key_prefix"));
1049
+ cb_sym_lock = ID2SYM(rb_intern("lock"));
1050
+ cb_sym_management = ID2SYM(rb_intern("management"));
1051
+ cb_sym_marshal = ID2SYM(rb_intern("marshal"));
1052
+ cb_sym_method = ID2SYM(rb_intern("method"));
1053
+ cb_sym_node_list = ID2SYM(rb_intern("node_list"));
1054
+ cb_sym_not_found = ID2SYM(rb_intern("not_found"));
1055
+ cb_sym_num_replicas = ID2SYM(rb_intern("num_replicas"));
1056
+ cb_sym_observe = ID2SYM(rb_intern("observe"));
1057
+ cb_sym_password = ID2SYM(rb_intern("password"));
1058
+ cb_sym_periodic = ID2SYM(rb_intern("periodic"));
1059
+ cb_sym_persisted = ID2SYM(rb_intern("persisted"));
1060
+ cb_sym_plain = ID2SYM(rb_intern("plain"));
1061
+ cb_sym_pool = ID2SYM(rb_intern("pool"));
1062
+ cb_sym_port = ID2SYM(rb_intern("port"));
1063
+ cb_sym_post = ID2SYM(rb_intern("post"));
1064
+ cb_sym_prepend = ID2SYM(rb_intern("prepend"));
1065
+ cb_sym_production = ID2SYM(rb_intern("production"));
1066
+ cb_sym_put = ID2SYM(rb_intern("put"));
1067
+ cb_sym_quiet = ID2SYM(rb_intern("quiet"));
1068
+ cb_sym_replace = ID2SYM(rb_intern("replace"));
1069
+ cb_sym_replica = ID2SYM(rb_intern("replica"));
1070
+ cb_sym_send_threshold = ID2SYM(rb_intern("send_threshold"));
1071
+ cb_sym_set = ID2SYM(rb_intern("set"));
1072
+ cb_sym_stats = ID2SYM(rb_intern("stats"));
1073
+ cb_sym_timeout = ID2SYM(rb_intern("timeout"));
1074
+ cb_sym_touch = ID2SYM(rb_intern("touch"));
1075
+ cb_sym_ttl = ID2SYM(rb_intern("ttl"));
1076
+ cb_sym_type = ID2SYM(rb_intern("type"));
1077
+ cb_sym_unlock = ID2SYM(rb_intern("unlock"));
1078
+ cb_sym_username = ID2SYM(rb_intern("username"));
1079
+ cb_sym_version = ID2SYM(rb_intern("version"));
1080
+ cb_sym_view = ID2SYM(rb_intern("view"));
1081
+
1082
+ cb_vStrDefault = STR_NEW_CSTR("default");
1083
+ rb_str_freeze(cb_vStrDefault);
1084
+ rb_const_set(cb_mCouchbase, rb_intern("_STR_DEFAULT"), cb_vStrDefault);
1085
+ cb_vStrEmpty = STR_NEW_CSTR("");
1086
+ rb_str_freeze(cb_vStrEmpty);
1087
+ rb_const_set(cb_mCouchbase, rb_intern("_STR_EMPTY"), cb_vStrEmpty);
965
1088
  }