couchbase 1.1.5-x86-mingw32 → 1.2.0.beta-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/.gitignore +2 -1
- data/.travis.yml +12 -1
- data/HISTORY.markdown +112 -1
- data/README.markdown +149 -6
- data/couchbase.gemspec +5 -1
- data/ext/couchbase_ext/.gitignore +4 -0
- data/ext/couchbase_ext/arguments.c +973 -0
- data/ext/couchbase_ext/arithmetic.c +322 -0
- data/ext/couchbase_ext/bucket.c +1092 -0
- data/ext/couchbase_ext/couchbase_ext.c +618 -3247
- data/ext/couchbase_ext/couchbase_ext.h +519 -0
- data/ext/couchbase_ext/delete.c +167 -0
- data/ext/couchbase_ext/extconf.rb +24 -5
- data/ext/couchbase_ext/get.c +301 -0
- data/ext/couchbase_ext/gethrtime.c +124 -0
- data/ext/couchbase_ext/http.c +402 -0
- data/ext/couchbase_ext/observe.c +174 -0
- data/ext/couchbase_ext/result.c +126 -0
- data/ext/couchbase_ext/stats.c +169 -0
- data/ext/couchbase_ext/store.c +522 -0
- data/ext/couchbase_ext/timer.c +192 -0
- data/ext/couchbase_ext/touch.c +190 -0
- data/ext/couchbase_ext/unlock.c +180 -0
- data/ext/couchbase_ext/utils.c +471 -0
- data/ext/couchbase_ext/version.c +147 -0
- data/lib/action_dispatch/middleware/session/couchbase_store.rb +38 -0
- data/lib/active_support/cache/couchbase_store.rb +356 -0
- data/lib/couchbase.rb +24 -3
- data/lib/couchbase/bucket.rb +372 -9
- data/lib/couchbase/result.rb +26 -0
- data/lib/couchbase/utils.rb +59 -0
- data/lib/couchbase/version.rb +1 -1
- data/lib/couchbase/view.rb +305 -0
- data/lib/couchbase/view_row.rb +230 -0
- data/lib/ext/multi_json_fix.rb +47 -0
- data/lib/rack/session/couchbase.rb +104 -0
- data/tasks/compile.rake +5 -14
- data/test/setup.rb +6 -2
- data/test/test_arithmetic.rb +32 -2
- data/test/test_async.rb +18 -4
- data/test/test_bucket.rb +11 -1
- data/test/test_cas.rb +13 -3
- data/test/test_couchbase_rails_cache_store.rb +294 -0
- data/test/test_delete.rb +60 -3
- data/test/test_format.rb +28 -17
- data/test/test_get.rb +91 -14
- data/test/test_store.rb +31 -1
- data/test/{test_flush.rb → test_timer.rb} +11 -18
- data/test/test_touch.rb +33 -5
- data/test/test_unlock.rb +120 -0
- data/test/test_utils.rb +26 -0
- metadata +102 -12
@@ -0,0 +1,519 @@
|
|
1
|
+
/* vim: ft=c et ts=8 sts=4 sw=4 cino=
|
2
|
+
*
|
3
|
+
* Copyright 2011, 2012 Couchbase, Inc.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*/
|
17
|
+
#ifndef COUCHBASE_EXT_H
|
18
|
+
#define COUCHBASE_EXT_H
|
19
|
+
|
20
|
+
#include <ruby.h>
|
21
|
+
#ifndef RUBY_ST_H
|
22
|
+
#include <st.h>
|
23
|
+
#endif
|
24
|
+
|
25
|
+
#include "couchbase_config.h"
|
26
|
+
#ifndef HAVE_GETHRTIME
|
27
|
+
typedef uint64_t hrtime_t;
|
28
|
+
extern hrtime_t gethrtime(void);
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#include <stdint.h>
|
32
|
+
#include <libcouchbase/couchbase.h>
|
33
|
+
|
34
|
+
#ifdef HAVE_RUBY_ENCODING_H
|
35
|
+
#include "ruby/encoding.h"
|
36
|
+
#define STR_NEW(ptr, len) rb_external_str_new((ptr), (len))
|
37
|
+
#define STR_NEW_CSTR(str) rb_external_str_new_cstr((str))
|
38
|
+
#else
|
39
|
+
#define STR_NEW(ptr, len) rb_str_new((ptr), (len))
|
40
|
+
#define STR_NEW_CSTR(str) rb_str_new2((str))
|
41
|
+
#endif
|
42
|
+
|
43
|
+
#ifdef HAVE_STDARG_PROTOTYPES
|
44
|
+
#include <stdarg.h>
|
45
|
+
#define va_init_list(a,b) va_start(a,b)
|
46
|
+
#else
|
47
|
+
#include <varargs.h>
|
48
|
+
#define va_init_list(a,b) va_start(a)
|
49
|
+
#endif
|
50
|
+
|
51
|
+
#define debug_object(OBJ) \
|
52
|
+
rb_funcall(rb_stderr, rb_intern("print"), 1, rb_funcall(OBJ, rb_intern("object_id"), 0)); \
|
53
|
+
rb_funcall(rb_stderr, rb_intern("print"), 1, STR_NEW_CSTR(" ")); \
|
54
|
+
rb_funcall(rb_stderr, rb_intern("print"), 1, rb_funcall(OBJ, rb_intern("class"), 0)); \
|
55
|
+
rb_funcall(rb_stderr, rb_intern("print"), 1, STR_NEW_CSTR(" ")); \
|
56
|
+
rb_funcall(rb_stderr, rb_intern("puts"), 1, rb_funcall(OBJ, rb_intern("inspect"), 0));
|
57
|
+
|
58
|
+
#define FMT_MASK 0x3
|
59
|
+
#define FMT_DOCUMENT 0x0
|
60
|
+
#define FMT_MARSHAL 0x1
|
61
|
+
#define FMT_PLAIN 0x2
|
62
|
+
|
63
|
+
#define PACKET_HEADER_SIZE 24
|
64
|
+
/* Structs */
|
65
|
+
struct bucket_st
|
66
|
+
{
|
67
|
+
lcb_t handle;
|
68
|
+
struct lcb_io_opt_st *io;
|
69
|
+
uint16_t port;
|
70
|
+
char *authority;
|
71
|
+
char *hostname;
|
72
|
+
char *pool;
|
73
|
+
char *bucket;
|
74
|
+
char *username;
|
75
|
+
char *password;
|
76
|
+
int async;
|
77
|
+
int quiet;
|
78
|
+
VALUE default_format; /* should update +default_flags+ on change */
|
79
|
+
uint32_t default_flags;
|
80
|
+
time_t default_ttl;
|
81
|
+
time_t default_observe_timeout;
|
82
|
+
uint32_t timeout;
|
83
|
+
size_t threshold; /* the number of bytes to trigger event loop, zero if don't care */
|
84
|
+
size_t nbytes; /* the number of bytes scheduled to be sent */
|
85
|
+
VALUE exception; /* error delivered by error_callback */
|
86
|
+
VALUE on_error_proc; /* is using to deliver errors in async mode */
|
87
|
+
VALUE environment; /* sym_development or sym_production */
|
88
|
+
char *key_prefix;
|
89
|
+
VALUE key_prefix_val;
|
90
|
+
char *node_list;
|
91
|
+
VALUE object_space;
|
92
|
+
VALUE self; /* the pointer to bucket representation in ruby land */
|
93
|
+
};
|
94
|
+
|
95
|
+
struct http_request_st;
|
96
|
+
struct context_st
|
97
|
+
{
|
98
|
+
struct bucket_st* bucket;
|
99
|
+
int extended;
|
100
|
+
VALUE proc;
|
101
|
+
void *rv;
|
102
|
+
VALUE exception;
|
103
|
+
VALUE observe_options;
|
104
|
+
VALUE force_format;
|
105
|
+
VALUE operation;
|
106
|
+
VALUE headers_val;
|
107
|
+
int headers_built;
|
108
|
+
struct http_request_st *request;
|
109
|
+
int quiet;
|
110
|
+
int arith; /* incr: +1, decr: -1, other: 0 */
|
111
|
+
size_t nqueries;
|
112
|
+
};
|
113
|
+
|
114
|
+
struct http_request_st {
|
115
|
+
struct bucket_st *bucket;
|
116
|
+
VALUE bucket_obj;
|
117
|
+
VALUE type;
|
118
|
+
int extended;
|
119
|
+
int running;
|
120
|
+
int completed;
|
121
|
+
lcb_http_request_t request;
|
122
|
+
lcb_http_cmd_t cmd;
|
123
|
+
struct context_st *ctx;
|
124
|
+
VALUE on_body_callback;
|
125
|
+
};
|
126
|
+
|
127
|
+
struct timer_st
|
128
|
+
{
|
129
|
+
struct bucket_st *bucket;
|
130
|
+
int periodic;
|
131
|
+
uint32_t usec;
|
132
|
+
lcb_timer_t timer;
|
133
|
+
VALUE self;
|
134
|
+
VALUE callback;
|
135
|
+
};
|
136
|
+
|
137
|
+
/* Classes */
|
138
|
+
extern VALUE cBucket;
|
139
|
+
extern VALUE cCouchRequest;
|
140
|
+
extern VALUE cResult;
|
141
|
+
extern VALUE cTimer;
|
142
|
+
|
143
|
+
/* Modules */
|
144
|
+
extern VALUE mCouchbase;
|
145
|
+
extern VALUE mError;
|
146
|
+
extern VALUE mMarshal;
|
147
|
+
extern VALUE mMultiJson;
|
148
|
+
extern VALUE mURI;
|
149
|
+
|
150
|
+
/* Symbols */
|
151
|
+
extern ID sym_add;
|
152
|
+
extern ID sym_append;
|
153
|
+
extern ID sym_assemble_hash;
|
154
|
+
extern ID sym_body;
|
155
|
+
extern ID sym_bucket;
|
156
|
+
extern ID sym_cas;
|
157
|
+
extern ID sym_chunked;
|
158
|
+
extern ID sym_content_type;
|
159
|
+
extern ID sym_create;
|
160
|
+
extern ID sym_decrement;
|
161
|
+
extern ID sym_default_flags;
|
162
|
+
extern ID sym_default_format;
|
163
|
+
extern ID sym_default_observe_timeout;
|
164
|
+
extern ID sym_default_ttl;
|
165
|
+
extern ID sym_delete;
|
166
|
+
extern ID sym_delta;
|
167
|
+
extern ID sym_development;
|
168
|
+
extern ID sym_document;
|
169
|
+
extern ID sym_environment;
|
170
|
+
extern ID sym_extended;
|
171
|
+
extern ID sym_flags;
|
172
|
+
extern ID sym_format;
|
173
|
+
extern ID sym_found;
|
174
|
+
extern ID sym_get;
|
175
|
+
extern ID sym_hostname;
|
176
|
+
extern ID sym_http_request;
|
177
|
+
extern ID sym_increment;
|
178
|
+
extern ID sym_initial;
|
179
|
+
extern ID sym_key_prefix;
|
180
|
+
extern ID sym_lock;
|
181
|
+
extern ID sym_management;
|
182
|
+
extern ID sym_marshal;
|
183
|
+
extern ID sym_method;
|
184
|
+
extern ID sym_node_list;
|
185
|
+
extern ID sym_not_found;
|
186
|
+
extern ID sym_num_replicas;
|
187
|
+
extern ID sym_observe;
|
188
|
+
extern ID sym_password;
|
189
|
+
extern ID sym_periodic;
|
190
|
+
extern ID sym_persisted;
|
191
|
+
extern ID sym_plain;
|
192
|
+
extern ID sym_pool;
|
193
|
+
extern ID sym_port;
|
194
|
+
extern ID sym_post;
|
195
|
+
extern ID sym_prepend;
|
196
|
+
extern ID sym_production;
|
197
|
+
extern ID sym_put;
|
198
|
+
extern ID sym_quiet;
|
199
|
+
extern ID sym_replace;
|
200
|
+
extern ID sym_replica;
|
201
|
+
extern ID sym_send_threshold;
|
202
|
+
extern ID sym_set;
|
203
|
+
extern ID sym_stats;
|
204
|
+
extern ID sym_timeout;
|
205
|
+
extern ID sym_touch;
|
206
|
+
extern ID sym_ttl;
|
207
|
+
extern ID sym_type;
|
208
|
+
extern ID sym_unlock;
|
209
|
+
extern ID sym_username;
|
210
|
+
extern ID sym_version;
|
211
|
+
extern ID sym_view;
|
212
|
+
extern ID id_arity;
|
213
|
+
extern ID id_call;
|
214
|
+
extern ID id_delete;
|
215
|
+
extern ID id_dump;
|
216
|
+
extern ID id_dup;
|
217
|
+
extern ID id_flatten_bang;
|
218
|
+
extern ID id_has_key_p;
|
219
|
+
extern ID id_host;
|
220
|
+
extern ID id_iv_cas;
|
221
|
+
extern ID id_iv_completed;
|
222
|
+
extern ID id_iv_error;
|
223
|
+
extern ID id_iv_flags;
|
224
|
+
extern ID id_iv_from_master;
|
225
|
+
extern ID id_iv_headers;
|
226
|
+
extern ID id_iv_key;
|
227
|
+
extern ID id_iv_node;
|
228
|
+
extern ID id_iv_operation;
|
229
|
+
extern ID id_iv_status;
|
230
|
+
extern ID id_iv_time_to_persist;
|
231
|
+
extern ID id_iv_time_to_replicate;
|
232
|
+
extern ID id_iv_value;
|
233
|
+
extern ID id_load;
|
234
|
+
extern ID id_match;
|
235
|
+
extern ID id_observe_and_wait;
|
236
|
+
extern ID id_parse;
|
237
|
+
extern ID id_password;
|
238
|
+
extern ID id_path;
|
239
|
+
extern ID id_port;
|
240
|
+
extern ID id_scheme;
|
241
|
+
extern ID id_to_s;
|
242
|
+
extern ID id_user;
|
243
|
+
extern ID id_verify_observe_options;
|
244
|
+
|
245
|
+
/* Errors */
|
246
|
+
extern VALUE eBaseError;
|
247
|
+
extern VALUE eValueFormatError;
|
248
|
+
/* LCB_SUCCESS = 0x00 */
|
249
|
+
/* LCB_AUTH_CONTINUE = 0x01 */
|
250
|
+
extern VALUE eAuthError; /* LCB_AUTH_ERROR = 0x02 */
|
251
|
+
extern VALUE eDeltaBadvalError; /* LCB_DELTA_BADVAL = 0x03 */
|
252
|
+
extern VALUE eTooBigError; /* LCB_E2BIG = 0x04 */
|
253
|
+
extern VALUE eBusyError; /* LCB_EBUSY = 0x05 */
|
254
|
+
extern VALUE eInternalError; /* LCB_EINTERNAL = 0x06 */
|
255
|
+
extern VALUE eInvalidError; /* LCB_EINVAL = 0x07 */
|
256
|
+
extern VALUE eNoMemoryError; /* LCB_ENOMEM = 0x08 */
|
257
|
+
extern VALUE eRangeError; /* LCB_ERANGE = 0x09 */
|
258
|
+
extern VALUE eLibcouchbaseError; /* LCB_ERROR = 0x0a */
|
259
|
+
extern VALUE eTmpFailError; /* LCB_ETMPFAIL = 0x0b */
|
260
|
+
extern VALUE eKeyExistsError; /* LCB_KEY_EEXISTS = 0x0c */
|
261
|
+
extern VALUE eNotFoundError; /* LCB_KEY_ENOENT = 0x0d */
|
262
|
+
extern VALUE eLibeventError; /* LCB_LIBEVENT_ERROR = 0x0e */
|
263
|
+
extern VALUE eNetworkError; /* LCB_NETWORK_ERROR = 0x0f */
|
264
|
+
extern VALUE eNotMyVbucketError; /* LCB_NOT_MY_VBUCKET = 0x10 */
|
265
|
+
extern VALUE eNotStoredError; /* LCB_NOT_STORED = 0x11 */
|
266
|
+
extern VALUE eNotSupportedError; /* LCB_NOT_SUPPORTED = 0x12 */
|
267
|
+
extern VALUE eUnknownCommandError; /* LCB_UNKNOWN_COMMAND = 0x13 */
|
268
|
+
extern VALUE eUnknownHostError; /* LCB_UNKNOWN_HOST = 0x14 */
|
269
|
+
extern VALUE eProtocolError; /* LCB_PROTOCOL_ERROR = 0x15 */
|
270
|
+
extern VALUE eTimeoutError; /* LCB_ETIMEDOUT = 0x16 */
|
271
|
+
extern VALUE eConnectError; /* LCB_CONNECT_ERROR = 0x17 */
|
272
|
+
extern VALUE eBucketNotFoundError; /* LCB_BUCKET_ENOENT = 0x18 */
|
273
|
+
extern VALUE eClientNoMemoryError; /* LCB_CLIENT_ENOMEM = 0x19 */
|
274
|
+
extern VALUE eClientTmpFailError; /* LCB_CLIENT_ETMPFAIL = 0x20 */
|
275
|
+
|
276
|
+
void strip_key_prefix(struct bucket_st *bucket, VALUE key);
|
277
|
+
VALUE cb_check_error(lcb_error_t rc, const char *msg, VALUE key);
|
278
|
+
VALUE cb_check_error_with_status(lcb_error_t rc, const char *msg, VALUE key, lcb_http_status_t status);
|
279
|
+
VALUE cb_gc_protect(struct bucket_st *bucket, VALUE val);
|
280
|
+
VALUE cb_gc_unprotect(struct bucket_st *bucket, VALUE val);
|
281
|
+
VALUE cb_proc_call(VALUE recv, int argc, ...);
|
282
|
+
int cb_first_value_i(VALUE key, VALUE value, VALUE arg);
|
283
|
+
void cb_build_headers(struct context_st *ctx, const char * const *headers);
|
284
|
+
void maybe_do_loop(struct bucket_st *bucket);
|
285
|
+
VALUE unify_key(struct bucket_st *bucket, VALUE key, int apply_prefix);
|
286
|
+
VALUE encode_value(VALUE val, uint32_t flags);
|
287
|
+
VALUE decode_value(VALUE blob, uint32_t flags, VALUE force_format);
|
288
|
+
uint32_t flags_set_format(uint32_t flags, ID format);
|
289
|
+
ID flags_get_format(uint32_t flags);
|
290
|
+
|
291
|
+
void storage_callback(lcb_t handle, const void *cookie, lcb_storage_t operation, lcb_error_t error, const lcb_store_resp_t *resp);
|
292
|
+
void get_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_get_resp_t *resp);
|
293
|
+
void touch_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_touch_resp_t *resp);
|
294
|
+
void delete_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_remove_resp_t *resp);
|
295
|
+
void stat_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_server_stat_resp_t *resp);
|
296
|
+
void arithmetic_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_arithmetic_resp_t *resp);
|
297
|
+
void version_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_server_version_resp_t *resp);
|
298
|
+
void http_complete_callback(lcb_http_request_t request, lcb_t handle, const void *cookie, lcb_error_t error, const lcb_http_resp_t *resp);
|
299
|
+
void http_data_callback(lcb_http_request_t request, lcb_t handle, const void *cookie, lcb_error_t error, const lcb_http_resp_t *resp);
|
300
|
+
void observe_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_observe_resp_t *resp);
|
301
|
+
void unlock_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_unlock_resp_t *resp);
|
302
|
+
|
303
|
+
|
304
|
+
VALUE cb_bucket_alloc(VALUE klass);
|
305
|
+
void cb_bucket_free(void *ptr);
|
306
|
+
VALUE cb_bucket_init_copy(VALUE copy, VALUE orig);
|
307
|
+
VALUE cb_bucket_init(int argc, VALUE *argv, VALUE self);
|
308
|
+
VALUE cb_bucket_inspect(VALUE self);
|
309
|
+
VALUE cb_bucket_touch(int argc, VALUE *argv, VALUE self);
|
310
|
+
VALUE cb_bucket_delete(int argc, VALUE *argv, VALUE self);
|
311
|
+
VALUE cb_bucket_stats(int argc, VALUE *argv, VALUE self);
|
312
|
+
VALUE cb_bucket_set(int argc, VALUE *argv, VALUE self);
|
313
|
+
VALUE cb_bucket_add(int argc, VALUE *argv, VALUE self);
|
314
|
+
VALUE cb_bucket_replace(int argc, VALUE *argv, VALUE self);
|
315
|
+
VALUE cb_bucket_append(int argc, VALUE *argv, VALUE self);
|
316
|
+
VALUE cb_bucket_prepend(int argc, VALUE *argv, VALUE self);
|
317
|
+
VALUE cb_bucket_aset(int argc, VALUE *argv, VALUE self);
|
318
|
+
VALUE cb_bucket_get(int argc, VALUE *argv, VALUE self);
|
319
|
+
VALUE cb_bucket_incr(int argc, VALUE *argv, VALUE self);
|
320
|
+
VALUE cb_bucket_decr(int argc, VALUE *argv, VALUE self);
|
321
|
+
VALUE cb_bucket_unlock(int argc, VALUE *argv, VALUE self);
|
322
|
+
VALUE cb_bucket_run(int argc, VALUE *argv, VALUE self);
|
323
|
+
VALUE cb_bucket_stop(VALUE self);
|
324
|
+
VALUE cb_bucket_version(int argc, VALUE *argv, VALUE self);
|
325
|
+
VALUE cb_bucket_disconnect(VALUE self);
|
326
|
+
VALUE cb_bucket_reconnect(int argc, VALUE *argv, VALUE self);
|
327
|
+
VALUE cb_bucket_make_http_request(int argc, VALUE *argv, VALUE self);
|
328
|
+
VALUE cb_bucket_observe(int argc, VALUE *argv, VALUE self);
|
329
|
+
VALUE cb_bucket_connected_p(VALUE self);
|
330
|
+
VALUE cb_bucket_async_p(VALUE self);
|
331
|
+
VALUE cb_bucket_quiet_get(VALUE self);
|
332
|
+
VALUE cb_bucket_quiet_set(VALUE self, VALUE val);
|
333
|
+
VALUE cb_bucket_default_flags_get(VALUE self);
|
334
|
+
VALUE cb_bucket_default_flags_set(VALUE self, VALUE val);
|
335
|
+
VALUE cb_bucket_default_format_get(VALUE self);
|
336
|
+
VALUE cb_bucket_default_format_set(VALUE self, VALUE val);
|
337
|
+
VALUE cb_bucket_on_error_set(VALUE self, VALUE val);
|
338
|
+
VALUE cb_bucket_on_error_get(VALUE self);
|
339
|
+
VALUE cb_bucket_timeout_get(VALUE self);
|
340
|
+
VALUE cb_bucket_timeout_set(VALUE self, VALUE val);
|
341
|
+
VALUE cb_bucket_key_prefix_get(VALUE self);
|
342
|
+
VALUE cb_bucket_key_prefix_set(VALUE self, VALUE val);
|
343
|
+
VALUE cb_bucket_url_get(VALUE self);
|
344
|
+
VALUE cb_bucket_hostname_get(VALUE self);
|
345
|
+
VALUE cb_bucket_port_get(VALUE self);
|
346
|
+
VALUE cb_bucket_authority_get(VALUE self);
|
347
|
+
VALUE cb_bucket_bucket_get(VALUE self);
|
348
|
+
VALUE cb_bucket_pool_get(VALUE self);
|
349
|
+
VALUE cb_bucket_username_get(VALUE self);
|
350
|
+
VALUE cb_bucket_password_get(VALUE self);
|
351
|
+
VALUE cb_bucket_environment_get(VALUE self);
|
352
|
+
VALUE cb_bucket_num_replicas_get(VALUE self);
|
353
|
+
VALUE cb_bucket_default_observe_timeout_get(VALUE self);
|
354
|
+
VALUE cb_bucket_default_observe_timeout_set(VALUE self, VALUE val);
|
355
|
+
|
356
|
+
VALUE cb_http_request_alloc(VALUE klass);
|
357
|
+
VALUE cb_http_request_init(int argc, VALUE *argv, VALUE self);
|
358
|
+
VALUE cb_http_request_inspect(VALUE self);
|
359
|
+
VALUE cb_http_request_on_body(VALUE self);
|
360
|
+
VALUE cb_http_request_perform(VALUE self);
|
361
|
+
VALUE cb_http_request_pause(VALUE self);
|
362
|
+
VALUE cb_http_request_continue(VALUE self);
|
363
|
+
VALUE cb_http_request_path_get(VALUE self);
|
364
|
+
VALUE cb_http_request_extended_get(VALUE self);
|
365
|
+
VALUE cb_http_request_chunked_get(VALUE self);
|
366
|
+
|
367
|
+
VALUE cb_result_success_p(VALUE self);
|
368
|
+
VALUE cb_result_inspect(VALUE self);
|
369
|
+
|
370
|
+
VALUE cb_timer_alloc(VALUE klass);
|
371
|
+
VALUE cb_timer_inspect(VALUE self);
|
372
|
+
VALUE cb_timer_cancel(VALUE self);
|
373
|
+
VALUE cb_timer_init(int argc, VALUE *argv, VALUE self);
|
374
|
+
|
375
|
+
/* Method arguments */
|
376
|
+
|
377
|
+
enum command_t {
|
378
|
+
cmd_touch = 0x01,
|
379
|
+
cmd_remove = 0x02,
|
380
|
+
cmd_store = 0x03,
|
381
|
+
cmd_get = 0x04,
|
382
|
+
cmd_arith = 0x05,
|
383
|
+
cmd_stats = 0x06,
|
384
|
+
cmd_version = 0x08,
|
385
|
+
cmd_observe = 0x09,
|
386
|
+
cmd_unlock = 0x10
|
387
|
+
};
|
388
|
+
|
389
|
+
struct params_st
|
390
|
+
{
|
391
|
+
enum command_t type;
|
392
|
+
union {
|
393
|
+
struct {
|
394
|
+
/* number of items */
|
395
|
+
size_t num;
|
396
|
+
/* array of the items */
|
397
|
+
lcb_touch_cmd_t *items;
|
398
|
+
/* array of the pointers to the items */
|
399
|
+
const lcb_touch_cmd_t **ptr;
|
400
|
+
unsigned int quiet : 1;
|
401
|
+
unsigned int array : 1;
|
402
|
+
lcb_time_t ttl;
|
403
|
+
} touch;
|
404
|
+
struct {
|
405
|
+
/* number of items */
|
406
|
+
size_t num;
|
407
|
+
/* array of the items */
|
408
|
+
lcb_remove_cmd_t *items;
|
409
|
+
/* array of the pointers to the items */
|
410
|
+
const lcb_remove_cmd_t **ptr;
|
411
|
+
unsigned int array : 1;
|
412
|
+
/* 1 if it should silense NOT_FOUND errors */
|
413
|
+
unsigned int quiet : 1;
|
414
|
+
lcb_cas_t cas;
|
415
|
+
} remove;
|
416
|
+
struct {
|
417
|
+
/* number of items */
|
418
|
+
size_t num;
|
419
|
+
/* array of the items */
|
420
|
+
lcb_store_cmd_t *items;
|
421
|
+
/* array of the pointers to the items */
|
422
|
+
const lcb_store_cmd_t **ptr;
|
423
|
+
lcb_storage_t operation;
|
424
|
+
lcb_uint32_t flags;
|
425
|
+
lcb_time_t ttl;
|
426
|
+
lcb_cas_t cas;
|
427
|
+
lcb_datatype_t datatype;
|
428
|
+
VALUE observe;
|
429
|
+
} store;
|
430
|
+
struct {
|
431
|
+
/* number of items */
|
432
|
+
size_t num;
|
433
|
+
/* array of the items */
|
434
|
+
lcb_get_cmd_t *items;
|
435
|
+
/* array of the pointers to the items */
|
436
|
+
const lcb_get_cmd_t **ptr;
|
437
|
+
/* array of the items for GET_REPLICA command */
|
438
|
+
lcb_get_replica_cmd_t *items_gr;
|
439
|
+
/* array of the pointers to the items for GET_REPLICA command */
|
440
|
+
const lcb_get_replica_cmd_t **ptr_gr;
|
441
|
+
unsigned int array : 1;
|
442
|
+
unsigned int lock : 1;
|
443
|
+
unsigned int replica : 1;
|
444
|
+
unsigned int assemble_hash : 1;
|
445
|
+
unsigned int extended : 1;
|
446
|
+
unsigned int quiet : 1;
|
447
|
+
/* arguments given in form of hash key-ttl to "get and touch" */
|
448
|
+
unsigned int gat : 1;
|
449
|
+
lcb_time_t ttl;
|
450
|
+
VALUE forced_format;
|
451
|
+
VALUE keys_ary;
|
452
|
+
} get;
|
453
|
+
struct {
|
454
|
+
/* number of items */
|
455
|
+
size_t num;
|
456
|
+
/* array of the items */
|
457
|
+
lcb_arithmetic_cmd_t *items;
|
458
|
+
/* array of the pointers to the items */
|
459
|
+
const lcb_arithmetic_cmd_t **ptr;
|
460
|
+
unsigned int array : 1;
|
461
|
+
unsigned int extended : 1;
|
462
|
+
unsigned int create : 1;
|
463
|
+
lcb_time_t ttl;
|
464
|
+
lcb_uint64_t initial;
|
465
|
+
lcb_uint64_t delta;
|
466
|
+
int sign;
|
467
|
+
VALUE format;
|
468
|
+
lcb_datatype_t datatype;
|
469
|
+
} arith;
|
470
|
+
struct {
|
471
|
+
/* number of items */
|
472
|
+
size_t num;
|
473
|
+
/* array of the items */
|
474
|
+
lcb_server_stats_cmd_t *items;
|
475
|
+
/* array of the pointers to the items */
|
476
|
+
const lcb_server_stats_cmd_t **ptr;
|
477
|
+
unsigned int array : 1;
|
478
|
+
} stats;
|
479
|
+
struct {
|
480
|
+
/* number of items */
|
481
|
+
size_t num;
|
482
|
+
/* array of the items */
|
483
|
+
lcb_server_version_cmd_t *items;
|
484
|
+
/* array of the pointers to the items */
|
485
|
+
const lcb_server_version_cmd_t **ptr;
|
486
|
+
} version;
|
487
|
+
struct {
|
488
|
+
/* number of items */
|
489
|
+
size_t num;
|
490
|
+
/* array of the items */
|
491
|
+
lcb_observe_cmd_t *items;
|
492
|
+
/* array of the pointers to the items */
|
493
|
+
const lcb_observe_cmd_t **ptr;
|
494
|
+
unsigned int array : 1;
|
495
|
+
} observe;
|
496
|
+
struct {
|
497
|
+
/* number of items */
|
498
|
+
size_t num;
|
499
|
+
/* array of the items */
|
500
|
+
lcb_unlock_cmd_t *items;
|
501
|
+
/* array of the pointers to the items */
|
502
|
+
const lcb_unlock_cmd_t **ptr;
|
503
|
+
unsigned int quiet : 1;
|
504
|
+
lcb_cas_t cas;
|
505
|
+
} unlock;
|
506
|
+
} cmd;
|
507
|
+
struct bucket_st *bucket;
|
508
|
+
/* helper index for iterators */
|
509
|
+
size_t idx;
|
510
|
+
/* the approximate size of the data to be sent */
|
511
|
+
size_t npayload;
|
512
|
+
};
|
513
|
+
|
514
|
+
void cb_params_destroy(struct params_st *params);
|
515
|
+
void cb_params_build(struct params_st *params, int argc, VALUE argv);
|
516
|
+
|
517
|
+
|
518
|
+
#endif
|
519
|
+
|