couchbase-jruby-client 0.2.2-java → 1.0.4-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +103 -0
- data/.ruby-version +1 -1
- data/Rakefile +13 -2
- data/couchbase-jruby-client.gemspec +7 -6
- data/lib/couchbase/bucket.rb +11 -338
- data/lib/couchbase/cluster.rb +10 -88
- data/lib/couchbase/configuration.rb +39 -0
- data/lib/couchbase/design_doc.rb +18 -73
- data/lib/couchbase/document.rb +34 -0
- data/lib/couchbase/error.rb +0 -35
- data/lib/couchbase/operations.rb +60 -40
- data/lib/couchbase/version.rb +1 -1
- data/lib/couchbase/view.rb +55 -345
- data/lib/couchbase.rb +37 -141
- data/lib/jars/couchbase-core-io-1.1.4.jar +0 -0
- data/lib/jars/couchbase-java-client-2.1.4.jar +0 -0
- data/lib/jars/rxjava-1.0.8.jar +0 -0
- data/lib/jars/rxjruby-0.0.1.jar +0 -0
- data/test/{test_cas.rb → helper.rb} +15 -10
- data/test/test_bucket.rb +14 -228
- data/test/test_cluster.rb +1 -29
- data/test/test_configuration.rb +51 -0
- data/test/test_couchbase.rb +28 -28
- data/test/test_design_doc.rb +29 -0
- data/test/test_document.rb +51 -0
- data/test/test_operations.rb +49 -0
- data/test/test_view.rb +62 -116
- metadata +43 -125
- data/lib/couchbase/async/callback.rb +0 -38
- data/lib/couchbase/async/queue.rb +0 -26
- data/lib/couchbase/async.rb +0 -32
- data/lib/couchbase/constants.rb +0 -29
- data/lib/couchbase/operations/arithmetic.rb +0 -290
- data/lib/couchbase/operations/delete.rb +0 -115
- data/lib/couchbase/operations/design_docs.rb +0 -99
- data/lib/couchbase/operations/fetch.rb +0 -33
- data/lib/couchbase/operations/get.rb +0 -303
- data/lib/couchbase/operations/stats.rb +0 -42
- data/lib/couchbase/operations/store.rb +0 -463
- data/lib/couchbase/operations/touch.rb +0 -140
- data/lib/couchbase/operations/unlock.rb +0 -209
- data/lib/couchbase/operations/utils.rb +0 -68
- data/lib/couchbase/query.rb +0 -76
- data/lib/couchbase/result.rb +0 -60
- data/lib/couchbase/transcoder.rb +0 -81
- data/lib/couchbase/utils.rb +0 -62
- data/lib/couchbase/view_row.rb +0 -227
- data/lib/jars/commons-codec-1.5.jar +0 -0
- data/lib/jars/couchbase-client-1.3.2-javadoc.jar +0 -0
- data/lib/jars/couchbase-client-1.3.2-sources.jar +0 -0
- data/lib/jars/couchbase-client-1.3.2.jar +0 -0
- data/lib/jars/httpcore-4.3.1.jar +0 -0
- data/lib/jars/httpcore-nio-4.3.1.jar +0 -0
- data/lib/jars/jettison-1.1.jar +0 -0
- data/lib/jars/netty-3.5.5.Final.jar +0 -0
- data/lib/jars/spymemcached-2.10.5-javadoc.jar +0 -0
- data/lib/jars/spymemcached-2.10.5-sources.jar +0 -0
- data/lib/jars/spymemcached-2.10.5.jar +0 -0
- data/tasks/benchmark.rake +0 -6
- data/tasks/test.rake +0 -36
- data/tasks/util.rake +0 -21
- data/test/mock.rb +0 -85
- data/test/profile/.gitignore +0 -1
- data/test/profile/.jrubyrc +0 -722
- data/test/profile/Gemfile +0 -7
- data/test/profile/benchmark.rb +0 -177
- data/test/profile/profile.rb +0 -59
- data/test/setup.rb +0 -74
- data/test/test_arithmetic.rb +0 -155
- data/test/test_async.rb +0 -24
- data/test/test_couchbase_rails_cache_store.rb +0 -341
- data/test/test_delete.rb +0 -139
- data/test/test_design_docs.rb +0 -67
- data/test/test_errors.rb +0 -74
- data/test/test_fetch.rb +0 -71
- data/test/test_format.rb +0 -142
- data/test/test_get.rb +0 -363
- data/test/test_query.rb +0 -23
- data/test/test_result.rb +0 -15
- data/test/test_stats.rb +0 -44
- data/test/test_store.rb +0 -203
- data/test/test_touch.rb +0 -90
- data/test/test_unlock.rb +0 -89
- data/test/test_utils.rb +0 -67
- data/test/test_version.rb +0 -28
- data/test/test_view_row.rb +0 -74
data/test/test_view.rb
CHANGED
@@ -1,140 +1,86 @@
|
|
1
|
-
|
2
|
-
# Copyright:: 2013 Urlgonomics LLC.
|
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')
|
1
|
+
require 'helper'
|
19
2
|
|
20
3
|
class TestView < Minitest::Test
|
21
4
|
|
22
5
|
def setup
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
6
|
+
@bucket = Couchbase.bucket
|
7
|
+
@design_doc = {
|
8
|
+
test_map: {
|
9
|
+
map: <<-JS
|
10
|
+
function(doc, meta) {
|
11
|
+
emit(meta.id);
|
12
|
+
}
|
13
|
+
JS
|
14
|
+
},
|
15
|
+
test_reduce: {
|
16
|
+
map: 'function(doc, meta) { emit(meta.id, null); }',
|
17
|
+
reduce: '_count'
|
18
|
+
}
|
19
|
+
}
|
20
|
+
@bucket.save_design_doc('test', @design_doc)
|
29
21
|
end
|
30
22
|
|
31
|
-
def
|
32
|
-
@
|
33
|
-
|
23
|
+
def test_view_query
|
24
|
+
@bucket.upsert(uniq_id, true)
|
25
|
+
results = @bucket.query('test', 'test_map')
|
26
|
+
.fresh
|
27
|
+
.fetch
|
34
28
|
|
35
|
-
|
36
|
-
@reduce_view ||= Couchbase::View.new(cb, '_design/users/_view/all')
|
29
|
+
assert_equal true, results[uniq_id].data
|
37
30
|
end
|
38
31
|
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
32
|
+
def test_key
|
33
|
+
@bucket.upsert(uniq_id, true)
|
34
|
+
results = @bucket.query('test', 'test_map')
|
35
|
+
.key(uniq_id)
|
36
|
+
.fresh
|
37
|
+
.fetch
|
44
38
|
|
45
|
-
|
46
|
-
|
47
|
-
assert results = view.fetch
|
48
|
-
assert results.is_a?(Couchbase::View::ArrayWithTotalRows)
|
39
|
+
assert_equal 1, results.size
|
40
|
+
assert_equal true, results[uniq_id].data
|
49
41
|
end
|
50
42
|
|
51
|
-
def
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
43
|
+
def test_keys
|
44
|
+
@bucket.upsert(uniq_id(:a), true)
|
45
|
+
@bucket.upsert(uniq_id(:b), true)
|
46
|
+
results = @bucket.query('test', 'test_map')
|
47
|
+
.keys([uniq_id(:a), uniq_id(:b)])
|
48
|
+
.fresh
|
49
|
+
.fetch
|
50
|
+
|
51
|
+
assert_equal 2, results.size
|
52
|
+
assert_equal true, results[uniq_id(:a)].data
|
53
|
+
assert_equal true, results[uniq_id(:b)].data
|
61
54
|
end
|
62
55
|
|
63
|
-
def
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
results
|
70
|
-
%w(bob frank sam fred).include?(result.id)
|
71
|
-
%w(bob frank sam fred).include?(result.key)
|
72
|
-
end
|
56
|
+
def test_returns_nils_as_appropriate
|
57
|
+
100.times { |i| @bucket.upsert(uniq_id(i), true) }
|
58
|
+
# Force an index
|
59
|
+
@bucket.query('test', 'test_map').fresh.fetch
|
60
|
+
100.times { |i| @bucket.remove(uniq_id(i)) }
|
61
|
+
results = @bucket.query('test', 'test_map').fetch
|
62
|
+
assert_nil results[uniq_id(23)]
|
73
63
|
end
|
74
64
|
|
75
|
-
def
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
65
|
+
def test_reduced_view
|
66
|
+
@bucket.upsert(uniq_id, true)
|
67
|
+
results = @bucket.query('test', 'test_reduce')
|
68
|
+
.fresh
|
69
|
+
.fetch
|
81
70
|
|
82
|
-
|
83
|
-
|
84
|
-
refute view.fetch(stale: false, include_docs: true) { |row|
|
85
|
-
assert_instance_of Couchbase::ViewRow, row
|
86
|
-
assert row.doc['name'].is_a?(String)
|
87
|
-
assert row.doc['age'].is_a?(Fixnum)
|
88
|
-
}
|
71
|
+
assert_instance_of Fixnum, results
|
72
|
+
assert results > 0
|
89
73
|
end
|
90
74
|
|
91
|
-
def
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
75
|
+
def test_non_reduced_view
|
76
|
+
@bucket.upsert(uniq_id, true)
|
77
|
+
results = @bucket.query('test', 'test_reduce')
|
78
|
+
.fresh
|
79
|
+
.reduce(false)
|
80
|
+
.fetch
|
96
81
|
|
97
|
-
|
98
|
-
skip unless $mock.real?
|
99
|
-
assert results = reduce_view.fetch(stale: false, reduce: false)
|
100
|
-
assert_instance_of Couchbase::ViewRow, results.first
|
101
|
-
assert results.first.doc.nil?
|
102
|
-
assert_equal 4, results.total_rows
|
103
|
-
results.each do |result|
|
104
|
-
%w(bob frank sam fred).include?(result.key)
|
105
|
-
end
|
82
|
+
assert_equal true, results[uniq_id].data
|
106
83
|
end
|
107
84
|
|
108
|
-
def test_design_doc_access
|
109
|
-
skip unless $mock.real?
|
110
|
-
view.fetch(stale: false, include_docs: true)
|
111
|
-
assert results = cb.design_docs['users'].by_age.to_a
|
112
|
-
assert_instance_of Couchbase::ViewRow, results.first
|
113
|
-
end
|
114
85
|
|
115
|
-
def design_doc
|
116
|
-
{
|
117
|
-
'_id' => '_design/users',
|
118
|
-
'language' => 'javascript',
|
119
|
-
'views' => {
|
120
|
-
'by_age' => {
|
121
|
-
'map' => <<-JS
|
122
|
-
function (doc, meta) {
|
123
|
-
if (doc.type && doc.type == 'user')
|
124
|
-
emit(meta.id, doc.age);
|
125
|
-
}
|
126
|
-
JS
|
127
|
-
},
|
128
|
-
'all' => {
|
129
|
-
'reduce' => '_count',
|
130
|
-
'map' => <<-JS
|
131
|
-
function (doc, meta) {
|
132
|
-
if (doc.type && doc.type == 'user')
|
133
|
-
emit(meta.id, null);
|
134
|
-
}
|
135
|
-
JS
|
136
|
-
}
|
137
|
-
}
|
138
|
-
}
|
139
|
-
end
|
140
86
|
end
|
metadata
CHANGED
@@ -1,127 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchbase-jruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Mike Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: multi_json
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
14
|
requirement: !ruby/object:Gem::Requirement
|
21
15
|
requirements:
|
22
16
|
- - '>='
|
23
17
|
- !ruby/object:Gem::Version
|
24
|
-
version: '
|
18
|
+
version: '0'
|
19
|
+
name: multi_json
|
25
20
|
prerelease: false
|
26
21
|
type: :runtime
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: thread_safe
|
29
22
|
version_requirements: !ruby/object:Gem::Requirement
|
30
23
|
requirements:
|
31
24
|
- - '>='
|
32
25
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
34
28
|
requirement: !ruby/object:Gem::Requirement
|
35
29
|
requirements:
|
36
30
|
- - '>='
|
37
31
|
- !ruby/object:Gem::Version
|
38
|
-
version: 0
|
39
|
-
prerelease: false
|
40
|
-
type: :runtime
|
41
|
-
- !ruby/object:Gem::Dependency
|
32
|
+
version: '0'
|
42
33
|
name: bundler
|
34
|
+
prerelease: false
|
35
|
+
type: :development
|
43
36
|
version_requirements: !ruby/object:Gem::Requirement
|
44
37
|
requirements:
|
45
38
|
- - '>='
|
46
39
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
48
42
|
requirement: !ruby/object:Gem::Requirement
|
49
43
|
requirements:
|
50
44
|
- - '>='
|
51
45
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
46
|
+
version: '0'
|
47
|
+
name: rake
|
53
48
|
prerelease: false
|
54
49
|
type: :development
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
50
|
version_requirements: !ruby/object:Gem::Requirement
|
58
51
|
requirements:
|
59
52
|
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
62
56
|
requirement: !ruby/object:Gem::Requirement
|
63
57
|
requirements:
|
64
58
|
- - '>='
|
65
59
|
- !ruby/object:Gem::Version
|
66
60
|
version: '0'
|
61
|
+
name: minitest
|
67
62
|
prerelease: false
|
68
63
|
type: :development
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: minitest
|
71
64
|
version_requirements: !ruby/object:Gem::Requirement
|
72
65
|
requirements:
|
73
66
|
- - '>='
|
74
67
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
76
70
|
requirement: !ruby/object:Gem::Requirement
|
77
71
|
requirements:
|
78
72
|
- - '>='
|
79
73
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
74
|
+
version: '0'
|
75
|
+
name: jrjackson
|
81
76
|
prerelease: false
|
82
77
|
type: :development
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: jrjackson
|
85
78
|
version_requirements: !ruby/object:Gem::Requirement
|
86
79
|
requirements:
|
87
80
|
- - '>='
|
88
81
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
90
84
|
requirement: !ruby/object:Gem::Requirement
|
91
85
|
requirements:
|
92
86
|
- - '>='
|
93
87
|
- !ruby/object:Gem::Version
|
94
|
-
version: 0
|
88
|
+
version: '0'
|
89
|
+
name: pry
|
95
90
|
prerelease: false
|
96
91
|
type: :development
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: pry
|
99
92
|
version_requirements: !ruby/object:Gem::Requirement
|
100
93
|
requirements:
|
101
94
|
- - '>='
|
102
95
|
- !ruby/object:Gem::Version
|
103
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
104
98
|
requirement: !ruby/object:Gem::Requirement
|
105
99
|
requirements:
|
106
100
|
- - '>='
|
107
101
|
- !ruby/object:Gem::Version
|
108
102
|
version: '0'
|
103
|
+
name: rubocop
|
109
104
|
prerelease: false
|
110
105
|
type: :development
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: mocha
|
113
106
|
version_requirements: !ruby/object:Gem::Requirement
|
114
107
|
requirements:
|
115
108
|
- - '>='
|
116
109
|
- !ruby/object:Gem::Version
|
117
110
|
version: '0'
|
118
|
-
requirement: !ruby/object:Gem::Requirement
|
119
|
-
requirements:
|
120
|
-
- - '>='
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: '0'
|
123
|
-
prerelease: false
|
124
|
-
type: :development
|
125
111
|
description: Couchbase JRuby driver
|
126
112
|
email:
|
127
113
|
- mike@urlgonomics.com
|
@@ -131,6 +117,7 @@ extra_rdoc_files: []
|
|
131
117
|
files:
|
132
118
|
- .gitignore
|
133
119
|
- .jrubyrc
|
120
|
+
- .rubocop.yml
|
134
121
|
- .ruby-version
|
135
122
|
- .travis.yml
|
136
123
|
- Gemfile
|
@@ -139,76 +126,28 @@ files:
|
|
139
126
|
- Rakefile
|
140
127
|
- couchbase-jruby-client.gemspec
|
141
128
|
- lib/couchbase.rb
|
142
|
-
- lib/couchbase/async.rb
|
143
|
-
- lib/couchbase/async/callback.rb
|
144
|
-
- lib/couchbase/async/queue.rb
|
145
129
|
- lib/couchbase/bucket.rb
|
146
130
|
- lib/couchbase/cluster.rb
|
147
|
-
- lib/couchbase/
|
131
|
+
- lib/couchbase/configuration.rb
|
148
132
|
- lib/couchbase/design_doc.rb
|
133
|
+
- lib/couchbase/document.rb
|
149
134
|
- lib/couchbase/error.rb
|
150
135
|
- lib/couchbase/operations.rb
|
151
|
-
- lib/couchbase/operations/arithmetic.rb
|
152
|
-
- lib/couchbase/operations/delete.rb
|
153
|
-
- lib/couchbase/operations/design_docs.rb
|
154
|
-
- lib/couchbase/operations/fetch.rb
|
155
|
-
- lib/couchbase/operations/get.rb
|
156
|
-
- lib/couchbase/operations/stats.rb
|
157
|
-
- lib/couchbase/operations/store.rb
|
158
|
-
- lib/couchbase/operations/touch.rb
|
159
|
-
- lib/couchbase/operations/unlock.rb
|
160
|
-
- lib/couchbase/operations/utils.rb
|
161
|
-
- lib/couchbase/query.rb
|
162
|
-
- lib/couchbase/result.rb
|
163
|
-
- lib/couchbase/transcoder.rb
|
164
|
-
- lib/couchbase/utils.rb
|
165
136
|
- lib/couchbase/version.rb
|
166
137
|
- lib/couchbase/view.rb
|
167
|
-
- lib/couchbase
|
168
|
-
- lib/jars/
|
169
|
-
- lib/jars/
|
170
|
-
- lib/jars/
|
171
|
-
-
|
172
|
-
- lib/jars/httpcore-4.3.1.jar
|
173
|
-
- lib/jars/httpcore-nio-4.3.1.jar
|
174
|
-
- lib/jars/jettison-1.1.jar
|
175
|
-
- lib/jars/netty-3.5.5.Final.jar
|
176
|
-
- lib/jars/spymemcached-2.10.5-javadoc.jar
|
177
|
-
- lib/jars/spymemcached-2.10.5-sources.jar
|
178
|
-
- lib/jars/spymemcached-2.10.5.jar
|
179
|
-
- tasks/benchmark.rake
|
180
|
-
- tasks/test.rake
|
181
|
-
- tasks/util.rake
|
182
|
-
- test/mock.rb
|
183
|
-
- test/profile/.gitignore
|
184
|
-
- test/profile/.jrubyrc
|
185
|
-
- test/profile/Gemfile
|
186
|
-
- test/profile/benchmark.rb
|
187
|
-
- test/profile/profile.rb
|
188
|
-
- test/setup.rb
|
189
|
-
- test/test_arithmetic.rb
|
190
|
-
- test/test_async.rb
|
138
|
+
- lib/jars/couchbase-core-io-1.1.4.jar
|
139
|
+
- lib/jars/couchbase-java-client-2.1.4.jar
|
140
|
+
- lib/jars/rxjava-1.0.8.jar
|
141
|
+
- lib/jars/rxjruby-0.0.1.jar
|
142
|
+
- test/helper.rb
|
191
143
|
- test/test_bucket.rb
|
192
|
-
- test/test_cas.rb
|
193
144
|
- test/test_cluster.rb
|
145
|
+
- test/test_configuration.rb
|
194
146
|
- test/test_couchbase.rb
|
195
|
-
- test/
|
196
|
-
- test/
|
197
|
-
- test/
|
198
|
-
- test/test_errors.rb
|
199
|
-
- test/test_fetch.rb
|
200
|
-
- test/test_format.rb
|
201
|
-
- test/test_get.rb
|
202
|
-
- test/test_query.rb
|
203
|
-
- test/test_result.rb
|
204
|
-
- test/test_stats.rb
|
205
|
-
- test/test_store.rb
|
206
|
-
- test/test_touch.rb
|
207
|
-
- test/test_unlock.rb
|
208
|
-
- test/test_utils.rb
|
209
|
-
- test/test_version.rb
|
147
|
+
- test/test_design_doc.rb
|
148
|
+
- test/test_document.rb
|
149
|
+
- test/test_operations.rb
|
210
150
|
- test/test_view.rb
|
211
|
-
- test/test_view_row.rb
|
212
151
|
homepage: https://github.com/mje113/couchbase-jruby-client
|
213
152
|
licenses:
|
214
153
|
- Apache
|
@@ -229,38 +168,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
168
|
version: '0'
|
230
169
|
requirements: []
|
231
170
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.4.8
|
233
172
|
signing_key:
|
234
173
|
specification_version: 4
|
235
174
|
summary: The unofficial jruby client library for use with Couchbase Server.
|
236
175
|
test_files:
|
237
|
-
- test/
|
238
|
-
- test/profile/.gitignore
|
239
|
-
- test/profile/.jrubyrc
|
240
|
-
- test/profile/Gemfile
|
241
|
-
- test/profile/benchmark.rb
|
242
|
-
- test/profile/profile.rb
|
243
|
-
- test/setup.rb
|
244
|
-
- test/test_arithmetic.rb
|
245
|
-
- test/test_async.rb
|
176
|
+
- test/helper.rb
|
246
177
|
- test/test_bucket.rb
|
247
|
-
- test/test_cas.rb
|
248
178
|
- test/test_cluster.rb
|
179
|
+
- test/test_configuration.rb
|
249
180
|
- test/test_couchbase.rb
|
250
|
-
- test/
|
251
|
-
- test/
|
252
|
-
- test/
|
253
|
-
- test/test_errors.rb
|
254
|
-
- test/test_fetch.rb
|
255
|
-
- test/test_format.rb
|
256
|
-
- test/test_get.rb
|
257
|
-
- test/test_query.rb
|
258
|
-
- test/test_result.rb
|
259
|
-
- test/test_stats.rb
|
260
|
-
- test/test_store.rb
|
261
|
-
- test/test_touch.rb
|
262
|
-
- test/test_unlock.rb
|
263
|
-
- test/test_utils.rb
|
264
|
-
- test/test_version.rb
|
181
|
+
- test/test_design_doc.rb
|
182
|
+
- test/test_document.rb
|
183
|
+
- test/test_operations.rb
|
265
184
|
- test/test_view.rb
|
266
|
-
- test/test_view_row.rb
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# Author:: Mike Evans <mike@urlgonomics.com>
|
2
|
-
# Copyright:: 2013 Urlgonomics LLC.
|
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
|
-
module Couchbase
|
19
|
-
module Async
|
20
|
-
class Callback
|
21
|
-
include Java::NetSpyMemcachedInternal::OperationCompletionListener
|
22
|
-
include Java::NetSpyMemcachedInternal::GetCompletionListener
|
23
|
-
|
24
|
-
def initialize(params, &callback)
|
25
|
-
@params = params
|
26
|
-
@callback = callback
|
27
|
-
end
|
28
|
-
|
29
|
-
def onComplete(future)
|
30
|
-
result = Couchbase::Result.new(@params.merge(future: future))
|
31
|
-
@callback.call(result)
|
32
|
-
rescue Exception => e
|
33
|
-
result.error = e
|
34
|
-
return result
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Couchbase
|
2
|
-
module Async
|
3
|
-
class Queue
|
4
|
-
|
5
|
-
def initialize(bucket)
|
6
|
-
@bucket = bucket
|
7
|
-
@futures = []
|
8
|
-
end
|
9
|
-
|
10
|
-
def add_future(future, options, &block)
|
11
|
-
@futures << [ future, options, block ]
|
12
|
-
end
|
13
|
-
|
14
|
-
def join
|
15
|
-
while future = @futures.pop
|
16
|
-
begin
|
17
|
-
future, options, callback = future
|
18
|
-
future.get
|
19
|
-
result = Couchbase::Result.new({ bucket: @bucket, future: future }.merge(options))
|
20
|
-
callback.call(result) unless callback.nil?
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/lib/couchbase/async.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# Author:: Mike Evans <mike@urlgonomics.com>
|
2
|
-
# Copyright:: 2013 Urlgonomics LLC.
|
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 'couchbase/async/callback'
|
19
|
-
require 'couchbase/async/queue'
|
20
|
-
|
21
|
-
module Couchbase
|
22
|
-
module Async
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def register_future(future, params, &block)
|
27
|
-
callback = Callback.new(params, &block)
|
28
|
-
future.addListener(callback)
|
29
|
-
future
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/lib/couchbase/constants.rb
DELETED
@@ -1,29 +0,0 @@
|
|
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
|
-
module Couchbase
|
19
|
-
module Constants # :nodoc:
|
20
|
-
S_ID = 'id'.freeze
|
21
|
-
S_DOC = 'doc'.freeze
|
22
|
-
S_VALUE = 'value'.freeze
|
23
|
-
S_META = 'meta'.freeze
|
24
|
-
S_FLAGS = 'flags'.freeze
|
25
|
-
S_CAS = 'cas'.freeze
|
26
|
-
S_KEY = 'key'.freeze
|
27
|
-
S_IS_LAST = Object.new.freeze
|
28
|
-
end
|
29
|
-
end
|