riak-client 2.4.1 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.document +5 -5
- data/.gitignore +3 -0
- data/Gemfile +17 -17
- data/Guardfile +20 -20
- data/LICENSE.md +16 -16
- data/RELNOTES.md +4 -0
- data/Rakefile +6 -1
- data/lib/riak/client/beefcake/crdt/counter_loader.rb +18 -18
- data/lib/riak/client/beefcake/crdt/hyper_log_log_loader.rb +18 -0
- data/lib/riak/client/beefcake/crdt/map_loader.rb +64 -64
- data/lib/riak/client/beefcake/crdt_loader.rb +4 -1
- data/lib/riak/client/beefcake/crdt_operator.rb +13 -0
- data/lib/riak/client/beefcake/footer +4 -4
- data/lib/riak/client/beefcake/header +6 -6
- data/lib/riak/client/beefcake/messages.rb +67 -10
- data/lib/riak/client/decaying.rb +36 -36
- data/lib/riak/client/feature_detection.rb +120 -120
- data/lib/riak/client/instrumentation.rb +19 -19
- data/lib/riak/client/node.rb +49 -49
- data/lib/riak/client/search.rb +27 -27
- data/lib/riak/conflict.rb +13 -13
- data/lib/riak/core_ext.rb +7 -7
- data/lib/riak/core_ext/blank.rb +53 -53
- data/lib/riak/core_ext/extract_options.rb +7 -7
- data/lib/riak/core_ext/json.rb +15 -15
- data/lib/riak/core_ext/slice.rb +18 -18
- data/lib/riak/core_ext/stringify_keys.rb +10 -10
- data/lib/riak/core_ext/symbolize_keys.rb +10 -10
- data/lib/riak/core_ext/to_param.rb +31 -31
- data/lib/riak/crdt.rb +23 -21
- data/lib/riak/crdt/base.rb +1 -1
- data/lib/riak/crdt/hyper_log_log.rb +97 -0
- data/lib/riak/crdt/operation.rb +19 -19
- data/lib/riak/encoding.rb +6 -6
- data/lib/riak/errors/backend_creation.rb +9 -9
- data/lib/riak/errors/connection_error.rb +50 -50
- data/lib/riak/errors/protobuffs_error.rb +11 -11
- data/lib/riak/i18n.rb +7 -7
- data/lib/riak/instrumentation.rb +6 -6
- data/lib/riak/json.rb +52 -52
- data/lib/riak/list_buckets.rb +28 -28
- data/lib/riak/locale/en.yml +1 -0
- data/lib/riak/locale/fr.yml +51 -51
- data/lib/riak/map_reduce/results.rb +49 -49
- data/lib/riak/map_reduce_error.rb +7 -7
- data/lib/riak/multiget.rb +122 -122
- data/lib/riak/robject.rb +17 -1
- data/lib/riak/search/result_document.rb +9 -0
- data/lib/riak/stamp.rb +77 -77
- data/lib/riak/tombstone.rb +13 -0
- data/lib/riak/util/tcp_socket_extensions.rb +58 -58
- data/lib/riak/version.rb +1 -1
- data/spec/failover/failover.rb +59 -59
- data/spec/fixtures/bitcask.txt +25 -25
- data/spec/fixtures/multipart-basic-conflict.txt +15 -15
- data/spec/fixtures/multipart-blank.txt +7 -7
- data/spec/fixtures/multipart-mapreduce.txt +10 -10
- data/spec/fixtures/multipart-with-body.txt +16 -16
- data/spec/fixtures/multipart-with-marked-tombstones.txt +17 -17
- data/spec/fixtures/multipart-with-unmarked-tombstone.txt +16 -16
- data/spec/fixtures/server.cert.crt +15 -15
- data/spec/fixtures/server.cert.key +15 -15
- data/spec/fixtures/test.pem +1 -1
- data/spec/integration/riak/bucket_types_spec.rb +38 -0
- data/spec/integration/riak/crdt/configuration_spec.rb +4 -3
- data/spec/integration/riak/crdt_spec.rb +70 -0
- data/spec/integration/riak/encodings/crdt_spec.rb +29 -3
- data/spec/integration/riak/encodings/yz_spec.rb +2 -1
- data/spec/integration/riak/preflist_spec.rb +15 -3
- data/spec/integration/riak/protobuffs/timeouts_spec.rb +1 -1
- data/spec/integration/riak/security_spec.rb +11 -6
- data/spec/integration/riak/threading_spec.rb +154 -150
- data/spec/integration/yokozuna/index_spec.rb +61 -61
- data/spec/integration/yokozuna/queries_spec.rb +1 -1
- data/spec/integration/yokozuna/schema_spec.rb +49 -49
- data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +22 -0
- data/spec/riak/core_ext/to_param_spec.rb +15 -15
- data/spec/riak/crdt/hyper_log_log_spec.rb +56 -0
- data/spec/riak/crdt/inner_counter_spec.rb +21 -21
- data/spec/riak/crdt/inner_set_spec.rb +33 -33
- data/spec/riak/crdt/set_spec.rb +61 -61
- data/spec/riak/crdt/shared_examples.rb +14 -0
- data/spec/riak/escape_spec.rb +72 -72
- data/spec/riak/feature_detection_spec.rb +77 -77
- data/spec/riak/index_collection_spec.rb +53 -53
- data/spec/riak/instrumentation_spec.rb +124 -124
- data/spec/riak/link_spec.rb +85 -85
- data/spec/riak/list_buckets_spec.rb +41 -41
- data/spec/riak/node_spec.rb +26 -26
- data/spec/riak/robject_spec.rb +45 -0
- data/spec/support/certs/README.md +12 -12
- data/spec/support/certs/ca.crt +21 -21
- data/spec/support/certs/client.crl +13 -13
- data/spec/support/certs/client.crt +94 -94
- data/spec/support/certs/client.csr +18 -18
- data/spec/support/certs/client.key +27 -27
- data/spec/support/certs/empty_ca.crt +21 -21
- data/spec/support/certs/server.crl +13 -13
- data/spec/support/certs/server.crt +94 -94
- data/spec/support/certs/server.key +27 -27
- data/spec/support/crdt_search_fixtures.rb +1 -1
- data/spec/support/integration_setup.rb +10 -10
- data/spec/support/test_client.rb +1 -1
- data/spec/support/test_client.yml.example +10 -10
- metadata +10 -3
data/spec/fixtures/bitcask.txt
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
Bitcask is an Erlang application that provides an API for storing and retrieving key/value data into a log-structured hash table that provides very fast access. The design owes a lot to the principles found in log-structured file systems and draws inspiration from a number of designs that involve log file merging.
|
2
|
-
|
3
|
-
Strengths
|
4
|
-
Low latency per item read or written
|
5
|
-
This is due to the write-once, append-only nature of the Bitcask database files. High throughput, especially when writing an incoming stream of random items Because the data being written doesn't need to be ordered on disk and because the log structured design allows for minimal disk head movement during writes these operations generally saturate the I/O and disk bandwidth.
|
6
|
-
|
7
|
-
Ability to handle datasets larger than RAM w/o degradation
|
8
|
-
Because access to data in Bitcask is direct lookup from an in-memory hash table finding data on disk is very efficient, even when data sets are very large.
|
9
|
-
|
10
|
-
Single Seek to Retrieve Any Value
|
11
|
-
Bitcask's in-memory hash-table of keys point directly to locations on disk where the data lives. Bitcask never uses more than one disk seek to read a value and sometimes, due to file-system caching done by the operating system, even that isn't necessary.
|
12
|
-
|
13
|
-
Predictable Lookup and Insert Performance
|
14
|
-
As you might expect from the description above, read operations have a fixed, predictable behavior. What you might not expect is that this is also true for writes. Write operations are at most a seek to the end of the current file open writing and an append to that file.
|
15
|
-
|
16
|
-
Fast, bounded Crash Recovery
|
17
|
-
Due to the append-only write once nature of Bitcask files, recovery is easy and fast. The only items that might be lost are partially written records at the tail of the file last opened for writes. Recovery need only review the last record or two written and verify CRC data to ensure that the data is consistent.
|
18
|
-
|
19
|
-
Easy Backup
|
20
|
-
In most systems backup can be very complicated but here again Bitcask simplifies this process due to its append-only write once disk format. Any utility that archives or copies files in disk-block order will properly backup or copy a Bitcask database.
|
21
|
-
|
22
|
-
Weakness
|
23
|
-
Keys Must Fit In Memory
|
24
|
-
Bitcask keeps all keys in memory at all times, this means that your system must have enough memory to contain your entire keyspace with room for other operational components and operating system resident filesystem buffer space.
|
25
|
-
|
1
|
+
Bitcask is an Erlang application that provides an API for storing and retrieving key/value data into a log-structured hash table that provides very fast access. The design owes a lot to the principles found in log-structured file systems and draws inspiration from a number of designs that involve log file merging.
|
2
|
+
|
3
|
+
Strengths
|
4
|
+
Low latency per item read or written
|
5
|
+
This is due to the write-once, append-only nature of the Bitcask database files. High throughput, especially when writing an incoming stream of random items Because the data being written doesn't need to be ordered on disk and because the log structured design allows for minimal disk head movement during writes these operations generally saturate the I/O and disk bandwidth.
|
6
|
+
|
7
|
+
Ability to handle datasets larger than RAM w/o degradation
|
8
|
+
Because access to data in Bitcask is direct lookup from an in-memory hash table finding data on disk is very efficient, even when data sets are very large.
|
9
|
+
|
10
|
+
Single Seek to Retrieve Any Value
|
11
|
+
Bitcask's in-memory hash-table of keys point directly to locations on disk where the data lives. Bitcask never uses more than one disk seek to read a value and sometimes, due to file-system caching done by the operating system, even that isn't necessary.
|
12
|
+
|
13
|
+
Predictable Lookup and Insert Performance
|
14
|
+
As you might expect from the description above, read operations have a fixed, predictable behavior. What you might not expect is that this is also true for writes. Write operations are at most a seek to the end of the current file open writing and an append to that file.
|
15
|
+
|
16
|
+
Fast, bounded Crash Recovery
|
17
|
+
Due to the append-only write once nature of Bitcask files, recovery is easy and fast. The only items that might be lost are partially written records at the tail of the file last opened for writes. Recovery need only review the last record or two written and verify CRC data to ensure that the data is consistent.
|
18
|
+
|
19
|
+
Easy Backup
|
20
|
+
In most systems backup can be very complicated but here again Bitcask simplifies this process due to its append-only write once disk format. Any utility that archives or copies files in disk-block order will properly backup or copy a Bitcask database.
|
21
|
+
|
22
|
+
Weakness
|
23
|
+
Keys Must Fit In Memory
|
24
|
+
Bitcask keeps all keys in memory at all times, this means that your system must have enough memory to contain your entire keyspace with room for other operational components and operating system resident filesystem buffer space.
|
25
|
+
|
@@ -1,15 +1,15 @@
|
|
1
|
-
--8XZD3w6ttFTHIz6LCmhVxn9Ex0K
|
2
|
-
Content-Type: text/plain
|
3
|
-
Link: </buckets/test>; rel="up"
|
4
|
-
Etag: 2baUwethOoLrVkwnMqzBRW
|
5
|
-
Last-Modified: Mon, 15 Oct 2012 19:36:06 GMT
|
6
|
-
|
7
|
-
bar
|
8
|
-
--8XZD3w6ttFTHIz6LCmhVxn9Ex0K
|
9
|
-
Content-Type: text/plain
|
10
|
-
Link: </buckets/test>; rel="up"
|
11
|
-
Etag: 6NtlHf8Lc3TEcCTKOVqEkl
|
12
|
-
Last-Modified: Mon, 15 Oct 2012 19:35:57 GMT
|
13
|
-
|
14
|
-
foo
|
15
|
-
--8XZD3w6ttFTHIz6LCmhVxn9Ex0K--
|
1
|
+
--8XZD3w6ttFTHIz6LCmhVxn9Ex0K
|
2
|
+
Content-Type: text/plain
|
3
|
+
Link: </buckets/test>; rel="up"
|
4
|
+
Etag: 2baUwethOoLrVkwnMqzBRW
|
5
|
+
Last-Modified: Mon, 15 Oct 2012 19:36:06 GMT
|
6
|
+
|
7
|
+
bar
|
8
|
+
--8XZD3w6ttFTHIz6LCmhVxn9Ex0K
|
9
|
+
Content-Type: text/plain
|
10
|
+
Link: </buckets/test>; rel="up"
|
11
|
+
Etag: 6NtlHf8Lc3TEcCTKOVqEkl
|
12
|
+
Last-Modified: Mon, 15 Oct 2012 19:35:57 GMT
|
13
|
+
|
14
|
+
foo
|
15
|
+
--8XZD3w6ttFTHIz6LCmhVxn9Ex0K--
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
--73NmmA8dJxSB5nL2dVerpFIi8ze
|
3
|
-
Content-Type: multipart/mixed; boundary=8fPXq9XfV15txMoV1IbA3hovEij
|
4
|
-
|
5
|
-
--8fPXq9XfV15txMoV1IbA3hovEij--
|
6
|
-
|
7
|
-
--73NmmA8dJxSB5nL2dVerpFIi8ze--
|
1
|
+
|
2
|
+
--73NmmA8dJxSB5nL2dVerpFIi8ze
|
3
|
+
Content-Type: multipart/mixed; boundary=8fPXq9XfV15txMoV1IbA3hovEij
|
4
|
+
|
5
|
+
--8fPXq9XfV15txMoV1IbA3hovEij--
|
6
|
+
|
7
|
+
--73NmmA8dJxSB5nL2dVerpFIi8ze--
|
@@ -1,10 +1,10 @@
|
|
1
|
-
|
2
|
-
--NT6cqYFYCfbYZsocVt15tNWCpG9
|
3
|
-
Content-Type: application/json
|
4
|
-
|
5
|
-
{"phase":0,"data":["source :gemcutter\n\ngem 'i18n'\ngem 'builder'\ngem 'rspec', \"~>2.0.0\"\ngem 'fakeweb', \">=1.2\"\ngem 'rack', '>=1.0'\ngem 'rake'\ngem 'bundler'\ngem 'excon', \"~>0.3.4\"\n\nif defined? JRUBY_VERSION\n gem 'json'\n gem 'jruby-openssl'\nelse\n gem 'curb', '>=0.6'\n gem 'yajl-ruby'\nend\n\ngroup :integration do\n gem 'activesupport', '~>3.0'\nend\n"]}
|
6
|
-
--NT6cqYFYCfbYZsocVt15tNWCpG9
|
7
|
-
Content-Type: application/json
|
8
|
-
|
9
|
-
{"phase":0,"data":["source \"http://rubygems.org\"\n\ngem 'rake'\ngem 'gollum-site'\ngem 'rdiscount'\ngem 'RedCloth'\ngem 'rspec'\n"]}
|
10
|
-
--NT6cqYFYCfbYZsocVt15tNWCpG9--
|
1
|
+
|
2
|
+
--NT6cqYFYCfbYZsocVt15tNWCpG9
|
3
|
+
Content-Type: application/json
|
4
|
+
|
5
|
+
{"phase":0,"data":["source :gemcutter\n\ngem 'i18n'\ngem 'builder'\ngem 'rspec', \"~>2.0.0\"\ngem 'fakeweb', \">=1.2\"\ngem 'rack', '>=1.0'\ngem 'rake'\ngem 'bundler'\ngem 'excon', \"~>0.3.4\"\n\nif defined? JRUBY_VERSION\n gem 'json'\n gem 'jruby-openssl'\nelse\n gem 'curb', '>=0.6'\n gem 'yajl-ruby'\nend\n\ngroup :integration do\n gem 'activesupport', '~>3.0'\nend\n"]}
|
6
|
+
--NT6cqYFYCfbYZsocVt15tNWCpG9
|
7
|
+
Content-Type: application/json
|
8
|
+
|
9
|
+
{"phase":0,"data":["source \"http://rubygems.org\"\n\ngem 'rake'\ngem 'gollum-site'\ngem 'rdiscount'\ngem 'RedCloth'\ngem 'rspec'\n"]}
|
10
|
+
--NT6cqYFYCfbYZsocVt15tNWCpG9--
|
@@ -1,16 +1,16 @@
|
|
1
|
-
|
2
|
-
--5EiMOjuGavQ2IbXAqsJPLLfJNlA
|
3
|
-
Content-Type: multipart/mixed; boundary=7extjTzvYIKVMVHowUiTn0LfvSs
|
4
|
-
|
5
|
-
--7extjTzvYIKVMVHowUiTn0LfvSs
|
6
|
-
X-Riak-Vclock: a85hYGBgyWDKBVHMr9s3ZzAlMuaxMtyZcPAIH1RYyObHDqiwxIZjcOG1M98chAq3bUQIz7SSFQEKM4FUbwMKZwEA
|
7
|
-
Location: /riak/foo/baz
|
8
|
-
Content-Type: text/plain
|
9
|
-
Link: </riak/foo>; rel="up"
|
10
|
-
Etag: 6JdI51eFrvv5lDwY6un7a2
|
11
|
-
Last-Modified: Sat, 16 Jan 2010 22:13:44 GMT
|
12
|
-
|
13
|
-
SCP sloooow....
|
14
|
-
--7extjTzvYIKVMVHowUiTn0LfvSs--
|
15
|
-
|
16
|
-
--5EiMOjuGavQ2IbXAqsJPLLfJNlA--
|
1
|
+
|
2
|
+
--5EiMOjuGavQ2IbXAqsJPLLfJNlA
|
3
|
+
Content-Type: multipart/mixed; boundary=7extjTzvYIKVMVHowUiTn0LfvSs
|
4
|
+
|
5
|
+
--7extjTzvYIKVMVHowUiTn0LfvSs
|
6
|
+
X-Riak-Vclock: a85hYGBgyWDKBVHMr9s3ZzAlMuaxMtyZcPAIH1RYyObHDqiwxIZjcOG1M98chAq3bUQIz7SSFQEKM4FUbwMKZwEA
|
7
|
+
Location: /riak/foo/baz
|
8
|
+
Content-Type: text/plain
|
9
|
+
Link: </riak/foo>; rel="up"
|
10
|
+
Etag: 6JdI51eFrvv5lDwY6un7a2
|
11
|
+
Last-Modified: Sat, 16 Jan 2010 22:13:44 GMT
|
12
|
+
|
13
|
+
SCP sloooow....
|
14
|
+
--7extjTzvYIKVMVHowUiTn0LfvSs--
|
15
|
+
|
16
|
+
--5EiMOjuGavQ2IbXAqsJPLLfJNlA--
|
@@ -1,17 +1,17 @@
|
|
1
|
-
|
2
|
-
--ADqgQtdmA5iQgyR5UGzX6V3HZtI
|
3
|
-
Content-Type: multipart/mixed; boundary=Ljz1mP3hZzqPu6DH1Y4L8k7hfxy
|
4
|
-
|
5
|
-
--Ljz1mP3hZzqPu6DH1Y4L8k7hfxy
|
6
|
-
X-Riak-Vclock: a85hYGBgzGDKBVIcypz/fvrNPcuWwZTIlMfKIOotdIIvCwA=
|
7
|
-
Location: /buckets/links/keys/target
|
8
|
-
Content-Type: application/octet-stream
|
9
|
-
Link: </buckets/links>; rel="up"
|
10
|
-
Etag: 5bUNdzHJhZDdCr7KlWxXq
|
11
|
-
Last-Modified: Tue, 18 Oct 2011 19:10:13 GMT
|
12
|
-
X-Riak-Deleted: true
|
13
|
-
|
14
|
-
|
15
|
-
--Ljz1mP3hZzqPu6DH1Y4L8k7hfxy--
|
16
|
-
|
17
|
-
--ADqgQtdmA5iQgyR5UGzX6V3HZtI--
|
1
|
+
|
2
|
+
--ADqgQtdmA5iQgyR5UGzX6V3HZtI
|
3
|
+
Content-Type: multipart/mixed; boundary=Ljz1mP3hZzqPu6DH1Y4L8k7hfxy
|
4
|
+
|
5
|
+
--Ljz1mP3hZzqPu6DH1Y4L8k7hfxy
|
6
|
+
X-Riak-Vclock: a85hYGBgzGDKBVIcypz/fvrNPcuWwZTIlMfKIOotdIIvCwA=
|
7
|
+
Location: /buckets/links/keys/target
|
8
|
+
Content-Type: application/octet-stream
|
9
|
+
Link: </buckets/links>; rel="up"
|
10
|
+
Etag: 5bUNdzHJhZDdCr7KlWxXq
|
11
|
+
Last-Modified: Tue, 18 Oct 2011 19:10:13 GMT
|
12
|
+
X-Riak-Deleted: true
|
13
|
+
|
14
|
+
|
15
|
+
--Ljz1mP3hZzqPu6DH1Y4L8k7hfxy--
|
16
|
+
|
17
|
+
--ADqgQtdmA5iQgyR5UGzX6V3HZtI--
|
@@ -1,16 +1,16 @@
|
|
1
|
-
|
2
|
-
--CvfrSTCWwIiwezy0Zt1B2zwKgS7
|
3
|
-
Content-Type: multipart/mixed; boundary=E9n2ZOKHIazIoPHzXj9XsWYWJjJ
|
4
|
-
|
5
|
-
--E9n2ZOKHIazIoPHzXj9XsWYWJjJ
|
6
|
-
X-Riak-Vclock: a85hYGBgzGDKBVIcypz/fvpN53+WwZTIlMfKcNVJ6ARfFgA=
|
7
|
-
Location: /buckets/links/keys/target
|
8
|
-
Content-Type: application/octet-stream
|
9
|
-
Link: </buckets/links>; rel="up"
|
10
|
-
Etag: 50FOyLo7juvEVUO33MRJwP
|
11
|
-
Last-Modified: Tue, 18 Oct 2011 18:35:01 GMT
|
12
|
-
|
13
|
-
|
14
|
-
--E9n2ZOKHIazIoPHzXj9XsWYWJjJ--
|
15
|
-
|
16
|
-
--CvfrSTCWwIiwezy0Zt1B2zwKgS7--
|
1
|
+
|
2
|
+
--CvfrSTCWwIiwezy0Zt1B2zwKgS7
|
3
|
+
Content-Type: multipart/mixed; boundary=E9n2ZOKHIazIoPHzXj9XsWYWJjJ
|
4
|
+
|
5
|
+
--E9n2ZOKHIazIoPHzXj9XsWYWJjJ
|
6
|
+
X-Riak-Vclock: a85hYGBgzGDKBVIcypz/fvpN53+WwZTIlMfKcNVJ6ARfFgA=
|
7
|
+
Location: /buckets/links/keys/target
|
8
|
+
Content-Type: application/octet-stream
|
9
|
+
Link: </buckets/links>; rel="up"
|
10
|
+
Etag: 50FOyLo7juvEVUO33MRJwP
|
11
|
+
Last-Modified: Tue, 18 Oct 2011 18:35:01 GMT
|
12
|
+
|
13
|
+
|
14
|
+
--E9n2ZOKHIazIoPHzXj9XsWYWJjJ--
|
15
|
+
|
16
|
+
--CvfrSTCWwIiwezy0Zt1B2zwKgS7--
|
@@ -1,15 +1,15 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIICPzCCAagCCQDfZhEdJjSgTDANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJV
|
3
|
-
UzELMAkGA1UECBMCTkMxEjAQBgNVBAcTCUNoYXJsb3R0ZTEOMAwGA1UEChMFQmFz
|
4
|
-
aG8xEDAOBgNVBAsTB1N1cHBvcnQxEjAQBgNVBAMTCTEyNy4wLjAuMTAeFw0xMTAz
|
5
|
-
MjYxNjMzMzNaFw0zODA4MTAxNjMzMzNaMGQxCzAJBgNVBAYTAlVTMQswCQYDVQQI
|
6
|
-
EwJOQzESMBAGA1UEBxMJQ2hhcmxvdHRlMQ4wDAYDVQQKEwVCYXNobzEQMA4GA1UE
|
7
|
-
CxMHU3VwcG9ydDESMBAGA1UEAxMJMTI3LjAuMC4xMIGfMA0GCSqGSIb3DQEBAQUA
|
8
|
-
A4GNADCBiQKBgQCtfHMCsR86HQEAsO52/WvtFWCEigXll0rxYjXvdqeszEPEMFIy
|
9
|
-
Qlg3GlRxH51YrBzp46ReF9Qv5sf0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15yKTy6ADINrOt26PNpD4ib4552TE6T/1wG
|
14
|
+
LKdjn5l0qB5K7ILc22z3LCenNBa0Uxbg5/RSdoX57aHA
|
15
|
+
-----END RSA PRIVATE KEY-----
|
data/spec/fixtures/test.pem
CHANGED
@@ -1 +1 @@
|
|
1
|
-
i-am-a-pem
|
1
|
+
i-am-a-pem
|
@@ -266,5 +266,43 @@ describe 'Bucket Types', test_client: true, integration: true do
|
|
266
266
|
expect{ bucket.get set.key, type: bucket_type }.to raise_error /not_found/
|
267
267
|
end
|
268
268
|
end
|
269
|
+
|
270
|
+
describe 'performing CRDT HLL operations', hll: true do
|
271
|
+
before(:each) do
|
272
|
+
begin
|
273
|
+
hlls = test_client.bucket_type Riak::Crdt::DEFAULT_BUCKET_TYPES[:hll]
|
274
|
+
hlls.properties
|
275
|
+
rescue Riak::ProtobuffsErrorResponse
|
276
|
+
skip('HyperLogLog bucket-type not found or active.')
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
let(:bucket_type){ Riak::Crdt::DEFAULT_BUCKET_TYPES[:hll] }
|
281
|
+
let(:hll) do
|
282
|
+
hyper_log_log = Riak::Crdt::HyperLogLog.new bucket, random_key, bucket_type
|
283
|
+
hyper_log_log.add random_key
|
284
|
+
hyper_log_log
|
285
|
+
end
|
286
|
+
let(:empty_hll) do
|
287
|
+
Riak::Crdt::HyperLogLog.new bucket, random_key, bucket_type
|
288
|
+
end
|
289
|
+
|
290
|
+
it 'defaults to 0 for a new key' do
|
291
|
+
expect(empty_hll.cardinality).to eq 0
|
292
|
+
end
|
293
|
+
|
294
|
+
it 'retrieves the HLL blob via key-value using a bucket type' do
|
295
|
+
expect{ bucket.get hll.key }.to raise_error /not_found/
|
296
|
+
expect(bucket.get hll.key, type: bucket_type).to be
|
297
|
+
end
|
298
|
+
|
299
|
+
it 'deletes the HLL blob through the bucket type' do
|
300
|
+
expect(bucket.delete hll.key).to be
|
301
|
+
expect{ bucket.get hll.key, type: bucket_type }.to_not raise_error
|
302
|
+
|
303
|
+
expect(bucket.delete hll.key, type: bucket_type).to be
|
304
|
+
expect{ bucket.get hll.key, type: bucket_type }.to raise_error /not_found/
|
305
|
+
end
|
306
|
+
end
|
269
307
|
end
|
270
308
|
end
|
@@ -2,16 +2,17 @@ require 'spec_helper'
|
|
2
2
|
require 'riak'
|
3
3
|
|
4
4
|
describe "CRDT configuration", integration: true, test_client: true do
|
5
|
+
SETS = Riak::Crdt::DEFAULT_BUCKET_TYPES[:set]
|
5
6
|
let(:bucket) { random_bucket }
|
6
7
|
|
7
8
|
it "allows default bucket-types to be configured for each data type" do
|
8
|
-
expect(Riak::Crdt::Set.new(bucket, 'set').bucket_type).to eq
|
9
|
+
expect(Riak::Crdt::Set.new(bucket, 'set').bucket_type).to eq SETS
|
9
10
|
|
10
11
|
Riak::Crdt::DEFAULT_BUCKET_TYPES[:set] = 'new_set_default'
|
11
12
|
expect(Riak::Crdt::Set.new(bucket, 'set').bucket_type).to eq 'new_set_default'
|
12
13
|
|
13
|
-
Riak::Crdt::DEFAULT_BUCKET_TYPES[:set] =
|
14
|
-
expect(Riak::Crdt::Set.new(bucket, 'set').bucket_type).to eq
|
14
|
+
Riak::Crdt::DEFAULT_BUCKET_TYPES[:set] = SETS
|
15
|
+
expect(Riak::Crdt::Set.new(bucket, 'set').bucket_type).to eq SETS
|
15
16
|
end
|
16
17
|
|
17
18
|
describe 'overriding bucket-types' do
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'riak'
|
3
|
+
require 'riak/errors/failed_request'
|
3
4
|
|
4
5
|
describe "CRDTs", integration: true, test_client: true do
|
5
6
|
let(:bucket) { random_bucket }
|
@@ -82,6 +83,7 @@ describe "CRDTs", integration: true, test_client: true do
|
|
82
83
|
it { is_expected.to eq similar }
|
83
84
|
end
|
84
85
|
end
|
86
|
+
|
85
87
|
describe 'sets' do
|
86
88
|
|
87
89
|
subject { Riak::Crdt::Set.new bucket, random_key }
|
@@ -259,4 +261,72 @@ describe "CRDTs", integration: true, test_client: true do
|
|
259
261
|
end
|
260
262
|
end
|
261
263
|
end
|
264
|
+
|
265
|
+
describe 'HLLs', hll: true do
|
266
|
+
before(:each) do
|
267
|
+
begin
|
268
|
+
hlls = test_client.bucket_type Riak::Crdt::DEFAULT_BUCKET_TYPES[:hll]
|
269
|
+
hlls.properties
|
270
|
+
rescue Riak::ProtobuffsErrorResponse
|
271
|
+
skip('HyperLogLog bucket-type not found or active.')
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
subject { Riak::Crdt::HyperLogLog.new bucket, random_key }
|
276
|
+
|
277
|
+
it 'allows straightforward HLL ops' do
|
278
|
+
addition = random_key
|
279
|
+
|
280
|
+
subject.add addition
|
281
|
+
|
282
|
+
expect(subject.value).to be_a(Integer)
|
283
|
+
expect(subject.value).to eq 1
|
284
|
+
end
|
285
|
+
|
286
|
+
it 'asks for and accepts a returned body by default' do
|
287
|
+
other = Riak::Crdt::HyperLogLog.new subject.bucket, subject.key
|
288
|
+
|
289
|
+
other.add 'coffee'
|
290
|
+
|
291
|
+
expect(other.value).to be_a(Integer)
|
292
|
+
expect(other.value).to eq 1
|
293
|
+
|
294
|
+
expect(subject.value).to eq 1
|
295
|
+
|
296
|
+
subject.add 'tea'
|
297
|
+
|
298
|
+
expect(subject.value).to be_a(Integer)
|
299
|
+
expect(subject.value).to eq 2
|
300
|
+
|
301
|
+
other.reload
|
302
|
+
expect(other.value).to eq 2
|
303
|
+
|
304
|
+
other.add 'juice'
|
305
|
+
|
306
|
+
expect(other.value).to be_a(Integer)
|
307
|
+
expect(other.value).to eq 3
|
308
|
+
|
309
|
+
# repeat input to verify the HLL value doesn't increment
|
310
|
+
other.add 'juice'
|
311
|
+
|
312
|
+
expect(other.value).to be_a(Integer)
|
313
|
+
expect(other.value).to eq 3
|
314
|
+
|
315
|
+
expect(subject.dirty?).to_not be
|
316
|
+
end
|
317
|
+
|
318
|
+
it 'allows batched HLL ops' do
|
319
|
+
subject.add 'zero'
|
320
|
+
subject.reload
|
321
|
+
|
322
|
+
subject.batch do |s|
|
323
|
+
s.add 'first'
|
324
|
+
s.add 'second'
|
325
|
+
s.add 'second'
|
326
|
+
end
|
327
|
+
|
328
|
+
expect(subject.value).to be_a(Integer)
|
329
|
+
expect(subject.value).to eq 3
|
330
|
+
end
|
331
|
+
end
|
262
332
|
end
|
@@ -6,13 +6,16 @@ require 'riak/util/string'
|
|
6
6
|
describe 'Encoding and CRDTs', integration: true, search_config: true do
|
7
7
|
shared_examples 'CRDTs with weird names' do
|
8
8
|
let(:counter_bucket) do
|
9
|
-
test_client.bucket_type(
|
9
|
+
test_client.bucket_type(Riak::Crdt::DEFAULT_BUCKET_TYPES[:counter]).bucket(random_string)
|
10
10
|
end
|
11
11
|
let(:map_bucket) do
|
12
|
-
test_client.bucket_type(
|
12
|
+
test_client.bucket_type(Riak::Crdt::DEFAULT_BUCKET_TYPES[:map]).bucket(random_string)
|
13
13
|
end
|
14
14
|
let(:set_bucket) do
|
15
|
-
test_client.bucket_type(
|
15
|
+
test_client.bucket_type(Riak::Crdt::DEFAULT_BUCKET_TYPES[:set]).bucket(random_string)
|
16
|
+
end
|
17
|
+
let(:hll_bucket) do
|
18
|
+
test_client.bucket_type(Riak::Crdt::DEFAULT_BUCKET_TYPES[:hll]).bucket(random_string)
|
16
19
|
end
|
17
20
|
|
18
21
|
it 'creates counters' do
|
@@ -76,6 +79,29 @@ describe 'Encoding and CRDTs', integration: true, search_config: true do
|
|
76
79
|
|
77
80
|
expect(random_string.encoding.name).to eq expected_encoding
|
78
81
|
end
|
82
|
+
|
83
|
+
it 'updates hyper_log_logs', hll: true do
|
84
|
+
begin
|
85
|
+
hlls = test_client.bucket_type Riak::Crdt::DEFAULT_BUCKET_TYPES[:hll]
|
86
|
+
hlls.properties
|
87
|
+
rescue Riak::ProtobuffsErrorResponse
|
88
|
+
skip('HyperLogLog bucket-type not found or active.')
|
89
|
+
end
|
90
|
+
|
91
|
+
hll = nil
|
92
|
+
|
93
|
+
expect(random_string.encoding.name).to eq expected_encoding
|
94
|
+
|
95
|
+
expect{ hll = Riak::Crdt::HyperLogLog.new hll_bucket, random_string }.to_not raise_error
|
96
|
+
expect(hll).to be_a Riak::Crdt::HyperLogLog
|
97
|
+
|
98
|
+
hll.add random_string
|
99
|
+
|
100
|
+
expect(hll.value).to be_a(Integer)
|
101
|
+
expect(hll.value).to eq 1
|
102
|
+
|
103
|
+
expect(random_string.encoding.name).to eq expected_encoding
|
104
|
+
end
|
79
105
|
end
|
80
106
|
|
81
107
|
describe 'with utf-8 strings' do
|