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