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
data/ext/couchbase_ext/version.c
CHANGED
@@ -18,16 +18,16 @@
|
|
18
18
|
#include "couchbase_ext.h"
|
19
19
|
|
20
20
|
void
|
21
|
-
|
21
|
+
cb_version_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_server_version_resp_t *resp)
|
22
22
|
{
|
23
|
-
struct
|
24
|
-
struct
|
23
|
+
struct cb_context_st *ctx = (struct cb_context_st *)cookie;
|
24
|
+
struct cb_bucket_st *bucket = ctx->bucket;
|
25
25
|
VALUE node, val, *rv = ctx->rv, exc, res;
|
26
26
|
|
27
27
|
node = resp->v.v0.server_endpoint ? STR_NEW_CSTR(resp->v.v0.server_endpoint) : Qnil;
|
28
28
|
exc = cb_check_error(error, "failed to get version", node);
|
29
29
|
if (exc != Qnil) {
|
30
|
-
rb_ivar_set(exc,
|
30
|
+
rb_ivar_set(exc, cb_id_iv_operation, cb_sym_version);
|
31
31
|
if (NIL_P(ctx->exception)) {
|
32
32
|
ctx->exception = cb_gc_protect(bucket, exc);
|
33
33
|
}
|
@@ -37,11 +37,11 @@ version_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_
|
|
37
37
|
val = STR_NEW((const char*)resp->v.v0.vstring, resp->v.v0.nvstring);
|
38
38
|
if (bucket->async) { /* asynchronous */
|
39
39
|
if (ctx->proc != Qnil) {
|
40
|
-
res = rb_class_new_instance(0, NULL,
|
41
|
-
rb_ivar_set(res,
|
42
|
-
rb_ivar_set(res,
|
43
|
-
rb_ivar_set(res,
|
44
|
-
rb_ivar_set(res,
|
40
|
+
res = rb_class_new_instance(0, NULL, cb_cResult);
|
41
|
+
rb_ivar_set(res, cb_id_iv_error, exc);
|
42
|
+
rb_ivar_set(res, cb_id_iv_operation, cb_sym_version);
|
43
|
+
rb_ivar_set(res, cb_id_iv_node, node);
|
44
|
+
rb_ivar_set(res, cb_id_iv_value, val);
|
45
45
|
cb_proc_call(ctx->proc, 1, res);
|
46
46
|
}
|
47
47
|
} else { /* synchronous */
|
@@ -52,6 +52,9 @@ version_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_
|
|
52
52
|
} else {
|
53
53
|
ctx->nqueries--;
|
54
54
|
cb_gc_unprotect(bucket, ctx->proc);
|
55
|
+
if (bucket->async) {
|
56
|
+
xfree(ctx);
|
57
|
+
}
|
55
58
|
}
|
56
59
|
|
57
60
|
(void)handle;
|
@@ -87,26 +90,26 @@ version_callback(lcb_t handle, const void *cookie, lcb_error_t error, const lcb_
|
|
87
90
|
VALUE
|
88
91
|
cb_bucket_version(int argc, VALUE *argv, VALUE self)
|
89
92
|
{
|
90
|
-
struct
|
91
|
-
struct
|
93
|
+
struct cb_bucket_st *bucket = DATA_PTR(self);
|
94
|
+
struct cb_context_st *ctx;
|
92
95
|
VALUE rv, exc, args, proc;
|
93
96
|
lcb_error_t err;
|
94
|
-
struct
|
97
|
+
struct cb_params_st params;
|
95
98
|
|
96
99
|
if (bucket->handle == NULL) {
|
97
|
-
rb_raise(
|
100
|
+
rb_raise(cb_eConnectError, "closed connection");
|
98
101
|
}
|
99
102
|
rb_scan_args(argc, argv, "0*&", &args, &proc);
|
100
103
|
if (!bucket->async && proc != Qnil) {
|
101
104
|
rb_raise(rb_eArgError, "synchronous mode doesn't support callbacks");
|
102
105
|
}
|
103
|
-
memset(¶ms, 0, sizeof(struct
|
104
|
-
params.type =
|
106
|
+
memset(¶ms, 0, sizeof(struct cb_params_st));
|
107
|
+
params.type = cb_cmd_version;
|
105
108
|
params.bucket = bucket;
|
106
109
|
cb_params_build(¶ms, RARRAY_LEN(args), args);
|
107
|
-
ctx = xcalloc(1, sizeof(struct
|
110
|
+
ctx = xcalloc(1, sizeof(struct cb_context_st));
|
108
111
|
if (ctx == NULL) {
|
109
|
-
rb_raise(
|
112
|
+
rb_raise(cb_eClientNoMemoryError, "failed to allocate memory for context");
|
110
113
|
}
|
111
114
|
rv = rb_hash_new();
|
112
115
|
ctx->rv = &rv;
|
@@ -124,7 +127,7 @@ cb_bucket_version(int argc, VALUE *argv, VALUE self)
|
|
124
127
|
}
|
125
128
|
bucket->nbytes += params.npayload;
|
126
129
|
if (bucket->async) {
|
127
|
-
|
130
|
+
cb_maybe_do_loop(bucket);
|
128
131
|
return Qnil;
|
129
132
|
} else {
|
130
133
|
if (ctx->nqueries > 0) {
|
data/lib/couchbase/version.rb
CHANGED
data/lib/couchbase/view.rb
CHANGED
@@ -29,6 +29,24 @@ module Couchbase
|
|
29
29
|
super("#{prefix}#{from}: #{reason}")
|
30
30
|
end
|
31
31
|
end
|
32
|
+
|
33
|
+
class HTTP < Base
|
34
|
+
attr_reader :type, :reason
|
35
|
+
|
36
|
+
def parse_body!
|
37
|
+
if @body
|
38
|
+
hash = MultiJson.load(@body)
|
39
|
+
@type = hash["error"]
|
40
|
+
@reason = hash["reason"]
|
41
|
+
end
|
42
|
+
rescue MultiJson::DecodeError
|
43
|
+
@type = @reason = nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_s
|
47
|
+
super.sub(/ \(/, ": #{@type}: #{@reason} (")
|
48
|
+
end
|
49
|
+
end
|
32
50
|
end
|
33
51
|
|
34
52
|
# This class implements Couchbase View execution
|
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.0"
|
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/tasks/test.rake
CHANGED
@@ -48,47 +48,54 @@ end
|
|
48
48
|
|
49
49
|
Rake::Task['test'].prerequisites.unshift('test/CouchbaseMock.jar')
|
50
50
|
|
51
|
-
|
51
|
+
common_flags = %w[
|
52
|
+
--tool=memcheck
|
53
|
+
--error-limit=no
|
54
|
+
--undef-value-errors=no
|
55
|
+
--leak-check=full
|
56
|
+
--show-reachable=yes
|
57
|
+
--num-callers=50
|
58
|
+
--track-fds=yes
|
59
|
+
--workaround-gcc296-bugs=yes
|
60
|
+
--leak-resolution=med
|
61
|
+
--max-stackframe=7304328
|
62
|
+
--partial-loads-ok=yes
|
63
|
+
]
|
64
|
+
|
65
|
+
desc "Run the test suite under Valgrind memcheck."
|
52
66
|
task "test:valgrind" do
|
53
|
-
ENV['RUBY_PREFIX'] =
|
54
|
-
"valgrind",
|
55
|
-
"--num-callers=50",
|
56
|
-
"--error-limit=no",
|
57
|
-
"--partial-loads-ok=yes",
|
58
|
-
"--undef-value-errors=no",
|
59
|
-
"--track-fds=yes",
|
60
|
-
"--leak-check=full",
|
61
|
-
"--leak-resolution=med",
|
62
|
-
].join(' ')
|
67
|
+
ENV['RUBY_PREFIX'] = "valgrind #{common_flags.join(' ')}"
|
63
68
|
Rake::Task['test'].invoke
|
64
69
|
end
|
65
70
|
|
66
|
-
desc "Run the test suite under Valgrind with memory-fill."
|
71
|
+
desc "Run the test suite under Valgrind memcheck with memory-fill."
|
67
72
|
task "test:valgrind:mem_fill" do
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
"--freelist-vol=100000000",
|
75
|
-
"--malloc-fill=6D",
|
76
|
-
"--free-fill=66",
|
77
|
-
].join(' ')
|
73
|
+
local_flags = %w[
|
74
|
+
--malloc-fill=6D
|
75
|
+
--freelist-vol=100000000
|
76
|
+
--free-fill=66
|
77
|
+
]
|
78
|
+
ENV['RUBY_PREFIX'] = "valgrind #{common_flags.join(' ')} #{local_flags.join(' ')}"
|
78
79
|
Rake::Task['test'].invoke
|
79
80
|
end
|
80
81
|
|
81
|
-
desc "Run the test suite under Valgrind with memory-zero."
|
82
|
+
desc "Run the test suite under Valgrind memcheck with memory-zero."
|
82
83
|
task "test:valgrind:mem_zero" do
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
84
|
+
local_flags = %w[
|
85
|
+
--freelist-vol=100000000
|
86
|
+
--malloc-fill=00
|
87
|
+
--free-fill=00
|
88
|
+
]
|
89
|
+
ENV['RUBY_PREFIX'] = "valgrind #{common_flags.join(' ')} #{local_flags.join(' ')}"
|
90
|
+
Rake::Task['test'].invoke
|
91
|
+
end
|
92
|
+
|
93
|
+
desc "Run the test suite under Valgrind massif."
|
94
|
+
task "test:valgrind:massif" do
|
95
|
+
local_flags = %w[
|
96
|
+
--tool=massif
|
97
|
+
--time-unit=B
|
98
|
+
]
|
99
|
+
ENV['RUBY_PREFIX'] = "valgrind #{local_flags.join(' ')}"
|
93
100
|
Rake::Task['test'].invoke
|
94
101
|
end
|
data/test/setup.rb
CHANGED
data/test/test_arithmetic.rb
CHANGED
@@ -54,6 +54,43 @@ class TestArithmetic < MiniTest::Unit::TestCase
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
def test_it_allows_to_make_increments_less_verbose_by_forcing_create_by_default
|
58
|
+
connection = Couchbase.connect(:hostname => @mock.host, :port => @mock.port,
|
59
|
+
:default_arithmetic_init => true)
|
60
|
+
assert_raises(Couchbase::Error::NotFound) do
|
61
|
+
connection.get(uniq_id)
|
62
|
+
end
|
63
|
+
assert_equal 0, connection.incr(uniq_id), "return value"
|
64
|
+
assert_equal 0, connection.get(uniq_id), "via get command"
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_it_allows_to_setup_initial_value_during_connection
|
68
|
+
connection = Couchbase.connect(:hostname => @mock.host, :port => @mock.port,
|
69
|
+
:default_arithmetic_init => 10)
|
70
|
+
assert_raises(Couchbase::Error::NotFound) do
|
71
|
+
connection.get(uniq_id)
|
72
|
+
end
|
73
|
+
assert_equal 10, connection.incr(uniq_id), "return value"
|
74
|
+
assert_equal 10, connection.get(uniq_id), "via get command"
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_it_allows_to_change_default_initial_value_after_connection
|
78
|
+
connection = Couchbase.connect(:hostname => @mock.host, :port => @mock.port)
|
79
|
+
|
80
|
+
assert_equal 0, connection.default_arithmetic_init
|
81
|
+
assert_raises(Couchbase::Error::NotFound) do
|
82
|
+
connection.incr(uniq_id)
|
83
|
+
end
|
84
|
+
|
85
|
+
connection.default_arithmetic_init = 10
|
86
|
+
assert_equal 10, connection.default_arithmetic_init
|
87
|
+
assert_raises(Couchbase::Error::NotFound) do
|
88
|
+
connection.get(uniq_id)
|
89
|
+
end
|
90
|
+
assert_equal 10, connection.incr(uniq_id), "return value"
|
91
|
+
assert_equal 10, connection.get(uniq_id), "via get command"
|
92
|
+
end
|
93
|
+
|
57
94
|
def test_it_creates_missing_key_when_initial_value_specified
|
58
95
|
connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)
|
59
96
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.0.z.
|
4
|
+
version: 1.2.0.z.beta5
|
5
5
|
prerelease: 6
|
6
6
|
platform: x86-mingw32
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yaji
|
@@ -295,7 +295,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
295
295
|
version: '0'
|
296
296
|
segments:
|
297
297
|
- 0
|
298
|
-
hash:
|
298
|
+
hash: -2940983111283759750
|
299
299
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
300
300
|
none: false
|
301
301
|
requirements:
|
@@ -308,25 +308,4 @@ rubygems_version: 1.8.23
|
|
308
308
|
signing_key:
|
309
309
|
specification_version: 3
|
310
310
|
summary: Couchbase ruby driver
|
311
|
-
test_files:
|
312
|
-
- test/profile/.gitignore
|
313
|
-
- test/profile/Gemfile
|
314
|
-
- test/profile/benchmark.rb
|
315
|
-
- test/setup.rb
|
316
|
-
- test/test_arithmetic.rb
|
317
|
-
- test/test_async.rb
|
318
|
-
- test/test_bucket.rb
|
319
|
-
- test/test_cas.rb
|
320
|
-
- test/test_couchbase.rb
|
321
|
-
- test/test_couchbase_rails_cache_store.rb
|
322
|
-
- test/test_delete.rb
|
323
|
-
- test/test_errors.rb
|
324
|
-
- test/test_format.rb
|
325
|
-
- test/test_get.rb
|
326
|
-
- test/test_stats.rb
|
327
|
-
- test/test_store.rb
|
328
|
-
- test/test_timer.rb
|
329
|
-
- test/test_touch.rb
|
330
|
-
- test/test_unlock.rb
|
331
|
-
- test/test_utils.rb
|
332
|
-
- test/test_version.rb
|
311
|
+
test_files: []
|