riak-client 0.8.3 → 0.9.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +10 -3
- data/lib/riak/bucket.rb +31 -46
- data/lib/riak/client.rb +18 -4
- data/lib/riak/client/excon_backend.rb +15 -1
- data/lib/riak/client/http_backend.rb +169 -196
- data/lib/riak/client/http_backend/configuration.rb +56 -0
- data/lib/riak/client/http_backend/object_methods.rb +101 -0
- data/lib/riak/client/http_backend/request_headers.rb +46 -0
- data/lib/riak/client/http_backend/transport_methods.rb +208 -0
- data/lib/riak/core_ext/blank.rb +14 -2
- data/lib/riak/link.rb +9 -4
- data/lib/riak/locale/en.yml +2 -0
- data/lib/riak/map_reduce.rb +37 -103
- data/lib/riak/map_reduce/filter_builder.rb +106 -0
- data/lib/riak/map_reduce/phase.rb +108 -0
- data/lib/riak/robject.rb +19 -96
- data/lib/riak/util/escape.rb +7 -0
- data/riak-client.gemspec +5 -5
- data/spec/riak/bucket_spec.rb +57 -111
- data/spec/riak/client_spec.rb +97 -78
- data/spec/riak/escape_spec.rb +7 -0
- data/spec/riak/http_backend/object_methods_spec.rb +218 -0
- data/spec/riak/http_backend_spec.rb +204 -65
- data/spec/riak/link_spec.rb +8 -0
- data/spec/riak/map_reduce_spec.rb +26 -151
- data/spec/riak/object_spec.rb +36 -350
- data/spec/riak/search_spec.rb +5 -16
- data/spec/spec_helper.rb +1 -1
- metadata +29 -8
data/spec/riak/search_spec.rb
CHANGED
@@ -24,6 +24,7 @@ describe "Search mixins" do
|
|
24
24
|
@http = mock(Riak::Client::HTTPBackend)
|
25
25
|
@client.stub!(:http).and_return(@http)
|
26
26
|
end
|
27
|
+
|
27
28
|
describe "searching" do
|
28
29
|
it "should exclude the index from the URL when not specified" do
|
29
30
|
@http.should_receive(:get).with(200, "/solr", "select", hash_including("q" => "foo"), {}).and_return({:code => 200, :headers => {"content-type"=>["application/json"]}, :body => "{}"})
|
@@ -77,6 +78,7 @@ describe "Search mixins" do
|
|
77
78
|
@client.index({'id' => 1, 'field' => "value"}, {'id' => 2, 'foo' => "bar"})
|
78
79
|
end
|
79
80
|
end
|
81
|
+
|
80
82
|
describe "removing documents" do
|
81
83
|
it "should exclude the index from the URL when not specified" do
|
82
84
|
@http.should_receive(:post).with(200, "/solr","update", anything, anything).and_return({:code => 200, :headers => {'content-type' => ['text/html']}, :body => ""})
|
@@ -119,32 +121,19 @@ describe "Search mixins" do
|
|
119
121
|
@bucket = Riak::Bucket.new(@client, "foo")
|
120
122
|
end
|
121
123
|
|
122
|
-
def
|
123
|
-
@bucket.
|
124
|
-
:body => '{"props":{"name":"foo","n_val":3,"allow_mult":false,"last_write_wins":false,"precommit":[],"postcommit":[],"chash_keyfun":{"mod":"riak_core_util","fun":"chash_std_keyfun"},"linkfun":{"mod":"riak_kv_wm_link_walker","fun":"mapreduce_linkfun"},"old_vclock":86400,"young_vclock":20,"big_vclock":50,"small_vclock":10,"r":"quorum","w":"quorum","dw":"quorum","rw":"quorum"},"keys":["bar"]}',
|
125
|
-
:headers => {
|
126
|
-
"vary" => ["Accept-Encoding"],
|
127
|
-
"server" => ["MochiWeb/1.1 WebMachine/1.5.1 (hack the charles gibson)"],
|
128
|
-
"link" => ['</riak/foo/bar>; riaktag="contained"'],
|
129
|
-
"date" => ["Tue, 12 Jan 2010 15:30:43 GMT"],
|
130
|
-
"content-type" => ["application/json"],
|
131
|
-
"content-length" => ["257"]
|
132
|
-
}
|
133
|
-
}.merge(overrides))
|
124
|
+
def load_without_index_hook
|
125
|
+
@bucket.instance_variable_set(:@props, {"precommit" => []})
|
134
126
|
end
|
135
|
-
alias :load_without_index_hook :do_load
|
136
127
|
|
137
128
|
def load_with_index_hook
|
138
|
-
|
129
|
+
@bucket.instance_variable_set(:@props, {"precommit" => [{"mod" => "riak_search_kv_hook", "fun" => "precommit"}]})
|
139
130
|
end
|
140
131
|
|
141
132
|
it "should detect whether the indexing hook is installed" do
|
142
133
|
load_without_index_hook
|
143
|
-
@bucket.props['precommit'].should be_empty
|
144
134
|
@bucket.is_indexed?.should be_false
|
145
135
|
|
146
136
|
load_with_index_hook
|
147
|
-
@bucket.props['precommit'].should_not be_empty
|
148
137
|
@bucket.is_indexed?.should be_true
|
149
138
|
end
|
150
139
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riak-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 31098121
|
5
|
+
prerelease: true
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
|
8
|
+
- 9
|
9
|
+
- 0
|
10
|
+
- beta
|
11
|
+
version: 0.9.0.beta
|
10
12
|
platform: ruby
|
11
13
|
authors:
|
12
14
|
- Sean Cribbs
|
@@ -14,7 +16,7 @@ autorequire:
|
|
14
16
|
bindir: bin
|
15
17
|
cert_chain: []
|
16
18
|
|
17
|
-
date: 2010-12-
|
19
|
+
date: 2010-12-29 00:00:00 -06:00
|
18
20
|
default_executable:
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
@@ -25,6 +27,7 @@ dependencies:
|
|
25
27
|
requirements:
|
26
28
|
- - ~>
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 15
|
28
31
|
segments:
|
29
32
|
- 2
|
30
33
|
- 0
|
@@ -40,6 +43,7 @@ dependencies:
|
|
40
43
|
requirements:
|
41
44
|
- - ">="
|
42
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 11
|
43
47
|
segments:
|
44
48
|
- 1
|
45
49
|
- 2
|
@@ -54,6 +58,7 @@ dependencies:
|
|
54
58
|
requirements:
|
55
59
|
- - ">="
|
56
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 15
|
57
62
|
segments:
|
58
63
|
- 1
|
59
64
|
- 0
|
@@ -68,6 +73,7 @@ dependencies:
|
|
68
73
|
requirements:
|
69
74
|
- - ">="
|
70
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 7
|
71
77
|
segments:
|
72
78
|
- 0
|
73
79
|
- 6
|
@@ -82,6 +88,7 @@ dependencies:
|
|
82
88
|
requirements:
|
83
89
|
- - ~>
|
84
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 27
|
85
92
|
segments:
|
86
93
|
- 0
|
87
94
|
- 3
|
@@ -97,6 +104,7 @@ dependencies:
|
|
97
104
|
requirements:
|
98
105
|
- - ">="
|
99
106
|
- !ruby/object:Gem::Version
|
107
|
+
hash: 15
|
100
108
|
segments:
|
101
109
|
- 0
|
102
110
|
- 4
|
@@ -112,6 +120,7 @@ dependencies:
|
|
112
120
|
requirements:
|
113
121
|
- - ~>
|
114
122
|
- !ruby/object:Gem::Version
|
123
|
+
hash: 15
|
115
124
|
segments:
|
116
125
|
- 2
|
117
126
|
- 1
|
@@ -136,6 +145,10 @@ files:
|
|
136
145
|
- lib/riak/cache_store.rb
|
137
146
|
- lib/riak/client/curb_backend.rb
|
138
147
|
- lib/riak/client/excon_backend.rb
|
148
|
+
- lib/riak/client/http_backend/configuration.rb
|
149
|
+
- lib/riak/client/http_backend/object_methods.rb
|
150
|
+
- lib/riak/client/http_backend/request_headers.rb
|
151
|
+
- lib/riak/client/http_backend/transport_methods.rb
|
139
152
|
- lib/riak/client/http_backend.rb
|
140
153
|
- lib/riak/client/net_http_backend.rb
|
141
154
|
- lib/riak/client.rb
|
@@ -151,6 +164,8 @@ files:
|
|
151
164
|
- lib/riak/invalid_response.rb
|
152
165
|
- lib/riak/link.rb
|
153
166
|
- lib/riak/locale/en.yml
|
167
|
+
- lib/riak/map_reduce/filter_builder.rb
|
168
|
+
- lib/riak/map_reduce/phase.rb
|
154
169
|
- lib/riak/map_reduce.rb
|
155
170
|
- lib/riak/map_reduce_error.rb
|
156
171
|
- lib/riak/robject.rb
|
@@ -177,6 +192,7 @@ files:
|
|
177
192
|
- spec/riak/escape_spec.rb
|
178
193
|
- spec/riak/excon_backend_spec.rb
|
179
194
|
- spec/riak/headers_spec.rb
|
195
|
+
- spec/riak/http_backend/object_methods_spec.rb
|
180
196
|
- spec/riak/http_backend_spec.rb
|
181
197
|
- spec/riak/link_spec.rb
|
182
198
|
- spec/riak/map_reduce_spec.rb
|
@@ -205,17 +221,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
221
|
requirements:
|
206
222
|
- - ">="
|
207
223
|
- !ruby/object:Gem::Version
|
224
|
+
hash: 3
|
208
225
|
segments:
|
209
226
|
- 0
|
210
227
|
version: "0"
|
211
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
229
|
none: false
|
213
230
|
requirements:
|
214
|
-
- - "
|
231
|
+
- - ">"
|
215
232
|
- !ruby/object:Gem::Version
|
233
|
+
hash: 25
|
216
234
|
segments:
|
217
|
-
-
|
218
|
-
|
235
|
+
- 1
|
236
|
+
- 3
|
237
|
+
- 1
|
238
|
+
version: 1.3.1
|
219
239
|
requirements: []
|
220
240
|
|
221
241
|
rubyforge_project:
|
@@ -233,6 +253,7 @@ test_files:
|
|
233
253
|
- spec/riak/escape_spec.rb
|
234
254
|
- spec/riak/excon_backend_spec.rb
|
235
255
|
- spec/riak/headers_spec.rb
|
256
|
+
- spec/riak/http_backend/object_methods_spec.rb
|
236
257
|
- spec/riak/http_backend_spec.rb
|
237
258
|
- spec/riak/link_spec.rb
|
238
259
|
- spec/riak/map_reduce_spec.rb
|