riak-client 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +55 -12
  3. data/RELEASE_NOTES.md +20 -1
  4. data/lib/riak.rb +1 -0
  5. data/lib/riak/client.rb +2 -1
  6. data/lib/riak/client/beefcake/crdt/counter_loader.rb +18 -0
  7. data/lib/riak/client/beefcake/crdt/map_loader.rb +64 -0
  8. data/lib/riak/client/beefcake/crdt/set_loader.rb +18 -0
  9. data/lib/riak/client/beefcake/crdt_loader.rb +16 -59
  10. data/lib/riak/client/beefcake/crdt_operator.rb +2 -1
  11. data/lib/riak/client/instrumentation.rb +19 -0
  12. data/lib/riak/crdt/base.rb +16 -0
  13. data/lib/riak/errors/backend_creation.rb +9 -0
  14. data/lib/riak/instrumentation.rb +6 -0
  15. data/lib/riak/version.rb +1 -1
  16. data/riak-client.gemspec +3 -2
  17. data/spec/integration/riak/counters_spec.rb +1 -1
  18. data/spec/integration/riak/crdt_spec.rb +68 -23
  19. data/spec/integration/riak/protobuffs_backends_spec.rb +1 -1
  20. data/spec/integration/riak/threading_spec.rb +4 -4
  21. data/spec/integration/yokozuna/index_spec.rb +5 -5
  22. data/spec/integration/yokozuna/queries_spec.rb +15 -16
  23. data/spec/integration/yokozuna/schema_spec.rb +2 -2
  24. data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +8 -8
  25. data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +1 -1
  26. data/spec/riak/beefcake_protobuffs_backend_spec.rb +8 -8
  27. data/spec/riak/bucket_spec.rb +38 -38
  28. data/spec/riak/client_spec.rb +26 -27
  29. data/spec/riak/core_ext/to_param_spec.rb +2 -2
  30. data/spec/riak/counter_spec.rb +11 -11
  31. data/spec/riak/crdt/counter_spec.rb +4 -2
  32. data/spec/riak/crdt/inner_counter_spec.rb +1 -1
  33. data/spec/riak/crdt/inner_flag_spec.rb +4 -4
  34. data/spec/riak/crdt/inner_map_spec.rb +3 -3
  35. data/spec/riak/crdt/inner_register_spec.rb +5 -5
  36. data/spec/riak/crdt/inner_set_spec.rb +1 -1
  37. data/spec/riak/crdt/map_spec.rb +2 -2
  38. data/spec/riak/crdt/set_spec.rb +4 -2
  39. data/spec/riak/crdt/shared_examples.rb +15 -15
  40. data/spec/riak/crdt/typed_collection_spec.rb +16 -22
  41. data/spec/riak/escape_spec.rb +10 -10
  42. data/spec/riak/feature_detection_spec.rb +1 -1
  43. data/spec/riak/index_collection_spec.rb +7 -4
  44. data/spec/riak/instrumentation_spec.rb +124 -0
  45. data/spec/riak/link_spec.rb +12 -12
  46. data/spec/riak/list_buckets_spec.rb +2 -2
  47. data/spec/riak/map_reduce/filter_builder_spec.rb +5 -5
  48. data/spec/riak/map_reduce/phase_spec.rb +20 -20
  49. data/spec/riak/map_reduce_spec.rb +50 -50
  50. data/spec/riak/multiget_spec.rb +5 -5
  51. data/spec/riak/node_spec.rb +3 -3
  52. data/spec/riak/robject_spec.rb +46 -45
  53. data/spec/riak/search_spec.rb +11 -11
  54. data/spec/riak/secondary_index_spec.rb +9 -9
  55. data/spec/riak/stamp_spec.rb +5 -5
  56. data/spec/riak/walk_spec_spec.rb +30 -30
  57. data/spec/spec_helper.rb +6 -0
  58. data/spec/support/certs/ca.crt +19 -20
  59. data/spec/support/certs/client.crl +13 -0
  60. data/spec/support/certs/client.crt +68 -69
  61. data/spec/support/certs/client.csr +18 -0
  62. data/spec/support/certs/client.key +25 -25
  63. data/spec/support/certs/server.crl +11 -11
  64. data/spec/support/certs/server.crt +68 -69
  65. data/spec/support/certs/server.key +25 -25
  66. data/spec/support/unified_backend_examples.rb +33 -33
  67. metadata +31 -5
@@ -1,6 +1,6 @@
1
1
  shared_examples_for "Unified backend API" do
2
2
  # ping
3
- it "should ping the server" do
3
+ it "pings the server" do
4
4
  expect(@backend.ping).to be_truthy
5
5
  end
6
6
 
@@ -28,14 +28,14 @@ shared_examples_for "Unified backend API" do
28
28
  @backend.store_object(@robject)
29
29
  end
30
30
 
31
- it "should find a stored object" do
31
+ it "finds a stored object" do
32
32
  robj = @backend.fetch_object(@bucket.name, "fetch")
33
33
  expect(robj).to be_kind_of(Riak::RObject)
34
34
  expect(robj.data).to eq({ "test" => "pass" })
35
35
  expect(robj.links).to be_a Set
36
36
  end
37
37
 
38
- it "should raise an error when the object is not found" do
38
+ it "raises an error when the object is not found" do
39
39
  begin
40
40
  @backend.fetch_object(@bucket.name, "notfound")
41
41
  rescue Riak::FailedRequest => exception
@@ -46,13 +46,13 @@ shared_examples_for "Unified backend API" do
46
46
  end
47
47
 
48
48
  [1,2,3,:one,:quorum,:all,:default].each do |q|
49
- it "should accept a R value of #{q.inspect} for the request" do
49
+ it "accepts a R value of #{q.inspect} for the request" do
50
50
  robj = @backend.fetch_object(@bucket.name, "fetch", :r => q)
51
51
  expect(robj).to be_kind_of(Riak::RObject)
52
52
  expect(robj.data).to eq({ "test" => "pass" })
53
53
  end
54
54
 
55
- it "should accept a PR value of #{q.inspect} for the request" do
55
+ it "accepts a PR value of #{q.inspect} for the request" do
56
56
  robj = @backend.fetch_object(@bucket.name, "fetch", :pr => q)
57
57
  expect(robj).to be_kind_of(Riak::RObject)
58
58
  expect(robj.data).to eq({ "test" => "pass" })
@@ -78,16 +78,16 @@ shared_examples_for "Unified backend API" do
78
78
  @backend.store_object(@robject2, :returnbody => true)
79
79
  end
80
80
 
81
- it "should modify the object with the reloaded data" do
81
+ it "modifies the object with the reloaded data" do
82
82
  @backend.reload_object(@robject)
83
83
  end
84
84
 
85
85
  [1,2,3,:one,:quorum,:all,:default].each do |q|
86
- it "should accept a valid R value of #{q.inspect} for the request" do
86
+ it "accepts a valid R value of #{q.inspect} for the request" do
87
87
  @backend.reload_object(@robject, :r => q)
88
88
  end
89
89
 
90
- it "should accept a valid PR value of #{q.inspect} for the request" do
90
+ it "accepts a valid PR value of #{q.inspect} for the request" do
91
91
  @backend.reload_object(@robject, :pr => q)
92
92
  end
93
93
  end
@@ -108,31 +108,31 @@ shared_examples_for "Unified backend API" do
108
108
  @robject.data = {"test" => "pass"}
109
109
  end
110
110
 
111
- it "should save the object" do
111
+ it "saves the object" do
112
112
  @backend.store_object(@robject)
113
113
  end
114
114
 
115
- it "should modify the object with the returned data if returnbody" do
115
+ it "modifies the object with the returned data if returnbody" do
116
116
  @backend.store_object(@robject, :returnbody => true)
117
117
  expect(@robject.vclock).to be_present
118
118
  end
119
119
 
120
120
  [1,2,3,:one,:quorum,:all,:default].each do |q|
121
- it "should accept a W value of #{q.inspect} for the request" do
121
+ it "accepts a W value of #{q.inspect} for the request" do
122
122
  @backend.store_object(@robject, :returnbody => false, :w => q)
123
123
  expect(@bucket.exists?(@robject.key)).to be_truthy
124
124
  end
125
125
 
126
- it "should accept a DW value of #{q.inspect} for the request" do
126
+ it "accepts a DW value of #{q.inspect} for the request" do
127
127
  @backend.store_object(@robject, :returnbody => false, :w => :all, :dw => q)
128
128
  end
129
129
 
130
- it "should accept a PW value of #{q.inspect} for the request" do
130
+ it "accepts a PW value of #{q.inspect} for the request" do
131
131
  @backend.store_object(@robject, :returnbody => false, :pw => q)
132
132
  end
133
133
  end
134
134
 
135
- it "should store an object with indexes" do
135
+ it "stores an object with indexes" do
136
136
  @robject.indexes['foo_bin'] << 'bar'
137
137
  @backend.store_object(@robject, :returnbody => true)
138
138
  expect(@robject.indexes).to include('foo_bin')
@@ -153,18 +153,18 @@ shared_examples_for "Unified backend API" do
153
153
  @backend.store_object(@obj)
154
154
  end
155
155
 
156
- it "should remove the object" do
156
+ it "removes the object" do
157
157
  @backend.delete_object("test", "delete")
158
158
  expect(@obj.bucket.exists?("delete")).to be_falsey
159
159
  end
160
160
 
161
161
  [1,2,3,:one,:quorum,:all,:default].each do |q|
162
- it "should accept an RW value of #{q.inspect} for the request" do
162
+ it "accepts an RW value of #{q.inspect} for the request" do
163
163
  @backend.delete_object("test", "delete", :rw => q)
164
164
  end
165
165
  end
166
166
 
167
- it "should accept a vclock value for the request" do
167
+ it "accepts a vclock value for the request" do
168
168
  @backend.delete_object("test", "delete", :vclock => @obj.vclock)
169
169
  end
170
170
 
@@ -175,7 +175,7 @@ shared_examples_for "Unified backend API" do
175
175
 
176
176
  # get_bucket_props
177
177
  context "fetching bucket properties" do
178
- it "should fetch a hash of bucket properties" do
178
+ it "fetches a hash of bucket properties" do
179
179
  props = @backend.get_bucket_props("test")
180
180
  expect(props).to be_kind_of(Hash)
181
181
  expect(props).to include("n_val")
@@ -184,7 +184,7 @@ shared_examples_for "Unified backend API" do
184
184
 
185
185
  # set_bucket_props
186
186
  context "setting bucket properties" do
187
- it "should store properties for the bucket" do
187
+ it "stores properties for the bucket" do
188
188
  @backend.set_bucket_props("test", {"n_val" => 3})
189
189
  expect(@backend.get_bucket_props("test")["n_val"]).to eq(3)
190
190
  end
@@ -200,12 +200,12 @@ shared_examples_for "Unified backend API" do
200
200
  @backend.store_object(obj)
201
201
  end
202
202
 
203
- it "should fetch an array of string keys" do
203
+ it "fetches an array of string keys" do
204
204
  expect(@backend.list_keys(@list_bucket)).to eq(["keys"])
205
205
  end
206
206
 
207
207
  context "streaming through a block" do
208
- it "should handle a large number of keys" do
208
+ it "handles a large number of keys" do
209
209
  obj = Riak::RObject.new(@list_bucket)
210
210
  obj.content_type = "application/json"
211
211
  obj.data = [1]
@@ -218,13 +218,13 @@ shared_examples_for "Unified backend API" do
218
218
  end
219
219
  end
220
220
 
221
- it "should pass an array of keys to the block" do
221
+ it "passes an array of keys to the block" do
222
222
  @backend.list_keys(@list_bucket) do |keys|
223
223
  expect(keys).to eq(["keys"]) unless keys.empty?
224
224
  end
225
225
  end
226
226
 
227
- it "should allow requests issued inside the block to execute" do
227
+ it "allows requests issued inside the block to execute" do
228
228
  errors = []
229
229
  @backend.list_keys(@list_bucket) do |keys|
230
230
  keys.each do |key|
@@ -249,7 +249,7 @@ shared_examples_for "Unified backend API" do
249
249
  @backend.store_object(obj)
250
250
  end
251
251
 
252
- it "should fetch a list of string bucket names" do
252
+ it "fetches a list of string bucket names" do
253
253
  list = @backend.list_buckets
254
254
  expect(list).to be_kind_of(Array)
255
255
  expect(list).to include("test")
@@ -268,15 +268,15 @@ shared_examples_for "Unified backend API" do
268
268
  end
269
269
  end
270
270
 
271
- it "should find keys for an equality query" do
271
+ it "finds keys for an equality query" do
272
272
  expect(@backend.get_index('test', 'index_int', 20)).to eq(["20"])
273
273
  end
274
274
 
275
- it "should find keys for a range query" do
275
+ it "finds keys for a range query" do
276
276
  expect(@backend.get_index('test', 'index_int', 19..21)).to match_array(["19","20", "21"])
277
277
  end
278
278
 
279
- it "should return an empty array for a query that does not match any keys" do
279
+ it "returns an empty array for a query that does not match any keys" do
280
280
  expect(@backend.get_index('test', 'index_int', 10000)).to eq([])
281
281
  end
282
282
  end
@@ -294,27 +294,27 @@ shared_examples_for "Unified backend API" do
294
294
  map("Riak.mapValuesJson", :keep => true)
295
295
  end
296
296
 
297
- it "should not raise an error without phases" do
297
+ it "doesn't raise an error without phases" do
298
298
  @mapred.query.clear
299
299
  @backend.mapred(@mapred)
300
300
  end
301
301
 
302
- it "should perform a simple MapReduce request" do
302
+ it "performs a simple MapReduce request" do
303
303
  expect(@backend.mapred(@mapred)).to eq([{"value" => "1"}])
304
304
  end
305
305
 
306
- it "should return an ordered array of results when multiple phases are kept" do
306
+ it "returns an ordered array of results when multiple phases are kept" do
307
307
  @mapred.reduce("function(objects){ return objects; }", :keep => true)
308
308
  expect(@backend.mapred(@mapred)).to eq([[{"value" => "1"}], [{"value" => "1"}]])
309
309
  end
310
310
 
311
- it "should not remove empty phase results when multiple phases are kept" do
311
+ it "doesn't remove empty phase results when multiple phases are kept" do
312
312
  @mapred.reduce("function(){ return []; }", :keep => true)
313
313
  expect(@backend.mapred(@mapred)).to eq([[{"value" => "1"}], []])
314
314
  end
315
315
 
316
316
  context "streaming results through a block" do
317
- it "should pass phase number and result to the block" do
317
+ it "passes phase number and result to the block" do
318
318
  @backend.mapred(@mapred) do |phase, result|
319
319
  unless result.empty?
320
320
  expect(phase).to eq(0)
@@ -323,7 +323,7 @@ shared_examples_for "Unified backend API" do
323
323
  end
324
324
  end
325
325
 
326
- it "should allow requests issued inside the block to execute" do
326
+ it "allows requests issued inside the block to execute" do
327
327
  errors = []
328
328
  @backend.mapred(@mapred) do |phase, result|
329
329
  unless result.empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riak-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Cribbs
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-05 00:00:00.000000000 Z
12
+ date: 2014-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 3.0.0
20
+ version: '3.0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 3.0.0
27
+ version: '3.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -81,6 +81,20 @@ dependencies:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: 0.8.2
84
+ - !ruby/object:Gem::Dependency
85
+ name: instrumentable
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: 1.1.0
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 1.1.0
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: i18n
86
100
  requirement: !ruby/object:Gem::Requirement
@@ -173,6 +187,9 @@ files:
173
187
  - lib/riak.rb
174
188
  - lib/riak/bucket.rb
175
189
  - lib/riak/client.rb
190
+ - lib/riak/client/beefcake/crdt/counter_loader.rb
191
+ - lib/riak/client/beefcake/crdt/map_loader.rb
192
+ - lib/riak/client/beefcake/crdt/set_loader.rb
176
193
  - lib/riak/client/beefcake/crdt_loader.rb
177
194
  - lib/riak/client/beefcake/crdt_operator.rb
178
195
  - lib/riak/client/beefcake/footer
@@ -186,6 +203,7 @@ files:
186
203
  - lib/riak/client/beefcake_protobuffs_backend.rb
187
204
  - lib/riak/client/decaying.rb
188
205
  - lib/riak/client/feature_detection.rb
206
+ - lib/riak/client/instrumentation.rb
189
207
  - lib/riak/client/node.rb
190
208
  - lib/riak/client/protobuffs_backend.rb
191
209
  - lib/riak/client/search.rb
@@ -216,6 +234,7 @@ files:
216
234
  - lib/riak/crdt/set.rb
217
235
  - lib/riak/crdt/typed_collection.rb
218
236
  - lib/riak/encoding.rb
237
+ - lib/riak/errors/backend_creation.rb
219
238
  - lib/riak/errors/base.rb
220
239
  - lib/riak/errors/connection_error.rb
221
240
  - lib/riak/errors/crdt_error.rb
@@ -223,6 +242,7 @@ files:
223
242
  - lib/riak/errors/protobuffs_error.rb
224
243
  - lib/riak/i18n.rb
225
244
  - lib/riak/index_collection.rb
245
+ - lib/riak/instrumentation.rb
226
246
  - lib/riak/json.rb
227
247
  - lib/riak/link.rb
228
248
  - lib/riak/list_buckets.rb
@@ -291,6 +311,7 @@ files:
291
311
  - spec/riak/escape_spec.rb
292
312
  - spec/riak/feature_detection_spec.rb
293
313
  - spec/riak/index_collection_spec.rb
314
+ - spec/riak/instrumentation_spec.rb
294
315
  - spec/riak/link_spec.rb
295
316
  - spec/riak/list_buckets_spec.rb
296
317
  - spec/riak/map_reduce/filter_builder_spec.rb
@@ -307,7 +328,9 @@ files:
307
328
  - spec/spec_helper.rb
308
329
  - spec/support/certs/README.md
309
330
  - spec/support/certs/ca.crt
331
+ - spec/support/certs/client.crl
310
332
  - spec/support/certs/client.crt
333
+ - spec/support/certs/client.csr
311
334
  - spec/support/certs/client.key
312
335
  - spec/support/certs/empty_ca.crt
313
336
  - spec/support/certs/server.crl
@@ -341,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
341
364
  version: '0'
342
365
  requirements: []
343
366
  rubyforge_project:
344
- rubygems_version: 2.3.0
367
+ rubygems_version: 2.2.2
345
368
  signing_key:
346
369
  specification_version: 4
347
370
  summary: riak-client is a rich client for Riak, the distributed database by Basho.
@@ -392,6 +415,7 @@ test_files:
392
415
  - spec/riak/escape_spec.rb
393
416
  - spec/riak/feature_detection_spec.rb
394
417
  - spec/riak/index_collection_spec.rb
418
+ - spec/riak/instrumentation_spec.rb
395
419
  - spec/riak/link_spec.rb
396
420
  - spec/riak/list_buckets_spec.rb
397
421
  - spec/riak/map_reduce/filter_builder_spec.rb
@@ -408,7 +432,9 @@ test_files:
408
432
  - spec/spec_helper.rb
409
433
  - spec/support/certs/README.md
410
434
  - spec/support/certs/ca.crt
435
+ - spec/support/certs/client.crl
411
436
  - spec/support/certs/client.crt
437
+ - spec/support/certs/client.csr
412
438
  - spec/support/certs/client.key
413
439
  - spec/support/certs/empty_ca.crt
414
440
  - spec/support/certs/server.crl