couchbase 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/RELEASE_NOTES.markdown +48 -0
- data/couchbase.gemspec +1 -1
- data/ext/couchbase_ext/arguments.c +25 -5
- data/ext/couchbase_ext/couchbase_ext.c +6 -2
- data/ext/couchbase_ext/couchbase_ext.h +4 -1
- data/ext/couchbase_ext/extconf.rb +14 -2
- data/ext/couchbase_ext/get.c +21 -4
- data/lib/active_support/cache/couchbase_store.rb +7 -2
- data/lib/couchbase.rb +3 -1
- data/lib/couchbase/connection_pool.rb +3 -0
- data/lib/couchbase/version.rb +1 -1
- data/lib/ext/multi_json_fix.rb +2 -2
- data/tasks/compile.rake +1 -1
- data/test/setup.rb +1 -1
- data/test/test_arithmetic.rb +1 -1
- data/test/test_async.rb +1 -1
- data/test/test_bucket.rb +1 -1
- data/test/test_cas.rb +1 -1
- data/test/test_couchbase.rb +1 -1
- data/test/test_couchbase_connection_pool.rb +43 -39
- data/test/test_couchbase_rails_cache_store.rb +1 -1
- data/test/test_delete.rb +1 -1
- data/test/test_errors.rb +1 -1
- data/test/test_eventmachine.rb +1 -1
- data/test/test_format.rb +1 -1
- data/test/test_get.rb +1 -1
- data/test/test_stats.rb +1 -1
- data/test/test_store.rb +1 -1
- data/test/test_timer.rb +1 -1
- data/test/test_touch.rb +1 -1
- data/test/test_unlock.rb +1 -1
- data/test/test_utils.rb +1 -1
- data/test/test_version.rb +1 -1
- metadata +155 -151
data/RELEASE_NOTES.markdown
CHANGED
@@ -3,6 +3,54 @@
|
|
3
3
|
This document is a list of user visible feature changes and important
|
4
4
|
bugfixes. Do not forget to update this doc in every important patch.
|
5
5
|
|
6
|
+
## 1.3.2 (2013-07-10)
|
7
|
+
|
8
|
+
* [major] RCBC-133 Allow application to select the strategy of reading
|
9
|
+
from replica nodes. **This version requires libcouchbase >= 2.0.7.**
|
10
|
+
Now three strategies are available:
|
11
|
+
|
12
|
+
* `:first` - synonym to `true`, previous behaviour now the
|
13
|
+
default. It means that the library will sequentially iterate
|
14
|
+
over all replicas in the configuration supplied by the cluster
|
15
|
+
and will return as soon as it finds a successful response, or
|
16
|
+
report an error.
|
17
|
+
|
18
|
+
c.get("foo", :replica => true)
|
19
|
+
c.get("foo", :replica => :first)
|
20
|
+
#=> "bar"
|
21
|
+
c.get("foo", :replica => :first, :extended => true)
|
22
|
+
#=> ["bar", 0, 11218368683493556224]
|
23
|
+
|
24
|
+
* `:all` - query all replicas in parallel. In this case the method
|
25
|
+
will return the array of the values on the all replica nodes without
|
26
|
+
a particular order. Also if the key isn't on the node, it will be
|
27
|
+
skipped in the result array.
|
28
|
+
|
29
|
+
c.get("foo", :replica => :all)
|
30
|
+
#=> ["bar", "bar", "bar"]
|
31
|
+
c.get("foo", :replica => :all, :extended => true)
|
32
|
+
#=> [["bar", 0, 11218368683493556224],
|
33
|
+
# ["bar", 0, 11218368683493556224],
|
34
|
+
# ["bar", 0, 11218368683493556224]]
|
35
|
+
|
36
|
+
* `Fixnum` - you can also select specific replica node by its
|
37
|
+
index in the cluster configuration. It should be in interval
|
38
|
+
`0...c.num_replicas`
|
39
|
+
|
40
|
+
0...c.num_replicas
|
41
|
+
#=> 0...3
|
42
|
+
c.get("foo", :replica => 1)
|
43
|
+
#=> "bar"
|
44
|
+
c.get("foo", :replica => 42)
|
45
|
+
#=> ArgumentError: replica index should be in interval 0...3
|
46
|
+
|
47
|
+
Note that applications should not assume the order of the
|
48
|
+
replicas indicates more recent data is at a lower index number.
|
49
|
+
It is up to the application to determine which version of a
|
50
|
+
document/item it may wish to use in the case of retrieving data
|
51
|
+
from a replica.
|
52
|
+
|
53
|
+
|
6
54
|
## 1.3.1 (2013-06-05)
|
7
55
|
|
8
56
|
* [major] RCBC-131 Couchbase::Cluster instance shouldn't require
|
data/couchbase.gemspec
CHANGED
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.add_runtime_dependency 'connection_pool', '~> 1.0.0'
|
41
41
|
|
42
42
|
s.add_development_dependency 'rake'
|
43
|
-
s.add_development_dependency 'minitest'
|
43
|
+
s.add_development_dependency 'minitest', '~> 5.0.4'
|
44
44
|
s.add_development_dependency 'rake-compiler', '>= 0.7.5'
|
45
45
|
s.add_development_dependency 'mini_portile'
|
46
46
|
s.add_development_dependency 'yajl-ruby', '~> 1.1.0'
|
@@ -373,7 +373,7 @@ cb_params_store_parse_arguments(struct cb_params_st *params, int argc, VALUE arg
|
|
373
373
|
static void
|
374
374
|
cb_params_get_alloc(struct cb_params_st *params, lcb_size_t size)
|
375
375
|
{
|
376
|
-
if (params->cmd.get.replica) {
|
376
|
+
if (RTEST(params->cmd.get.replica)) {
|
377
377
|
_alloc_data_for_s(get, lcb_get_replica_cmd_t, size, items_gr, ptr_gr);
|
378
378
|
} else {
|
379
379
|
_alloc_data_for(get, lcb_get_cmd_t);
|
@@ -386,9 +386,18 @@ cb_params_get_init_item(struct cb_params_st *params, lcb_size_t idx,
|
|
386
386
|
{
|
387
387
|
key_obj = cb_unify_key(params->bucket, key_obj, 1);
|
388
388
|
rb_ary_push(params->ensurance, key_obj);
|
389
|
-
if (params->cmd.get.replica) {
|
390
|
-
params->cmd.get.items_gr[idx].
|
391
|
-
params->cmd.get.items_gr[idx].v.
|
389
|
+
if (RTEST(params->cmd.get.replica)) {
|
390
|
+
params->cmd.get.items_gr[idx].version = 1;
|
391
|
+
params->cmd.get.items_gr[idx].v.v1.key = RSTRING_PTR(key_obj);
|
392
|
+
params->cmd.get.items_gr[idx].v.v1.nkey = RSTRING_LEN(key_obj);
|
393
|
+
if (params->cmd.get.replica == cb_sym_first || params->cmd.get.replica == Qtrue) {
|
394
|
+
params->cmd.get.items_gr[idx].v.v1.strategy = LCB_REPLICA_FIRST;
|
395
|
+
} else if (params->cmd.get.replica == cb_sym_all) {
|
396
|
+
params->cmd.get.items_gr[idx].v.v1.strategy = LCB_REPLICA_ALL;
|
397
|
+
} else {
|
398
|
+
params->cmd.get.items_gr[idx].v.v1.strategy = LCB_REPLICA_SELECT;
|
399
|
+
params->cmd.get.items_gr[idx].v.v1.index = FIX2INT(params->cmd.get.replica);
|
400
|
+
}
|
392
401
|
} else {
|
393
402
|
params->cmd.get.items[idx].v.v0.key = RSTRING_PTR(key_obj);
|
394
403
|
params->cmd.get.items[idx].v.v0.nkey = RSTRING_LEN(key_obj);
|
@@ -416,7 +425,17 @@ cb_params_get_parse_options(struct cb_params_st *params, VALUE options)
|
|
416
425
|
if (NIL_P(options)) {
|
417
426
|
return;
|
418
427
|
}
|
419
|
-
|
428
|
+
tmp = rb_hash_aref(options, cb_sym_replica);
|
429
|
+
if (tmp == Qtrue || tmp == cb_sym_all || tmp == cb_sym_first) {
|
430
|
+
params->cmd.get.replica = tmp;
|
431
|
+
} else if (TYPE(tmp) == T_FIXNUM) {
|
432
|
+
int nr = NUM2INT(tmp);
|
433
|
+
int max = lcb_get_num_replicas(params->bucket->handle);
|
434
|
+
if (nr < 0 || nr >= max) {
|
435
|
+
rb_raise(rb_eArgError, "replica index should be in interval 0...%d", max);
|
436
|
+
}
|
437
|
+
params->cmd.get.replica = tmp;
|
438
|
+
}
|
420
439
|
params->cmd.get.extended = RTEST(rb_hash_aref(options, cb_sym_extended));
|
421
440
|
params->cmd.get.assemble_hash = RTEST(rb_hash_aref(options, cb_sym_assemble_hash));
|
422
441
|
tmp = rb_hash_lookup2(options, cb_sym_quiet, Qundef);
|
@@ -876,6 +895,7 @@ do_params_build(VALUE ptr)
|
|
876
895
|
params->cmd.get.quiet = params->bucket->quiet;
|
877
896
|
params->cmd.get.transcoder = params->bucket->transcoder;
|
878
897
|
params->cmd.get.transcoder_opts = rb_hash_new();
|
898
|
+
params->cmd.get.replica = Qfalse;
|
879
899
|
cb_params_get_parse_options(params, opts);
|
880
900
|
cb_params_get_parse_arguments(params, argc, argv);
|
881
901
|
break;
|
@@ -36,6 +36,7 @@ VALUE em_m;
|
|
36
36
|
|
37
37
|
/* Symbols */
|
38
38
|
ID cb_sym_add;
|
39
|
+
ID cb_sym_all;
|
39
40
|
ID cb_sym_append;
|
40
41
|
ID cb_sym_assemble_hash;
|
41
42
|
ID cb_sym_async;
|
@@ -62,9 +63,10 @@ ID cb_sym_engine;
|
|
62
63
|
ID cb_sym_environment;
|
63
64
|
ID cb_sym_eventmachine;
|
64
65
|
ID cb_sym_extended;
|
66
|
+
ID cb_sym_first;
|
65
67
|
ID cb_sym_flags;
|
66
|
-
ID cb_sym_format;
|
67
68
|
ID cb_sym_forced;
|
69
|
+
ID cb_sym_format;
|
68
70
|
ID cb_sym_found;
|
69
71
|
ID cb_sym_get;
|
70
72
|
ID cb_sym_hostname;
|
@@ -1151,6 +1153,7 @@ Init_couchbase_ext(void)
|
|
1151
1153
|
cb_id_verify_observe_options = rb_intern("verify_observe_options");
|
1152
1154
|
|
1153
1155
|
cb_sym_add = ID2SYM(rb_intern("add"));
|
1156
|
+
cb_sym_all = ID2SYM(rb_intern("all"));
|
1154
1157
|
cb_sym_append = ID2SYM(rb_intern("append"));
|
1155
1158
|
cb_sym_assemble_hash = ID2SYM(rb_intern("assemble_hash"));
|
1156
1159
|
cb_sym_async = ID2SYM(rb_intern("async"));
|
@@ -1176,9 +1179,10 @@ Init_couchbase_ext(void)
|
|
1176
1179
|
cb_sym_environment = ID2SYM(rb_intern("environment"));
|
1177
1180
|
cb_sym_eventmachine = ID2SYM(rb_intern("eventmachine"));
|
1178
1181
|
cb_sym_extended = ID2SYM(rb_intern("extended"));
|
1182
|
+
cb_sym_first = ID2SYM(rb_intern("first"));
|
1179
1183
|
cb_sym_flags = ID2SYM(rb_intern("flags"));
|
1180
|
-
cb_sym_format = ID2SYM(rb_intern("format"));
|
1181
1184
|
cb_sym_forced = ID2SYM(rb_intern("forced"));
|
1185
|
+
cb_sym_format = ID2SYM(rb_intern("format"));
|
1182
1186
|
cb_sym_found = ID2SYM(rb_intern("found"));
|
1183
1187
|
cb_sym_get = ID2SYM(rb_intern("get"));
|
1184
1188
|
cb_sym_hostname = ID2SYM(rb_intern("hostname"));
|
@@ -135,6 +135,7 @@ struct cb_context_st
|
|
135
135
|
struct cb_http_request_st *request;
|
136
136
|
int quiet;
|
137
137
|
int arith; /* incr: +1, decr: -1, other: 0 */
|
138
|
+
int all_replicas; /* handle multiple responses from get_replica if non-zero */
|
138
139
|
size_t nqueries;
|
139
140
|
};
|
140
141
|
|
@@ -179,6 +180,7 @@ extern VALUE em_m;
|
|
179
180
|
|
180
181
|
/* Symbols */
|
181
182
|
extern ID cb_sym_add;
|
183
|
+
extern ID cb_sym_all;
|
182
184
|
extern ID cb_sym_append;
|
183
185
|
extern ID cb_sym_assemble_hash;
|
184
186
|
extern ID cb_sym_async;
|
@@ -205,6 +207,7 @@ extern ID cb_sym_engine;
|
|
205
207
|
extern ID cb_sym_environment;
|
206
208
|
extern ID cb_sym_eventmachine;
|
207
209
|
extern ID cb_sym_extended;
|
210
|
+
extern ID cb_sym_first;
|
208
211
|
extern ID cb_sym_flags;
|
209
212
|
extern ID cb_sym_forced;
|
210
213
|
extern ID cb_sym_format;
|
@@ -509,13 +512,13 @@ struct cb_params_st
|
|
509
512
|
const lcb_get_replica_cmd_t **ptr_gr;
|
510
513
|
unsigned int array : 1;
|
511
514
|
unsigned int lock : 1;
|
512
|
-
unsigned int replica : 1;
|
513
515
|
unsigned int assemble_hash : 1;
|
514
516
|
unsigned int extended : 1;
|
515
517
|
unsigned int quiet : 1;
|
516
518
|
/* arguments given in form of hash key-ttl to "get and touch" */
|
517
519
|
unsigned int gat : 1;
|
518
520
|
lcb_time_t ttl;
|
521
|
+
VALUE replica;
|
519
522
|
VALUE transcoder;
|
520
523
|
VALUE transcoder_opts;
|
521
524
|
VALUE keys_ary;
|
@@ -121,12 +121,24 @@ end
|
|
121
121
|
|
122
122
|
def die(message)
|
123
123
|
STDERR.puts "\n#{"*" * 70}"
|
124
|
-
STDERR.puts "#{message}"
|
124
|
+
STDERR.puts "#{message.gsub(/^/, "* ")}"
|
125
125
|
STDERR.puts "#{"*" * 70}\n\n"
|
126
126
|
abort
|
127
127
|
end
|
128
128
|
|
129
|
-
|
129
|
+
unless try_compile(<<-SRC)
|
130
|
+
#include <libcouchbase/couchbase.h>
|
131
|
+
|
132
|
+
int main() {
|
133
|
+
lcb_get_replica_cmd_t cmd;
|
134
|
+
cmd.v.v1.strategy = 42;
|
135
|
+
return 0;
|
136
|
+
}
|
137
|
+
SRC
|
138
|
+
die("You must install libcouchbase >= 2.0.7\nSee http://www.couchbase.com/communities/c/ for more details")
|
139
|
+
end
|
140
|
+
|
141
|
+
have_library("couchbase", "lcb_verify_compiler_setup", "libcouchbase/couchbase.h") # just to add -lcouchbase properly
|
130
142
|
have_header("mach/mach_time.h")
|
131
143
|
have_header("stdint.h") or die("Failed to locate stdint.h")
|
132
144
|
have_header("sys/time.h")
|
data/ext/couchbase_ext/get.c
CHANGED
@@ -64,7 +64,15 @@ cb_get_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_g
|
|
64
64
|
} else { /* synchronous */
|
65
65
|
if (NIL_P(exc) && error != LCB_KEY_ENOENT) {
|
66
66
|
if (ctx->extended) {
|
67
|
-
|
67
|
+
val = rb_ary_new3(3, val, flags, cas);
|
68
|
+
}
|
69
|
+
if (ctx->all_replicas) {
|
70
|
+
VALUE ary = rb_hash_aref(ctx->rv, key);
|
71
|
+
if (NIL_P(ary)) {
|
72
|
+
ary = rb_ary_new();
|
73
|
+
rb_hash_aset(ctx->rv, key, ary);
|
74
|
+
}
|
75
|
+
rb_ary_push(ary, val);
|
68
76
|
} else {
|
69
77
|
rb_hash_aset(ctx->rv, key, val);
|
70
78
|
}
|
@@ -115,8 +123,13 @@ cb_get_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_g
|
|
115
123
|
* @option options [true, false] :assemble_hash (false) Assemble Hash for
|
116
124
|
* results. Hash assembled automatically if +:extended+ option is true
|
117
125
|
* or in case of "get and touch" multimple keys.
|
118
|
-
* @option options [true, false
|
119
|
-
* node. Options +:ttl+ and +:lock+
|
126
|
+
* @option options [true, false, :all, :first, Fixnum] :replica
|
127
|
+
* (false) Read key from replica node. Options +:ttl+ and +:lock+
|
128
|
+
* are not compatible with +:replica+. Value +true+ is a synonym to
|
129
|
+
* +:first+, which means sequentially iterate over all replicas
|
130
|
+
* and return first successful response, skipping all failures.
|
131
|
+
* It is also possible to query all replicas in parallel using
|
132
|
+
* the +:all+ option, or pass a replica index, starting from zero.
|
120
133
|
*
|
121
134
|
* @yieldparam ret [Result] the result of operation in asynchronous mode
|
122
135
|
* (valid attributes: +error+, +operation+, +key+, +value+, +flags+,
|
@@ -236,7 +249,11 @@ cb_bucket_get(int argc, VALUE *argv, VALUE self)
|
|
236
249
|
ctx->quiet = params.cmd.get.quiet;
|
237
250
|
ctx->transcoder = params.cmd.get.transcoder;
|
238
251
|
ctx->transcoder_opts = params.cmd.get.transcoder_opts;
|
239
|
-
if (params.cmd.get.replica) {
|
252
|
+
if (RTEST(params.cmd.get.replica)) {
|
253
|
+
if (params.cmd.get.replica == cb_sym_all) {
|
254
|
+
ctx->nqueries = lcb_get_num_replicas(bucket->handle);
|
255
|
+
ctx->all_replicas = 1;
|
256
|
+
}
|
240
257
|
err = lcb_get_replica(bucket->handle, (const void *)ctx,
|
241
258
|
params.cmd.get.num, params.cmd.get.ptr_gr);
|
242
259
|
} else {
|
@@ -59,8 +59,13 @@ module ActiveSupport
|
|
59
59
|
args.push(options)
|
60
60
|
|
61
61
|
if options[:connection_pool]
|
62
|
-
|
63
|
-
|
62
|
+
if RUBY_VERSION.to_f < 1.9
|
63
|
+
warn "connection_pool gem doesn't support ruby < 1.9"
|
64
|
+
else
|
65
|
+
@data = ::Couchbase::ConnectionPool.new(options[:connection_pool], *args)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
unless @data
|
64
69
|
@data = ::Couchbase::Bucket.new(*args)
|
65
70
|
@data.extend(Threadsafe)
|
66
71
|
end
|
data/lib/couchbase.rb
CHANGED
@@ -32,7 +32,9 @@ require 'couchbase/cluster'
|
|
32
32
|
# Couchbase ruby client
|
33
33
|
module Couchbase
|
34
34
|
|
35
|
-
|
35
|
+
if RUBY_VERSION.to_f >= 1.9
|
36
|
+
autoload(:ConnectionPool, 'couchbase/connection_pool')
|
37
|
+
end
|
36
38
|
|
37
39
|
class << self
|
38
40
|
# The method +connect+ initializes new Bucket instance with all arguments passed.
|
data/lib/couchbase/version.rb
CHANGED
data/lib/ext/multi_json_fix.rb
CHANGED
@@ -31,7 +31,7 @@ version = begin
|
|
31
31
|
MultiJson::VERSION
|
32
32
|
rescue NameError
|
33
33
|
MultiJson::Version.to_s
|
34
|
-
end
|
34
|
+
end.dup # because Gem::Version modifies it
|
35
35
|
if Gem::Version.new(version) < Gem::Version.new('1.3.3')
|
36
36
|
class << MultiJson
|
37
37
|
alias :dump :encode
|
@@ -43,7 +43,7 @@ if multi_json_engine.name =~ /JsonGem$/
|
|
43
43
|
class << multi_json_engine
|
44
44
|
alias _load_object load
|
45
45
|
def load(string, options = {})
|
46
|
-
if string.
|
46
|
+
if string.respond_to?(:read)
|
47
47
|
string = string.read
|
48
48
|
end
|
49
49
|
if string =~ /\A\s*[{\[]/
|
data/tasks/compile.rake
CHANGED
@@ -84,7 +84,7 @@ namespace :ports do
|
|
84
84
|
directory "ports"
|
85
85
|
|
86
86
|
task :libcouchbase => ["ports"] do
|
87
|
-
recipe = MiniPortile.new "libcouchbase", "2.0.
|
87
|
+
recipe = MiniPortile.new "libcouchbase", "2.0.7"
|
88
88
|
recipe.files << "http://packages.couchbase.com/clients/c/libcouchbase-#{recipe.version}.tar.gz"
|
89
89
|
recipe.configure_options.push("--disable-debug",
|
90
90
|
"--disable-dependency-tracking",
|
data/test/setup.rb
CHANGED
data/test/test_arithmetic.rb
CHANGED
data/test/test_async.rb
CHANGED
data/test/test_bucket.rb
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
require File.join(File.dirname(__FILE__), 'setup')
|
19
19
|
|
20
|
-
class TestBucket < MiniTest::
|
20
|
+
class TestBucket < MiniTest::Test
|
21
21
|
|
22
22
|
def test_it_substitute_default_parts_to_url
|
23
23
|
# with_mock(:host => 'localhost', :port => 8091, :buckets_spec => 'default,foo') do |mock|
|
data/test/test_cas.rb
CHANGED
data/test/test_couchbase.rb
CHANGED
@@ -15,59 +15,63 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
|
19
|
-
require 'couchbase/connection_pool'
|
18
|
+
if RUBY_VERSION.to_f >= 1.9
|
20
19
|
|
21
|
-
|
20
|
+
require File.join(File.dirname(__FILE__), 'setup')
|
21
|
+
require 'couchbase/connection_pool'
|
22
22
|
|
23
|
-
|
24
|
-
@mock = start_mock
|
25
|
-
@pool = ::Couchbase::ConnectionPool.new(5, :hostname => @mock.host, :port => @mock.port)
|
26
|
-
end
|
23
|
+
class TestCouchbaseConnectionPool < MiniTest::Test
|
27
24
|
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
def setup
|
26
|
+
@mock = start_mock
|
27
|
+
@pool = ::Couchbase::ConnectionPool.new(5, :hostname => @mock.host, :port => @mock.port)
|
28
|
+
end
|
31
29
|
|
32
|
-
|
33
|
-
|
30
|
+
def teardown
|
31
|
+
stop_mock(@mock)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_basic_multithreaded_usage
|
35
|
+
@pool.set('foo', 'bar')
|
36
|
+
|
37
|
+
threads = []
|
38
|
+
15.times do
|
39
|
+
threads << Thread.new do
|
40
|
+
@pool.get('foo')
|
41
|
+
end
|
42
|
+
end
|
34
43
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
@pool.get('foo')
|
44
|
+
result = threads.map(&:value)
|
45
|
+
result.each do |val|
|
46
|
+
assert_equal 'bar', val
|
39
47
|
end
|
40
48
|
end
|
41
49
|
|
42
|
-
|
43
|
-
|
44
|
-
assert_equal '
|
50
|
+
def test_set_and_get
|
51
|
+
@pool.set('fiz', 'buzz')
|
52
|
+
assert_equal 'buzz', @pool.get('fiz')
|
45
53
|
end
|
46
|
-
end
|
47
54
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
55
|
+
def test_set_and_delete
|
56
|
+
@pool.set('baz', 'bar')
|
57
|
+
@pool.delete('baz')
|
58
|
+
assert_raises Couchbase::Error::NotFound do
|
59
|
+
@pool.get('baz')
|
60
|
+
end
|
61
|
+
end
|
52
62
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
@pool.get('baz')
|
63
|
+
def test_incr
|
64
|
+
@pool.set('counter', 0)
|
65
|
+
@pool.incr('counter', 1)
|
66
|
+
assert_equal 1, @pool.get('counter')
|
58
67
|
end
|
59
|
-
end
|
60
68
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
69
|
+
def test_decr
|
70
|
+
@pool.set('counter', 1)
|
71
|
+
@pool.decr('counter', 1)
|
72
|
+
assert_equal 0, @pool.get('counter')
|
73
|
+
end
|
66
74
|
|
67
|
-
def test_decr
|
68
|
-
@pool.set('counter', 1)
|
69
|
-
@pool.decr('counter', 1)
|
70
|
-
assert_equal 0, @pool.get('counter')
|
71
75
|
end
|
72
76
|
|
73
77
|
end
|
@@ -20,7 +20,7 @@ require 'active_support/cache/couchbase_store'
|
|
20
20
|
require 'active_support/notifications'
|
21
21
|
require 'ostruct'
|
22
22
|
|
23
|
-
class TestCouchbaseRailsCacheStore < MiniTest::
|
23
|
+
class TestCouchbaseRailsCacheStore < MiniTest::Test
|
24
24
|
|
25
25
|
def setup
|
26
26
|
@mock = start_mock
|
data/test/test_delete.rb
CHANGED
data/test/test_errors.rb
CHANGED
data/test/test_eventmachine.rb
CHANGED
data/test/test_format.rb
CHANGED
data/test/test_get.rb
CHANGED
data/test/test_stats.rb
CHANGED
data/test/test_store.rb
CHANGED
data/test/test_timer.rb
CHANGED
data/test/test_touch.rb
CHANGED
data/test/test_unlock.rb
CHANGED
data/test/test_utils.rb
CHANGED
data/test/test_version.rb
CHANGED
metadata
CHANGED
@@ -1,183 +1,183 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchbase
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 3
|
9
|
+
- 2
|
10
|
+
version: 1.3.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Couchbase
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
|
18
|
+
date: 2013-07-10 00:00:00 +03:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
25
|
+
requirements:
|
19
26
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 23
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 3
|
32
|
+
- 2
|
21
33
|
version: 0.3.2
|
22
|
-
|
34
|
+
name: yaji
|
35
|
+
version_requirements: *id001
|
23
36
|
prerelease: false
|
24
|
-
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
type: :runtime
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
25
40
|
none: false
|
26
|
-
requirements:
|
41
|
+
requirements:
|
27
42
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 15
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 0
|
48
|
+
version: "1.0"
|
31
49
|
name: multi_json
|
32
|
-
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '1.0'
|
38
|
-
type: :runtime
|
50
|
+
version_requirements: *id002
|
39
51
|
prerelease: false
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '1.0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: connection_pool
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
type: :runtime
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
49
55
|
none: false
|
50
|
-
requirements:
|
56
|
+
requirements:
|
51
57
|
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 23
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 0
|
63
|
+
- 0
|
53
64
|
version: 1.0.0
|
54
|
-
|
65
|
+
name: connection_pool
|
66
|
+
version_requirements: *id003
|
55
67
|
prerelease: false
|
56
|
-
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
type: :development
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
57
71
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
63
79
|
name: rake
|
64
|
-
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :development
|
80
|
+
version_requirements: *id004
|
71
81
|
prerelease: false
|
72
|
-
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
type: :development
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
73
85
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 63
|
90
|
+
segments:
|
91
|
+
- 5
|
92
|
+
- 0
|
93
|
+
- 4
|
94
|
+
version: 5.0.4
|
79
95
|
name: minitest
|
80
|
-
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
96
|
+
version_requirements: *id005
|
87
97
|
prerelease: false
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rake-compiler
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
type: :development
|
100
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
97
101
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 9
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
- 7
|
109
|
+
- 5
|
101
110
|
version: 0.7.5
|
102
|
-
|
111
|
+
name: rake-compiler
|
112
|
+
version_requirements: *id006
|
103
113
|
prerelease: false
|
104
|
-
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
type: :development
|
116
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
105
117
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 3
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
version: "0"
|
111
125
|
name: mini_portile
|
112
|
-
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
126
|
+
version_requirements: *id007
|
119
127
|
prerelease: false
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: yajl-ruby
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
type: :development
|
130
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
129
131
|
none: false
|
130
|
-
requirements:
|
132
|
+
requirements:
|
131
133
|
- - ~>
|
132
|
-
- !ruby/object:Gem::Version
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
hash: 19
|
136
|
+
segments:
|
137
|
+
- 1
|
138
|
+
- 1
|
139
|
+
- 0
|
133
140
|
version: 1.1.0
|
134
|
-
|
141
|
+
name: yajl-ruby
|
142
|
+
version_requirements: *id008
|
135
143
|
prerelease: false
|
136
|
-
|
144
|
+
- !ruby/object:Gem::Dependency
|
145
|
+
type: :development
|
146
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
137
147
|
none: false
|
138
|
-
requirements:
|
139
|
-
- -
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
|
142
|
-
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
hash: 3
|
152
|
+
segments:
|
153
|
+
- 0
|
154
|
+
version: "0"
|
143
155
|
name: active_support
|
144
|
-
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
|
-
type: :development
|
156
|
+
version_requirements: *id009
|
151
157
|
prerelease: false
|
152
|
-
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
type: :development
|
160
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
153
161
|
none: false
|
154
|
-
requirements:
|
155
|
-
- -
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
|
158
|
-
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
hash: 3
|
166
|
+
segments:
|
167
|
+
- 0
|
168
|
+
version: "0"
|
159
169
|
name: eventmachine
|
160
|
-
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ! '>='
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
166
|
-
type: :development
|
170
|
+
version_requirements: *id010
|
167
171
|
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
172
|
description: The official client library for use with Couchbase Server.
|
175
173
|
email: support@couchbase.com
|
176
174
|
executables: []
|
177
|
-
|
175
|
+
|
176
|
+
extensions:
|
178
177
|
- ext/couchbase_ext/extconf.rb
|
179
178
|
extra_rdoc_files: []
|
180
|
-
|
179
|
+
|
180
|
+
files:
|
181
181
|
- .gitignore
|
182
182
|
- .travis.yml
|
183
183
|
- .yardopts
|
@@ -268,35 +268,39 @@ files:
|
|
268
268
|
- test/test_unlock.rb
|
269
269
|
- test/test_utils.rb
|
270
270
|
- test/test_version.rb
|
271
|
+
has_rdoc: true
|
271
272
|
homepage: http://couchbase.org
|
272
|
-
licenses:
|
273
|
+
licenses:
|
273
274
|
- ASL-2
|
274
275
|
post_install_message:
|
275
276
|
rdoc_options: []
|
276
|
-
|
277
|
+
|
278
|
+
require_paths:
|
277
279
|
- lib
|
278
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
280
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
279
281
|
none: false
|
280
|
-
requirements:
|
281
|
-
- -
|
282
|
-
- !ruby/object:Gem::Version
|
283
|
-
|
284
|
-
segments:
|
282
|
+
requirements:
|
283
|
+
- - ">="
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
hash: 3
|
286
|
+
segments:
|
285
287
|
- 0
|
286
|
-
|
287
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
288
|
+
version: "0"
|
289
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
288
290
|
none: false
|
289
|
-
requirements:
|
290
|
-
- -
|
291
|
-
- !ruby/object:Gem::Version
|
292
|
-
|
293
|
-
segments:
|
291
|
+
requirements:
|
292
|
+
- - ">="
|
293
|
+
- !ruby/object:Gem::Version
|
294
|
+
hash: 3
|
295
|
+
segments:
|
294
296
|
- 0
|
295
|
-
|
297
|
+
version: "0"
|
296
298
|
requirements: []
|
299
|
+
|
297
300
|
rubyforge_project:
|
298
|
-
rubygems_version: 1.
|
301
|
+
rubygems_version: 1.6.2
|
299
302
|
signing_key:
|
300
303
|
specification_version: 3
|
301
304
|
summary: Couchbase ruby driver
|
302
305
|
test_files: []
|
306
|
+
|