riak-client 1.4.5 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile +0 -1
- data/{LICENSE → LICENSE.md} +0 -0
- data/README.markdown +211 -66
- data/RELEASE_NOTES.md +22 -47
- data/Rakefile +45 -0
- data/lib/riak.rb +1 -1
- data/lib/riak/bucket.rb +2 -2
- data/lib/riak/client.rb +22 -195
- data/lib/riak/client/beefcake/crdt_loader.rb +127 -0
- data/lib/riak/client/beefcake/crdt_operator.rb +222 -0
- data/lib/riak/client/beefcake/footer +4 -0
- data/lib/riak/client/beefcake/header +6 -0
- data/lib/riak/client/beefcake/message_codes.rb +29 -0
- data/lib/riak/client/beefcake/message_overlay.rb +61 -0
- data/lib/riak/client/beefcake/messages.rb +733 -371
- data/lib/riak/client/beefcake/object_methods.rb +1 -1
- data/lib/riak/client/beefcake/protocol.rb +105 -0
- data/lib/riak/client/beefcake/socket.rb +243 -0
- data/lib/riak/client/beefcake_protobuffs_backend.rb +262 -122
- data/lib/riak/client/node.rb +4 -75
- data/lib/riak/client/protobuffs_backend.rb +6 -14
- data/lib/riak/client/search.rb +0 -64
- data/lib/riak/client/yokozuna.rb +52 -0
- data/lib/riak/counter.rb +1 -1
- data/lib/riak/crdt.rb +21 -0
- data/lib/riak/crdt/base.rb +97 -0
- data/lib/riak/crdt/batch_counter.rb +19 -0
- data/lib/riak/crdt/batch_map.rb +41 -0
- data/lib/riak/crdt/counter.rb +71 -0
- data/lib/riak/crdt/inner_counter.rb +74 -0
- data/lib/riak/crdt/inner_flag.rb +42 -0
- data/lib/riak/crdt/inner_map.rb +53 -0
- data/lib/riak/crdt/inner_register.rb +26 -0
- data/lib/riak/crdt/inner_set.rb +95 -0
- data/lib/riak/crdt/map.rb +88 -0
- data/lib/riak/crdt/operation.rb +19 -0
- data/lib/riak/crdt/set.rb +156 -0
- data/lib/riak/crdt/typed_collection.rb +131 -0
- data/lib/riak/errors/base.rb +9 -0
- data/lib/riak/errors/connection_error.rb +44 -0
- data/lib/riak/errors/crdt_error.rb +18 -0
- data/lib/riak/errors/failed_request.rb +56 -0
- data/lib/riak/errors/protobuffs_error.rb +11 -0
- data/lib/riak/i18n.rb +2 -0
- data/lib/riak/json.rb +1 -1
- data/lib/riak/locale/en.yml +26 -1
- data/lib/riak/locale/fr.yml +0 -1
- data/lib/riak/map_reduce.rb +1 -1
- data/lib/riak/map_reduce/results.rb +1 -1
- data/lib/riak/multiget.rb +1 -2
- data/lib/riak/rcontent.rb +8 -3
- data/lib/riak/robject.rb +2 -8
- data/lib/riak/secondary_index.rb +4 -4
- data/lib/riak/serializers.rb +1 -1
- data/lib/riak/util/escape.rb +3 -5
- data/lib/riak/version.rb +1 -1
- data/lib/riak/walk_spec.rb +7 -3
- data/riak-client.gemspec +10 -8
- data/spec/fixtures/bitcask.txt +25 -0
- data/spec/integration/riak/bucket_types_spec.rb +61 -0
- data/spec/integration/riak/counters_spec.rb +17 -32
- data/spec/integration/riak/crdt_spec.rb +181 -0
- data/spec/integration/riak/crdt_validation/map_spec.rb +63 -0
- data/spec/integration/riak/crdt_validation/set_spec.rb +122 -0
- data/spec/integration/riak/protobuffs_backends_spec.rb +9 -26
- data/spec/integration/riak/security_spec.rb +94 -0
- data/spec/integration/riak/threading_spec.rb +24 -67
- data/spec/integration/yokozuna/index_spec.rb +61 -0
- data/spec/integration/yokozuna/queries_spec.rb +116 -0
- data/spec/integration/yokozuna/schema_spec.rb +49 -0
- data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +222 -0
- data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +4 -4
- data/spec/riak/beefcake_protobuffs_backend/protocol_spec.rb +189 -0
- data/spec/riak/beefcake_protobuffs_backend/socket_spec.rb +151 -0
- data/spec/riak/beefcake_protobuffs_backend_spec.rb +68 -106
- data/spec/riak/bucket_spec.rb +81 -77
- data/spec/riak/client_spec.rb +43 -340
- data/spec/riak/core_ext/to_param_spec.rb +2 -2
- data/spec/riak/counter_spec.rb +20 -20
- data/spec/riak/crdt/counter_spec.rb +52 -0
- data/spec/riak/crdt/inner_counter_spec.rb +21 -0
- data/spec/riak/crdt/inner_flag_spec.rb +39 -0
- data/spec/riak/crdt/inner_map_spec.rb +47 -0
- data/spec/riak/crdt/inner_register_spec.rb +40 -0
- data/spec/riak/crdt/inner_set_spec.rb +33 -0
- data/spec/riak/crdt/map_spec.rb +77 -0
- data/spec/riak/crdt/set_spec.rb +58 -0
- data/spec/riak/crdt/shared_examples.rb +74 -0
- data/spec/riak/crdt/typed_collection_spec.rb +231 -0
- data/spec/riak/escape_spec.rb +33 -37
- data/spec/riak/feature_detection_spec.rb +45 -45
- data/spec/riak/index_collection_spec.rb +12 -12
- data/spec/riak/link_spec.rb +34 -34
- data/spec/riak/list_buckets_spec.rb +7 -7
- data/spec/riak/map_reduce/filter_builder_spec.rb +6 -6
- data/spec/riak/map_reduce/phase_spec.rb +35 -35
- data/spec/riak/map_reduce_spec.rb +89 -87
- data/spec/riak/multiget_spec.rb +20 -15
- data/spec/riak/node_spec.rb +5 -152
- data/spec/riak/robject_spec.rb +95 -108
- data/spec/riak/search_spec.rb +17 -139
- data/spec/riak/secondary_index_spec.rb +49 -49
- data/spec/riak/serializers_spec.rb +9 -9
- data/spec/riak/stamp_spec.rb +9 -9
- data/spec/riak/walk_spec_spec.rb +46 -46
- data/spec/spec_helper.rb +14 -22
- data/spec/support/certs/README.md +13 -0
- data/spec/support/certs/ca.crt +22 -0
- data/spec/support/certs/client.crt +95 -0
- data/spec/support/certs/client.key +27 -0
- data/spec/support/certs/empty_ca.crt +21 -0
- data/spec/support/certs/server.crl +13 -0
- data/spec/support/certs/server.crt +95 -0
- data/spec/support/certs/server.key +27 -0
- data/spec/support/integration_setup.rb +1 -1
- data/spec/support/search_corpus_setup.rb +29 -8
- data/spec/support/test_client.rb +46 -0
- data/spec/support/test_client.yml.example +10 -0
- data/spec/support/unified_backend_examples.rb +104 -83
- data/spec/support/version_filter.rb +2 -2
- data/spec/support/wait_until.rb +14 -0
- metadata +134 -132
- data/erl_src/riak_kv_test014_backend.beam +0 -0
- data/erl_src/riak_kv_test014_backend.erl +0 -189
- data/erl_src/riak_kv_test_backend.beam +0 -0
- data/erl_src/riak_kv_test_backend.erl +0 -731
- data/erl_src/riak_search_test_backend.beam +0 -0
- data/erl_src/riak_search_test_backend.erl +0 -175
- data/lib/riak/client/excon_backend.rb +0 -172
- data/lib/riak/client/http_backend.rb +0 -413
- data/lib/riak/client/http_backend/bucket_streamer.rb +0 -15
- data/lib/riak/client/http_backend/chunked_json_streamer.rb +0 -42
- data/lib/riak/client/http_backend/configuration.rb +0 -227
- data/lib/riak/client/http_backend/key_streamer.rb +0 -15
- data/lib/riak/client/http_backend/object_methods.rb +0 -114
- data/lib/riak/client/http_backend/request_headers.rb +0 -34
- data/lib/riak/client/http_backend/transport_methods.rb +0 -201
- data/lib/riak/client/instrumentation.rb +0 -25
- data/lib/riak/client/net_http_backend.rb +0 -82
- data/lib/riak/cluster.rb +0 -151
- data/lib/riak/failed_request.rb +0 -81
- data/lib/riak/instrumentation.rb +0 -6
- data/lib/riak/node.rb +0 -40
- data/lib/riak/node/configuration.rb +0 -304
- data/lib/riak/node/console.rb +0 -133
- data/lib/riak/node/control.rb +0 -207
- data/lib/riak/node/defaults.rb +0 -85
- data/lib/riak/node/generation.rb +0 -127
- data/lib/riak/node/log.rb +0 -34
- data/lib/riak/node/version.rb +0 -29
- data/lib/riak/search.rb +0 -3
- data/lib/riak/test_server.rb +0 -89
- data/lib/riak/util/headers.rb +0 -32
- data/lib/riak/util/multipart.rb +0 -52
- data/lib/riak/util/multipart/stream_parser.rb +0 -62
- data/spec/fixtures/munchausen.txt +0 -1033
- data/spec/integration/riak/cluster_spec.rb +0 -88
- data/spec/integration/riak/http_backends_spec.rb +0 -180
- data/spec/integration/riak/node_spec.rb +0 -170
- data/spec/integration/riak/test_server_spec.rb +0 -57
- data/spec/riak/excon_backend_spec.rb +0 -102
- data/spec/riak/headers_spec.rb +0 -21
- data/spec/riak/http_backend/configuration_spec.rb +0 -273
- data/spec/riak/http_backend/object_methods_spec.rb +0 -243
- data/spec/riak/http_backend/transport_methods_spec.rb +0 -97
- data/spec/riak/http_backend_spec.rb +0 -367
- data/spec/riak/instrumentation_spec.rb +0 -167
- data/spec/riak/multipart_spec.rb +0 -23
- data/spec/riak/net_http_backend_spec.rb +0 -15
- data/spec/riak/stream_parser_spec.rb +0 -53
- data/spec/support/drb_mock_server.rb +0 -39
- data/spec/support/http_backend_implementation_examples.rb +0 -253
- data/spec/support/mock_server.rb +0 -81
- data/spec/support/mocks.rb +0 -4
- data/spec/support/riak_test.rb +0 -77
- data/spec/support/sometimes.rb +0 -46
- data/spec/support/test_server.rb +0 -61
- data/spec/support/test_server.yml.example +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc9b9f7497052c55bb844b4d367c34845e57ec5a
|
4
|
+
data.tar.gz: a40f43dc918e9f24a8cdfa52eee55eac6abe6cc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d38360e5a71d50a8038fd18117c1e1bd4b525869d8e6f1215b85aa9ba7c22e3069ff795cbfac2bac6156f348feb48cd7951e32e1a0718511e40aa0d809dfd89
|
7
|
+
data.tar.gz: b0c5415b028c0d009cdca47c9c4ee620130ff60d4b320240a4a5593c343b232488c576f20b3602aff9b8dcf5256884de039d9dda8939ded6071b8d9a87c1dfea
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/{LICENSE → LICENSE.md}
RENAMED
File without changes
|
data/README.markdown
CHANGED
@@ -7,13 +7,14 @@ and map-reduce.
|
|
7
7
|
|
8
8
|
## Dependencies
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
Ruby 1.9.3, 2.0, and 2.1 are supported. JRuby in 1.9 and 2.0 modes are
|
11
|
+
also supported. `riak-client` is not compatible with Ruby 1.8.
|
12
|
+
|
13
|
+
`riak-client` requires i18n, builder, beefcake, and multi_json. The
|
12
14
|
cache store implementation requires ActiveSupport 3 or later.
|
13
15
|
|
14
16
|
Development dependencies are handled with bundler. Install bundler
|
15
|
-
(`gem install bundler`) and run this command
|
16
|
-
get started:
|
17
|
+
(`gem install bundler`) and run this command to get started:
|
17
18
|
|
18
19
|
``` bash
|
19
20
|
$ bundle install
|
@@ -33,17 +34,30 @@ require 'riak'
|
|
33
34
|
# Create a client interface
|
34
35
|
client = Riak::Client.new
|
35
36
|
|
36
|
-
# Create a client
|
37
|
-
client = Riak::Client.new(:
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
# Create a client that uses secure Protocol Buffers
|
38
|
+
client = Riak::Client.new(authentication: {
|
39
|
+
# certificate authority to validate the server cert
|
40
|
+
ca_file: '/home/zedo/ca.crt',
|
41
|
+
|
42
|
+
# username, required
|
43
|
+
user: 'zedo',
|
44
|
+
|
45
|
+
# password for password-based authentication
|
46
|
+
password: 'catnip',
|
47
|
+
|
48
|
+
# client-cert authentication parameters support filenames,
|
49
|
+
# OpenSSL-compatible string data, or properly initialized
|
50
|
+
# OpenSSL objects
|
51
|
+
client_ca: '/home/zedo/ca.crt',
|
52
|
+
cert: File.read '/home/zedo/zedo.crt',
|
53
|
+
key: OpenSSL::PKey::RSA.new(File.read '/home/zedo/zedo.key')
|
54
|
+
})
|
41
55
|
|
42
56
|
# Automatically balance between multiple nodes
|
43
57
|
client = Riak::Client.new(:nodes => [
|
44
58
|
{:host => '10.0.0.1'},
|
45
59
|
{:host => '10.0.0.2', :pb_port => 1234},
|
46
|
-
{:host => '10.0.0.3', :
|
60
|
+
{:host => '10.0.0.3', :pb_port => 5678}
|
47
61
|
])
|
48
62
|
|
49
63
|
# Retrieve a bucket
|
@@ -71,6 +85,36 @@ new_one.raw_data = "alert('Hello, World!')"
|
|
71
85
|
new_one.store
|
72
86
|
```
|
73
87
|
|
88
|
+
## Bucket Types
|
89
|
+
|
90
|
+
Riak 2 uses [bucket types](http://docs.basho.com/riak/2.0.0pre11/dev/advanced/bucket-types/) to
|
91
|
+
enable groups of similar buckets to share properties, configuration, and to namespace values
|
92
|
+
within those buckets. Bucket type support is integral to how CRDTs work.
|
93
|
+
|
94
|
+
Many operations take `type` options to perform them with a specific bucket type.
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
# This example assumes you have a "beverages" bucket type.
|
98
|
+
|
99
|
+
coffees = client.bucket 'coffees'
|
100
|
+
|
101
|
+
chapadao = coffees.new 'chapadao'
|
102
|
+
chapadao.data = "Chapadao de Ferro"
|
103
|
+
chapadao.store type: 'beverages' # stores this in the "beverages" bucket type
|
104
|
+
|
105
|
+
coffees.get 'chapadao' # raises error, not found
|
106
|
+
coffees.get 'chapadao', type: 'beverages' # succeeds
|
107
|
+
|
108
|
+
chapadao.reload # raises error, not found
|
109
|
+
chapadao.reload type: 'beverages' # succeeds
|
110
|
+
|
111
|
+
chapadao.delete # silently fails to delete it
|
112
|
+
coffees.delete 'chapadao' # silently fails to delete it
|
113
|
+
|
114
|
+
chapadao.delete type: 'beverages' # deletes it
|
115
|
+
coffees.delete 'chapadao', type: 'beverages' # deletes it
|
116
|
+
```
|
117
|
+
|
74
118
|
## Map-Reduce Example
|
75
119
|
|
76
120
|
``` ruby
|
@@ -80,9 +124,9 @@ results = Riak::MapReduce.new(client).
|
|
80
124
|
link(:bucket => "albums").
|
81
125
|
map("function(v){ return [JSON.parse(v.values[0].data).title]; }", :keep => true).run
|
82
126
|
|
83
|
-
p results # => ["Please Please Me", "With The Beatles", "A Hard Day's Night",
|
127
|
+
p results # => ["Please Please Me", "With The Beatles", "A Hard Day's Night",
|
84
128
|
# "Beatles For Sale", "Help!", "Rubber Soul",
|
85
|
-
# "Revolver", "Sgt. Pepper's Lonely Hearts Club Band", "Magical Mystery Tour",
|
129
|
+
# "Revolver", "Sgt. Pepper's Lonely Hearts Club Band", "Magical Mystery Tour",
|
86
130
|
# "The Beatles", "Yellow Submarine", "Abbey Road", "Let It Be"]
|
87
131
|
```
|
88
132
|
|
@@ -137,7 +181,7 @@ client['users'].disable_index!
|
|
137
181
|
|
138
182
|
## Secondary Index Examples
|
139
183
|
|
140
|
-
Riak supports secondary indexes. Secondary indexing, or "2i," gives you the
|
184
|
+
Riak supports secondary indexes. Secondary indexing, or "2i," gives you the
|
141
185
|
ability to tag objects with multiple queryable values at write time, and then
|
142
186
|
query them later.
|
143
187
|
|
@@ -152,7 +196,7 @@ storage logic is in `lib/riak/rcontent.rb`.
|
|
152
196
|
```ruby
|
153
197
|
object = bucket.get_or_new 'cobb.salad'
|
154
198
|
|
155
|
-
# Indexes end with the "_bin" suffix to indicate they're binary or string
|
199
|
+
# Indexes end with the "_bin" suffix to indicate they're binary or string
|
156
200
|
# indexes. They can have multiple values.
|
157
201
|
object.indexes['ingredients_bin'] = %w{lettuce tomato bacon egg chives}
|
158
202
|
|
@@ -166,7 +210,7 @@ object.store
|
|
166
210
|
|
167
211
|
### Finding Objects
|
168
212
|
|
169
|
-
Secondary index queries return a list of keys exactly matching a scalar or
|
213
|
+
Secondary index queries return a list of keys exactly matching a scalar or
|
170
214
|
within a range.
|
171
215
|
|
172
216
|
```ruby
|
@@ -201,7 +245,157 @@ q.has_next_page? # => true
|
|
201
245
|
q2 = q.next_page
|
202
246
|
```
|
203
247
|
|
204
|
-
##
|
248
|
+
## Riak 2 Data Types
|
249
|
+
|
250
|
+
Riak 2 features new distributed data structures: counters, sets, and maps
|
251
|
+
(containing counters, flags, maps, registers, and sets). These are implemented
|
252
|
+
by the Riak database as Convergent Replicated Data Types.
|
253
|
+
|
254
|
+
Riak data type support requires bucket types to be configured to support each
|
255
|
+
top-level data type. If you're just playing around, use the
|
256
|
+
[Riak Ruby Vagrant](https://github.com/basho-labs/riak-ruby-vagrant) setup to
|
257
|
+
get started with the appropriate configuration and bucket types quickly.
|
258
|
+
|
259
|
+
The examples below presume that the appropriate bucket types are named
|
260
|
+
`counters`, `maps`, and `sets`; these bucket type names are the client's defaults.
|
261
|
+
Viewing and changing the defaults is easy:
|
262
|
+
|
263
|
+
```ruby
|
264
|
+
Riak::Crdt::DEFAULT_BUCKET_TYPES[:set] #=> "sets"
|
265
|
+
|
266
|
+
Riak::Crdt::DEFAULT_BUCKET_TYPES[:set] = "a_cooler_set"
|
267
|
+
```
|
268
|
+
|
269
|
+
The top-level CRDT types have both immediate and batch mode. If you're doing
|
270
|
+
multiple writes to a single top-level counter or set, or updating multiple map
|
271
|
+
entries, batch mode will make fewer round-trips to Riak.
|
272
|
+
|
273
|
+
Top-level CRDT types accept `nil` as a key. This allows Riak to assign a random
|
274
|
+
key for them.
|
275
|
+
|
276
|
+
Deleting CRDTs requires you to use the key-value API for the time being.
|
277
|
+
|
278
|
+
```ruby
|
279
|
+
brews = Riak::Crdt::Set.new bucket, 'brews'
|
280
|
+
brews.add 'espresso'
|
281
|
+
brews.add 'aeropress'
|
282
|
+
|
283
|
+
bucket.delete brews.key, type: brews.bucket_type
|
284
|
+
```
|
285
|
+
|
286
|
+
|
287
|
+
### Counters
|
288
|
+
|
289
|
+
Riak 2 integer counters have one operation: increment by an integer.
|
290
|
+
|
291
|
+
```ruby
|
292
|
+
counter = Riak::Crdt::Counter.new bucket, key
|
293
|
+
|
294
|
+
counter.value #=> 15
|
295
|
+
|
296
|
+
counter.increment
|
297
|
+
|
298
|
+
counter.value #=> 16
|
299
|
+
|
300
|
+
counter.increment 3
|
301
|
+
|
302
|
+
counter.value #=> 19
|
303
|
+
|
304
|
+
counter.decrement
|
305
|
+
|
306
|
+
counter.value #=> 18
|
307
|
+
```
|
308
|
+
|
309
|
+
Counter operations can be batched:
|
310
|
+
|
311
|
+
```ruby
|
312
|
+
counter.batch do |c|
|
313
|
+
c.increment
|
314
|
+
c.increment 5
|
315
|
+
end
|
316
|
+
```
|
317
|
+
|
318
|
+
### Maps
|
319
|
+
|
320
|
+
Riak 2 maps can contain counters, flags (booleans), registers (strings), sets, and
|
321
|
+
other maps.
|
322
|
+
|
323
|
+
Maps are similar but distinct from the standard Ruby `Hash`. Entries are
|
324
|
+
segregated by both name and type, so you can have counters, registers, and sets inside a map that all have the same name.
|
325
|
+
|
326
|
+
```ruby
|
327
|
+
map = Riak::Crdt::Map.new bucket, key
|
328
|
+
|
329
|
+
map.counters['potatoes'].value #=> 5
|
330
|
+
map.sets['potatoes'].include? 'yukon gold' #=> true
|
331
|
+
|
332
|
+
map.sets['cacti'].value #=> #<Set: {"saguaro", "prickly pear", "fishhook"}>
|
333
|
+
map.sets['cacti'].remove 'prickly pear'
|
334
|
+
|
335
|
+
map.registers['favorite butterfly'] = 'the mighty monarch'
|
336
|
+
|
337
|
+
map.flags['pet cat'] = true
|
338
|
+
|
339
|
+
map.maps['atlantis'].registers['location'] #=> 'kennedy space center'
|
340
|
+
|
341
|
+
map.counters.delete 'thermometers'
|
342
|
+
```
|
343
|
+
|
344
|
+
Maps are a prime candidate for batched operations:
|
345
|
+
|
346
|
+
```ruby
|
347
|
+
map.batch do |m|
|
348
|
+
m.counters['hits'].increment
|
349
|
+
m.sets['followers'].add 'basho_elevator'
|
350
|
+
end
|
351
|
+
```
|
352
|
+
|
353
|
+
Frequently, you might want a map with a Riak-assigned name instead of one you
|
354
|
+
come up with yourself:
|
355
|
+
|
356
|
+
```ruby
|
357
|
+
map = Riak::Crdt::Map.new bucket, nil
|
358
|
+
|
359
|
+
map.registers['coat_pattern'] = 'tabby'
|
360
|
+
|
361
|
+
map.key #=> "2do4NvcurWhXYNQg8HoIR9zedJV"
|
362
|
+
```
|
363
|
+
|
364
|
+
### Sets
|
365
|
+
|
366
|
+
Sets are an unordered collection of entries.
|
367
|
+
|
368
|
+
**PROTIP:** Ruby and Riak Ruby Client both have classes called `Set`. Be careful
|
369
|
+
to refer to the Ruby version as `::Set` and the Riak client version as
|
370
|
+
`Riak::Crdt::Set`.
|
371
|
+
|
372
|
+
```ruby
|
373
|
+
set = Riak::Crdt::Set.new bucket, key
|
374
|
+
|
375
|
+
set.members #=> #<Set: {"Edinburgh", "Leeds", "London"}>
|
376
|
+
|
377
|
+
set.add "Newcastle"
|
378
|
+
set.remove "London"
|
379
|
+
|
380
|
+
set.include? "Leeds" #=> true
|
381
|
+
```
|
382
|
+
|
383
|
+
Sets support batched operations:
|
384
|
+
|
385
|
+
```ruby
|
386
|
+
set.batch do |s|
|
387
|
+
s.add "York"
|
388
|
+
s.add "Aberdeen"
|
389
|
+
s.remove "Newcastle"
|
390
|
+
end
|
391
|
+
```
|
392
|
+
|
393
|
+
### Client Implementation Notes
|
394
|
+
|
395
|
+
The client code for these types is in the `Riak::Crdt` namespace, and mostly
|
396
|
+
in the `lib/riak/crdt` directory.
|
397
|
+
|
398
|
+
## Riak 1.4 Counters
|
205
399
|
|
206
400
|
For more information about counters in Riak, see [the Basho wiki](http://docs.basho.com/riak/latest/dev/references/http/counters/).
|
207
401
|
|
@@ -253,55 +447,6 @@ ArgumentError: Counters can only be incremented or decremented by integers.
|
|
253
447
|
|
254
448
|
That's about it. PN Counters in Riak are distributed, so each node will receive the proper increment/decrement operation. Enjoy using them.
|
255
449
|
|
256
|
-
## Instrumentation
|
257
|
-
|
258
|
-
The Riak client has built-in event hooks for all major over-the-wire operations including:
|
259
|
-
|
260
|
-
* riak.list_buckets
|
261
|
-
* riak.list_keys
|
262
|
-
* riak.set_bucket_props
|
263
|
-
* riak.get_bucket_props
|
264
|
-
* riak.clear_bucket_props
|
265
|
-
* riak.get_index
|
266
|
-
* riak.store_object
|
267
|
-
* riak.get_object
|
268
|
-
* riak.reload_object
|
269
|
-
* riak.delete_object
|
270
|
-
* riak.store_file
|
271
|
-
* riak.get_file
|
272
|
-
* riak.delete_file
|
273
|
-
* riak.file_exists
|
274
|
-
* riak.link_walk
|
275
|
-
* riak.map_reduce
|
276
|
-
* riak.ping
|
277
|
-
|
278
|
-
Events are propogated using [ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html), provided by the [Instrumentable](https://github.com/siyegen/instrumentable) gem.
|
279
|
-
|
280
|
-
### Enabling
|
281
|
-
|
282
|
-
Instrumentation is opt-in. If `instrumentable` is not available, instrumentation will not be available. To turn on instrumentation, simply require the `instrumentable` gem in your app's Gemfile:
|
283
|
-
|
284
|
-
```ruby
|
285
|
-
gem 'instrumentable', '~> 1.1.0'
|
286
|
-
```
|
287
|
-
|
288
|
-
Then, to subscribe to events:
|
289
|
-
|
290
|
-
```ruby
|
291
|
-
ActiveSupport::Notifications.subscribe(/^riak\.*/) do |name, start, finish, id, payload|
|
292
|
-
name # => String, name of the event (such as 'riak.get_object' from above)
|
293
|
-
start # => Time, when the instrumented block started execution
|
294
|
-
finish # => Time, when the instrumented block ended execution
|
295
|
-
id # => String, unique ID for this notification
|
296
|
-
payload # => Hash, the payload
|
297
|
-
end
|
298
|
-
```
|
299
|
-
|
300
|
-
The payload for each event contains the following keys:
|
301
|
-
|
302
|
-
* `:protocol`: The `client.protocol` value of the Riak client
|
303
|
-
* `:client_id`: The client_id of the Riak client
|
304
|
-
* `:_method_args`: The array of method arguments for the instrumented method. For instance, for `riak.get_object`, this value would resemble `[<Riak::Bucket ...>, 'key', {}]`
|
305
450
|
|
306
451
|
## How to Contribute
|
307
452
|
|
@@ -344,5 +489,5 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
344
489
|
|
345
490
|
## Auxillary Licenses
|
346
491
|
|
347
|
-
The included photo (spec/fixtures/cat.jpg) is Copyright ©2009 [Sean Cribbs](http://seancribbs.com/), and is licensed under the [Creative Commons Attribution Non-Commercial 3.0](http://creativecommons.org/licenses/by-nc/3.0) license.
|
492
|
+
The included photo (spec/fixtures/cat.jpg) is Copyright ©2009 [Sean Cribbs](http://seancribbs.com/), and is licensed under the [Creative Commons Attribution Non-Commercial 3.0](http://creativecommons.org/licenses/by-nc/3.0) license.
|
348
493
|
!["Creative Commons"](http://i.creativecommons.org/l/by-nc/3.0/88x31.png)
|
data/RELEASE_NOTES.md
CHANGED
@@ -1,61 +1,39 @@
|
|
1
1
|
# Riak Ruby Client Release Notes
|
2
2
|
|
3
|
-
##
|
3
|
+
## 2.0.0 Release - TBD
|
4
4
|
|
5
|
-
|
5
|
+
Version 2.0.0 is a major new version with many new features, API changes,
|
6
|
+
and feature removals.
|
6
7
|
|
7
|
-
|
8
|
+
New features:
|
8
9
|
|
9
|
-
*
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
* Yokozuna: full-text search built on Solr and powered by Riak.
|
11
|
+
* Riak security: TLS-encrypted and authenticated protocol buffers, access
|
12
|
+
control, and more!
|
13
|
+
* Convergent Replicated Data Types (CRDTs): counters, maps, and sets, all with
|
14
|
+
convenient and safe distributed semantics.
|
15
|
+
* Bucket types: the building blocks of Yokozuna, access control, and CRDTs.
|
13
16
|
|
14
|
-
|
17
|
+
API changes:
|
15
18
|
|
16
|
-
*
|
17
|
-
|
19
|
+
* Exceptions raised by the client are subclasses of `Riak::Error`.
|
20
|
+
* The internals of the Beefcake-based protocol buffers support have been
|
21
|
+
refactored for reliability and maintainability.
|
22
|
+
* The Beefcake version has been bumped to 1.0 for improvements in speed and
|
23
|
+
memory usage.
|
24
|
+
* Tests now use RSpec 3.
|
18
25
|
|
19
|
-
|
20
|
-
|
21
|
-
Release 1.4.4.1 includes the intended 1.4.4 bugfix:
|
22
|
-
|
23
|
-
* Remove freedom-patched `Net::HTTPHeader#each_capitalized` method. This
|
24
|
-
caused infinite loops when parsing HTTP headers not related to Riak,
|
25
|
-
and is not necessary in Riak versions newer than 1.1.0. Thanks to
|
26
|
-
Morten Primdahl and Steven Davidovitz at Zendesk for helping isolate and
|
27
|
-
troubleshoot this.
|
28
|
-
|
29
|
-
## 1.4.4 - 2014-04-17
|
30
|
-
|
31
|
-
No changes from 1.4.3.
|
32
|
-
|
33
|
-
## 1.4.3 Bugfix Release - 2013-12-31
|
34
|
-
|
35
|
-
Release 1.4.3 fixes some bugs and improves documentation.
|
36
|
-
|
37
|
-
Documentation:
|
38
|
-
* Secondary Index examples in README now use string names.
|
39
|
-
* 1.4 Counter usage explained better, fixed by Srdjan "batasrki" Pejic in
|
40
|
-
https://github.com/basho/riak-ruby-client/pull/130
|
41
|
-
|
42
|
-
Bugfixes:
|
43
|
-
|
44
|
-
* Redundant `gem "rake"` in `Gemfile`.
|
45
|
-
* Escape square brackets in key names, reported and fixed by Garret Alfert in
|
46
|
-
https://github.com/basho/riak-ruby-client/issues/128 and
|
47
|
-
https://github.com/basho/riak-ruby-client/pull/129 , respectively.
|
26
|
+
Removed:
|
48
27
|
|
28
|
+
* HTTP support has been removed from the Riak Ruby Client in favor of focusing
|
29
|
+
on Protocol Buffers.
|
30
|
+
* The included test-server has been removed. Tests now require a Riak node to
|
31
|
+
be configured and run independently of the test suite.
|
49
32
|
|
50
33
|
## 1.4.2 Bugfix Release - 2013-09-20
|
51
34
|
|
52
35
|
Release 1.4.2 fixes a couple bugs.
|
53
36
|
|
54
|
-
Issues:
|
55
|
-
|
56
|
-
* Secondary index queries against non-2i-enabled buckets/backends now raise a
|
57
|
-
useful exception.
|
58
|
-
|
59
37
|
Bugfixes:
|
60
38
|
|
61
39
|
* 2i Requests over PBC block forever when 0 results match in 1.4.x,
|
@@ -64,9 +42,6 @@ Bugfixes:
|
|
64
42
|
https://github.com/basho/riak-ruby-client/pull/122
|
65
43
|
* RObject#links is an Array when loaded from PBC, reported by Dan Pisarski in
|
66
44
|
https://github.com/basho/riak-ruby-client/pull/123
|
67
|
-
* Bucket listing doesn't work with HTTP backend,
|
68
|
-
reported and fixed by Wagner Camaro in
|
69
|
-
https://github.com/basho/riak-ruby-client/pull/124
|
70
45
|
|
71
46
|
## 1.4.1 Patch/Bugfix Release - 2013-09-06
|
72
47
|
|