couchbase 1.1.5 → 1.2.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/.gitignore +2 -1
  2. data/.travis.yml +12 -1
  3. data/HISTORY.markdown +112 -1
  4. data/README.markdown +149 -6
  5. data/couchbase.gemspec +5 -1
  6. data/ext/couchbase_ext/.gitignore +4 -0
  7. data/ext/couchbase_ext/arguments.c +973 -0
  8. data/ext/couchbase_ext/arithmetic.c +322 -0
  9. data/ext/couchbase_ext/bucket.c +1092 -0
  10. data/ext/couchbase_ext/couchbase_ext.c +618 -3247
  11. data/ext/couchbase_ext/couchbase_ext.h +519 -0
  12. data/ext/couchbase_ext/delete.c +167 -0
  13. data/ext/couchbase_ext/extconf.rb +24 -5
  14. data/ext/couchbase_ext/get.c +301 -0
  15. data/ext/couchbase_ext/gethrtime.c +124 -0
  16. data/ext/couchbase_ext/http.c +402 -0
  17. data/ext/couchbase_ext/observe.c +174 -0
  18. data/ext/couchbase_ext/result.c +126 -0
  19. data/ext/couchbase_ext/stats.c +169 -0
  20. data/ext/couchbase_ext/store.c +522 -0
  21. data/ext/couchbase_ext/timer.c +192 -0
  22. data/ext/couchbase_ext/touch.c +190 -0
  23. data/ext/couchbase_ext/unlock.c +180 -0
  24. data/ext/couchbase_ext/utils.c +471 -0
  25. data/ext/couchbase_ext/version.c +147 -0
  26. data/lib/action_dispatch/middleware/session/couchbase_store.rb +38 -0
  27. data/lib/active_support/cache/couchbase_store.rb +356 -0
  28. data/lib/couchbase.rb +24 -3
  29. data/lib/couchbase/bucket.rb +372 -9
  30. data/lib/couchbase/result.rb +26 -0
  31. data/lib/couchbase/utils.rb +59 -0
  32. data/lib/couchbase/version.rb +1 -1
  33. data/lib/couchbase/view.rb +305 -0
  34. data/lib/couchbase/view_row.rb +230 -0
  35. data/lib/ext/multi_json_fix.rb +47 -0
  36. data/lib/rack/session/couchbase.rb +104 -0
  37. data/tasks/compile.rake +5 -14
  38. data/test/setup.rb +6 -2
  39. data/test/test_arithmetic.rb +32 -2
  40. data/test/test_async.rb +18 -4
  41. data/test/test_bucket.rb +11 -1
  42. data/test/test_cas.rb +13 -3
  43. data/test/test_couchbase_rails_cache_store.rb +294 -0
  44. data/test/test_delete.rb +60 -3
  45. data/test/test_format.rb +28 -17
  46. data/test/test_get.rb +91 -14
  47. data/test/test_store.rb +31 -1
  48. data/test/{test_flush.rb → test_timer.rb} +11 -18
  49. data/test/test_touch.rb +33 -5
  50. data/test/test_unlock.rb +120 -0
  51. data/test/test_utils.rb +26 -0
  52. metadata +101 -8
@@ -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
@@ -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.1.5
5
- prerelease:
4
+ version: 1.2.0.beta
5
+ prerelease: 6
6
6
  platform: ruby
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: yajl-ruby
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: 1.1.0
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: 1.1.0
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: []
@@ -155,11 +219,37 @@ files:
155
219
  - README.markdown
156
220
  - Rakefile
157
221
  - couchbase.gemspec
222
+ - ext/couchbase_ext/.gitignore
223
+ - ext/couchbase_ext/arguments.c
224
+ - ext/couchbase_ext/arithmetic.c
225
+ - ext/couchbase_ext/bucket.c
158
226
  - ext/couchbase_ext/couchbase_ext.c
227
+ - ext/couchbase_ext/couchbase_ext.h
228
+ - ext/couchbase_ext/delete.c
159
229
  - ext/couchbase_ext/extconf.rb
230
+ - ext/couchbase_ext/get.c
231
+ - ext/couchbase_ext/gethrtime.c
232
+ - ext/couchbase_ext/http.c
233
+ - ext/couchbase_ext/observe.c
234
+ - ext/couchbase_ext/result.c
235
+ - ext/couchbase_ext/stats.c
236
+ - ext/couchbase_ext/store.c
237
+ - ext/couchbase_ext/timer.c
238
+ - ext/couchbase_ext/touch.c
239
+ - ext/couchbase_ext/unlock.c
240
+ - ext/couchbase_ext/utils.c
241
+ - ext/couchbase_ext/version.c
242
+ - lib/action_dispatch/middleware/session/couchbase_store.rb
243
+ - lib/active_support/cache/couchbase_store.rb
160
244
  - lib/couchbase.rb
161
245
  - lib/couchbase/bucket.rb
246
+ - lib/couchbase/result.rb
247
+ - lib/couchbase/utils.rb
162
248
  - lib/couchbase/version.rb
249
+ - lib/couchbase/view.rb
250
+ - lib/couchbase/view_row.rb
251
+ - lib/ext/multi_json_fix.rb
252
+ - lib/rack/session/couchbase.rb
163
253
  - tasks/benchmark.rake
164
254
  - tasks/compile.rake
165
255
  - tasks/doc.rake
@@ -174,14 +264,17 @@ files:
174
264
  - test/test_bucket.rb
175
265
  - test/test_cas.rb
176
266
  - test/test_couchbase.rb
267
+ - test/test_couchbase_rails_cache_store.rb
177
268
  - test/test_delete.rb
178
269
  - test/test_errors.rb
179
- - test/test_flush.rb
180
270
  - test/test_format.rb
181
271
  - test/test_get.rb
182
272
  - test/test_stats.rb
183
273
  - test/test_store.rb
274
+ - test/test_timer.rb
184
275
  - test/test_touch.rb
276
+ - test/test_unlock.rb
277
+ - test/test_utils.rb
185
278
  - test/test_version.rb
186
279
  homepage: http://couchbase.org
187
280
  licenses:
@@ -199,9 +292,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
199
292
  required_rubygems_version: !ruby/object:Gem::Requirement
200
293
  none: false
201
294
  requirements:
202
- - - ! '>='
295
+ - - ! '>'
203
296
  - !ruby/object:Gem::Version
204
- version: '0'
297
+ version: 1.3.1
205
298
  requirements: []
206
299
  rubyforge_project:
207
300
  rubygems_version: 1.8.23