couchbase 1.1.5-x86-mingw32 → 1.2.0.beta-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/test/test_unlock.rb
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
# Author:: Couchbase <info@couchbase.com>
|
2
|
+
# Copyright:: 2011, 2012 Couchbase, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
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
|
+
|
18
|
+
require File.join(File.dirname(__FILE__), 'setup')
|
19
|
+
|
20
|
+
class TestTouch < MiniTest::Unit::TestCase
|
21
|
+
|
22
|
+
def setup
|
23
|
+
@mock = start_mock
|
24
|
+
end
|
25
|
+
|
26
|
+
def teardown
|
27
|
+
stop_mock(@mock)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_trivial_unlock
|
31
|
+
if @mock.real?
|
32
|
+
connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)
|
33
|
+
connection.set(uniq_id, "foo")
|
34
|
+
_, _, cas = connection.get(uniq_id, :lock => true, :extended => true)
|
35
|
+
assert_raises Couchbase::Error::KeyExists do
|
36
|
+
connection.set(uniq_id, "bar")
|
37
|
+
end
|
38
|
+
assert connection.unlock(uniq_id, :cas => cas)
|
39
|
+
connection.set(uniq_id, "bar")
|
40
|
+
else
|
41
|
+
skip("GETL and UNL aren't implemented in CouchbaseMock.jar yet")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_alternative_syntax_for_single_key
|
46
|
+
if @mock.real?
|
47
|
+
connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)
|
48
|
+
connection.set(uniq_id, "foo")
|
49
|
+
_, _, cas = connection.get(uniq_id, :lock => true, :extended => true)
|
50
|
+
assert_raises Couchbase::Error::KeyExists do
|
51
|
+
connection.set(uniq_id, "bar")
|
52
|
+
end
|
53
|
+
assert connection.unlock(uniq_id, cas)
|
54
|
+
connection.set(uniq_id, "bar")
|
55
|
+
else
|
56
|
+
skip("GETL and UNL aren't implemented in CouchbaseMock.jar yet")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_multiple_unlock
|
61
|
+
if @mock.real?
|
62
|
+
connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)
|
63
|
+
connection.set(uniq_id(1), "foo")
|
64
|
+
connection.set(uniq_id(2), "foo")
|
65
|
+
info = connection.get(uniq_id(1), uniq_id(2), :lock => true, :extended => true)
|
66
|
+
assert_raises Couchbase::Error::KeyExists do
|
67
|
+
connection.set(uniq_id(1), "bar")
|
68
|
+
end
|
69
|
+
assert_raises Couchbase::Error::KeyExists do
|
70
|
+
connection.set(uniq_id(2), "bar")
|
71
|
+
end
|
72
|
+
ret = connection.unlock(uniq_id(1) => info[uniq_id(1)][2],
|
73
|
+
uniq_id(2) => info[uniq_id(2)][2])
|
74
|
+
puts ret.inspect
|
75
|
+
assert ret[uniq_id(1)]
|
76
|
+
assert ret[uniq_id(2)]
|
77
|
+
connection.set(uniq_id(1), "bar")
|
78
|
+
connection.set(uniq_id(2), "bar")
|
79
|
+
else
|
80
|
+
skip("GETL and UNL aren't implemented in CouchbaseMock.jar yet")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_quiet_mode
|
85
|
+
if @mock.real?
|
86
|
+
connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)
|
87
|
+
connection.set(uniq_id, "foo")
|
88
|
+
_, _, cas = connection.get(uniq_id, :lock => true, :extended => true)
|
89
|
+
assert_raises Couchbase::Error::NotFound do
|
90
|
+
connection.unlock(uniq_id(:missing), :cas => 0xdeadbeef)
|
91
|
+
end
|
92
|
+
keys = {
|
93
|
+
uniq_id => cas,
|
94
|
+
uniq_id(:missing) => 0xdeadbeef
|
95
|
+
}
|
96
|
+
ret = connection.unlock(keys, :quiet => true)
|
97
|
+
assert ret[uniq_id]
|
98
|
+
refute ret[uniq_id(:missing)]
|
99
|
+
else
|
100
|
+
skip("GETL and UNL aren't implemented in CouchbaseMock.jar yet")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_tmp_failure
|
105
|
+
if @mock.real?
|
106
|
+
connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)
|
107
|
+
cas1 = connection.set(uniq_id(1), "foo")
|
108
|
+
cas2 = connection.set(uniq_id(2), "foo")
|
109
|
+
connection.get(uniq_id(1), :lock => true) # get with lock will update CAS
|
110
|
+
assert_raises Couchbase::Error::TemporaryFail do
|
111
|
+
connection.unlock(uniq_id(1), cas1)
|
112
|
+
end
|
113
|
+
assert_raises Couchbase::Error::TemporaryFail do
|
114
|
+
connection.unlock(uniq_id(2), cas2)
|
115
|
+
end
|
116
|
+
else
|
117
|
+
skip("GETL and UNL aren't implemented in CouchbaseMock.jar yet")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
data/test/test_utils.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Author:: Couchbase <info@couchbase.com>
|
2
|
+
# Copyright:: 2011, 2012 Couchbase, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
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
|
+
|
18
|
+
require File.join(File.dirname(__FILE__), 'setup')
|
19
|
+
|
20
|
+
class TestUtils < MiniTest::Unit::TestCase
|
21
|
+
|
22
|
+
def test_complex_startkey
|
23
|
+
assert_equal "all_docs?startkey=%5B%22Deadmau5%22%2C%22%22%5D", Couchbase::Utils.build_query("all_docs", :startkey => ["Deadmau5", ""])
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0.beta
|
5
|
+
prerelease: 6
|
6
6
|
platform: x86-mingw32
|
7
7
|
authors:
|
8
8
|
- Couchbase
|
@@ -12,13 +12,13 @@ cert_chain: []
|
|
12
12
|
date: 2012-09-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: yaji
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 0.3.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,23 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 0.3.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: multi_json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: rake
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,6 +123,22 @@ dependencies:
|
|
107
123
|
- - ! '>='
|
108
124
|
- !ruby/object:Gem::Version
|
109
125
|
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: yard-xml
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
110
142
|
- !ruby/object:Gem::Dependency
|
111
143
|
name: mini_portile
|
112
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +155,22 @@ dependencies:
|
|
123
155
|
- - ! '>='
|
124
156
|
- !ruby/object:Gem::Version
|
125
157
|
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: yajl-ruby
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ~>
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 1.1.0
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ~>
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 1.1.0
|
126
174
|
- !ruby/object:Gem::Dependency
|
127
175
|
name: debugger
|
128
176
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,6 +187,22 @@ dependencies:
|
|
139
187
|
- - ! '>='
|
140
188
|
- !ruby/object:Gem::Version
|
141
189
|
version: '0'
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: active_support
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
142
206
|
description: The official client library for use with Couchbase Server.
|
143
207
|
email: support@couchbase.com
|
144
208
|
executables: []
|
@@ -154,11 +218,37 @@ files:
|
|
154
218
|
- README.markdown
|
155
219
|
- Rakefile
|
156
220
|
- couchbase.gemspec
|
221
|
+
- ext/couchbase_ext/.gitignore
|
222
|
+
- ext/couchbase_ext/arguments.c
|
223
|
+
- ext/couchbase_ext/arithmetic.c
|
224
|
+
- ext/couchbase_ext/bucket.c
|
157
225
|
- ext/couchbase_ext/couchbase_ext.c
|
226
|
+
- ext/couchbase_ext/couchbase_ext.h
|
227
|
+
- ext/couchbase_ext/delete.c
|
158
228
|
- ext/couchbase_ext/extconf.rb
|
229
|
+
- ext/couchbase_ext/get.c
|
230
|
+
- ext/couchbase_ext/gethrtime.c
|
231
|
+
- ext/couchbase_ext/http.c
|
232
|
+
- ext/couchbase_ext/observe.c
|
233
|
+
- ext/couchbase_ext/result.c
|
234
|
+
- ext/couchbase_ext/stats.c
|
235
|
+
- ext/couchbase_ext/store.c
|
236
|
+
- ext/couchbase_ext/timer.c
|
237
|
+
- ext/couchbase_ext/touch.c
|
238
|
+
- ext/couchbase_ext/unlock.c
|
239
|
+
- ext/couchbase_ext/utils.c
|
240
|
+
- ext/couchbase_ext/version.c
|
241
|
+
- lib/action_dispatch/middleware/session/couchbase_store.rb
|
242
|
+
- lib/active_support/cache/couchbase_store.rb
|
159
243
|
- lib/couchbase.rb
|
160
244
|
- lib/couchbase/bucket.rb
|
245
|
+
- lib/couchbase/result.rb
|
246
|
+
- lib/couchbase/utils.rb
|
161
247
|
- lib/couchbase/version.rb
|
248
|
+
- lib/couchbase/view.rb
|
249
|
+
- lib/couchbase/view_row.rb
|
250
|
+
- lib/ext/multi_json_fix.rb
|
251
|
+
- lib/rack/session/couchbase.rb
|
162
252
|
- tasks/benchmark.rake
|
163
253
|
- tasks/compile.rake
|
164
254
|
- tasks/doc.rake
|
@@ -173,14 +263,17 @@ files:
|
|
173
263
|
- test/test_bucket.rb
|
174
264
|
- test/test_cas.rb
|
175
265
|
- test/test_couchbase.rb
|
266
|
+
- test/test_couchbase_rails_cache_store.rb
|
176
267
|
- test/test_delete.rb
|
177
268
|
- test/test_errors.rb
|
178
|
-
- test/test_flush.rb
|
179
269
|
- test/test_format.rb
|
180
270
|
- test/test_get.rb
|
181
271
|
- test/test_stats.rb
|
182
272
|
- test/test_store.rb
|
273
|
+
- test/test_timer.rb
|
183
274
|
- test/test_touch.rb
|
275
|
+
- test/test_unlock.rb
|
276
|
+
- test/test_utils.rb
|
184
277
|
- test/test_version.rb
|
185
278
|
- lib/couchbase/1.8/couchbase_ext.so
|
186
279
|
- lib/couchbase/1.9/couchbase_ext.so
|
@@ -200,16 +293,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
293
|
version: '0'
|
201
294
|
segments:
|
202
295
|
- 0
|
203
|
-
hash:
|
296
|
+
hash: 3447535338547361504
|
204
297
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
298
|
none: false
|
206
299
|
requirements:
|
207
|
-
- - ! '
|
300
|
+
- - ! '>'
|
208
301
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
210
|
-
segments:
|
211
|
-
- 0
|
212
|
-
hash: 1664938512714947814
|
302
|
+
version: 1.3.1
|
213
303
|
requirements: []
|
214
304
|
rubyforge_project:
|
215
305
|
rubygems_version: 1.8.23
|