riak-client 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '080ae143f80944f8bc6dc8c5d52af3bb9705e418'
|
|
4
|
+
data.tar.gz: 846d1a48a1b3bdb6e8161d0302c3508e1c67417f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9cb1426cbd8d663f4e948e3d8ea08c09942f6702faab39975c77925e3af377a9cfe459c4d6e7777218df33cc19028ab13992f9bf47abf8bed82d23c7e12e8ee
|
|
7
|
+
data.tar.gz: 3f58c010d040ea7d4cc965e58594709fd22fe2e544c56936daaa69c890841d7a28213644fcefe17efce2992ec3dffedf88474bc113ff31841263a43a3d9ca30d
|
data/.document
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
README.rdoc
|
|
2
|
-
lib/**/*.rb
|
|
3
|
-
bin/*
|
|
4
|
-
features/**/*.feature
|
|
5
|
-
LICENSE
|
|
1
|
+
README.rdoc
|
|
2
|
+
lib/**/*.rb
|
|
3
|
+
bin/*
|
|
4
|
+
features/**/*.feature
|
|
5
|
+
LICENSE
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
source "https://rubygems.org"
|
|
2
|
-
|
|
3
|
-
gemspec
|
|
4
|
-
|
|
5
|
-
group :guard do
|
|
6
|
-
gem 'guard-rspec'
|
|
7
|
-
gem 'rb-fsevent'
|
|
8
|
-
gem 'terminal-notifier-guard'
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
platforms :mri do
|
|
12
|
-
gem 'yajl-ruby'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
platforms :jruby, :rbx do
|
|
16
|
-
gem 'json'
|
|
17
|
-
end
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
gemspec
|
|
4
|
+
|
|
5
|
+
group :guard do
|
|
6
|
+
gem 'guard-rspec'
|
|
7
|
+
gem 'rb-fsevent'
|
|
8
|
+
gem 'terminal-notifier-guard'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
platforms :mri do
|
|
12
|
+
gem 'yajl-ruby'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
platforms :jruby, :rbx do
|
|
16
|
+
gem 'json'
|
|
17
|
+
end
|
data/Guardfile
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# A sample Guardfile
|
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
|
3
|
-
|
|
4
|
-
# Note: The cmd option is now required due to the increasing number of ways
|
|
5
|
-
# rspec may be run, below are examples of the most common uses.
|
|
6
|
-
# * bundler: 'bundle exec rspec'
|
|
7
|
-
# * bundler binstubs: 'bin/rspec'
|
|
8
|
-
# * spring: 'bin/rsspec' (This will use spring if running and you have
|
|
9
|
-
# installed the spring binstubs per the docs)
|
|
10
|
-
# * zeus: 'zeus rspec' (requires the server to be started separetly)
|
|
11
|
-
# * 'just' rspec: 'rspec'
|
|
12
|
-
guard :rspec, cmd: 'bundle exec rspec', all_after_pass: true, all_on_start: true do
|
|
13
|
-
watch(%r{^spec/.+_spec\.rb$})
|
|
14
|
-
watch(%r{^lib/riak/(.+)\.rb$}) { |m| "spec/riak/#{m[1]}_spec.rb" }
|
|
15
|
-
watch(%r{^lib/riak/client/}) { 'spec/riak/beefcake_protobuffs_backend' }
|
|
16
|
-
watch('spec/spec_helper.rb') { "spec" }
|
|
17
|
-
|
|
18
|
-
watch(/^spec\/integration/) { 'spec:integration' }
|
|
19
|
-
end
|
|
20
|
-
|
|
1
|
+
# A sample Guardfile
|
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
|
3
|
+
|
|
4
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
|
5
|
+
# rspec may be run, below are examples of the most common uses.
|
|
6
|
+
# * bundler: 'bundle exec rspec'
|
|
7
|
+
# * bundler binstubs: 'bin/rspec'
|
|
8
|
+
# * spring: 'bin/rsspec' (This will use spring if running and you have
|
|
9
|
+
# installed the spring binstubs per the docs)
|
|
10
|
+
# * zeus: 'zeus rspec' (requires the server to be started separetly)
|
|
11
|
+
# * 'just' rspec: 'rspec'
|
|
12
|
+
guard :rspec, cmd: 'bundle exec rspec', all_after_pass: true, all_on_start: true do
|
|
13
|
+
watch(%r{^spec/.+_spec\.rb$})
|
|
14
|
+
watch(%r{^lib/riak/(.+)\.rb$}) { |m| "spec/riak/#{m[1]}_spec.rb" }
|
|
15
|
+
watch(%r{^lib/riak/client/}) { 'spec/riak/beefcake_protobuffs_backend' }
|
|
16
|
+
watch('spec/spec_helper.rb') { "spec" }
|
|
17
|
+
|
|
18
|
+
watch(/^spec\/integration/) { 'spec:integration' }
|
|
19
|
+
end
|
|
20
|
+
|
data/LICENSE.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
Copyright 2010-2016 Sean Cribbs and Basho Technologies, Inc.
|
|
2
|
-
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
|
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
See the License for the specific language governing permissions and
|
|
13
|
-
limitations under the License.
|
|
14
|
-
|
|
15
|
-
All of the files in this project are under the project-wide license
|
|
16
|
-
unless they are otherwise marked.
|
|
1
|
+
Copyright 2010-2016 Sean Cribbs and Basho Technologies, Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
14
|
+
|
|
15
|
+
All of the files in this project are under the project-wide license
|
|
16
|
+
unless they are otherwise marked.
|
data/RELNOTES.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Riak Ruby Client Release Notes
|
|
2
2
|
|
|
3
|
+
## [`2.5.0` Release - 2016-11-16](https://github.com/basho/riak-ruby-client/issues?q=milestone%3Ariak-ruby-client-2.5.0)
|
|
4
|
+
|
|
5
|
+
Version `2.5.0` adds support for the HyperLogLog data type in Riak 2.2.0.
|
|
6
|
+
|
|
3
7
|
## [`2.4.1` Release - 2016-08-02](https://github.com/basho/riak-ruby-client/issues?q=milestone%3Ariak-ruby-client-2.4.1)
|
|
4
8
|
|
|
5
9
|
Version `2.4.1` is a bugfix release that addresses some issues when using Ruby `1.9.3`.
|
data/Rakefile
CHANGED
|
@@ -75,6 +75,11 @@ namespace :spec do
|
|
|
75
75
|
RSpec::Core::RakeTask.new(:time_series) do |spec|
|
|
76
76
|
spec.rspec_opts = %w[--profile --tag time_series]
|
|
77
77
|
end
|
|
78
|
+
|
|
79
|
+
desc "Run Security Specs Only"
|
|
80
|
+
RSpec::Core::RakeTask.new(:security) do |spec|
|
|
81
|
+
spec.rspec_opts = %w[--profile --tag yes_security --tag ~time_series]
|
|
82
|
+
end
|
|
78
83
|
end
|
|
79
84
|
|
|
80
85
|
desc "Run Unit Test Specs (excluding slow, integration and time_series)"
|
|
@@ -113,7 +118,7 @@ namespace :beefcake do
|
|
|
113
118
|
|
|
114
119
|
directory 'tmp/riak_pb' => 'tmp' do
|
|
115
120
|
cd 'tmp' do
|
|
116
|
-
sh "git clone -b 2.
|
|
121
|
+
sh "git clone -b 2.2 https://github.com/basho/riak_pb.git"
|
|
117
122
|
end
|
|
118
123
|
end
|
|
119
124
|
end
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
class Riak::Client::BeefcakeProtobuffsBackend
|
|
2
|
-
class CrdtLoader
|
|
3
|
-
class CounterLoader
|
|
4
|
-
def self.for_value(resp)
|
|
5
|
-
return nil unless resp.counter_value
|
|
6
|
-
new resp.counter_value
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def initialize(counter_value)
|
|
10
|
-
@value = counter_value
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def rubyfy
|
|
14
|
-
@value
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
1
|
+
class Riak::Client::BeefcakeProtobuffsBackend
|
|
2
|
+
class CrdtLoader
|
|
3
|
+
class CounterLoader
|
|
4
|
+
def self.for_value(resp)
|
|
5
|
+
return nil unless resp.counter_value
|
|
6
|
+
new resp.counter_value
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def initialize(counter_value)
|
|
10
|
+
@value = counter_value
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def rubyfy
|
|
14
|
+
@value
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class Riak::Client::BeefcakeProtobuffsBackend
|
|
2
|
+
class CrdtLoader
|
|
3
|
+
class HyperLogLogLoader
|
|
4
|
+
def self.for_value(resp)
|
|
5
|
+
return nil unless resp.hll_value
|
|
6
|
+
new resp.hll_value
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def initialize(hll_value)
|
|
10
|
+
@value = hll_value
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def rubyfy
|
|
14
|
+
@value
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
class Riak::Client::BeefcakeProtobuffsBackend
|
|
2
|
-
class CrdtLoader
|
|
3
|
-
class MapLoader
|
|
4
|
-
def self.for_value(resp)
|
|
5
|
-
return nil unless resp.map_value
|
|
6
|
-
new resp.map_value
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def initialize(map_value)
|
|
10
|
-
@value = map_value
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def rubyfy
|
|
14
|
-
accum = {
|
|
15
|
-
counters: {},
|
|
16
|
-
flags: {},
|
|
17
|
-
maps: {},
|
|
18
|
-
registers: {},
|
|
19
|
-
sets: {}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
contents_loop @value, accum
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
|
|
27
|
-
def rubyfy_inner(accum, map_value)
|
|
28
|
-
destination = accum[:maps][map_value.field.name]
|
|
29
|
-
if destination.nil?
|
|
30
|
-
destination = accum[:maps][map_value.field.name] = {
|
|
31
|
-
counters: {},
|
|
32
|
-
flags: {},
|
|
33
|
-
maps: {},
|
|
34
|
-
registers: {},
|
|
35
|
-
sets: {}
|
|
36
|
-
}
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
contents_loop map_value.map_value, destination
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def contents_loop(rolling_value, destination)
|
|
43
|
-
return destination if rolling_value.nil?
|
|
44
|
-
|
|
45
|
-
rolling_value.each do |inner|
|
|
46
|
-
case inner.field.type
|
|
47
|
-
when MapField::MapFieldType::COUNTER
|
|
48
|
-
destination[:counters][inner.field.name] = inner.counter_value
|
|
49
|
-
when MapField::MapFieldType::FLAG
|
|
50
|
-
destination[:flags][inner.field.name] = inner.flag_value
|
|
51
|
-
when MapField::MapFieldType::MAP
|
|
52
|
-
rubyfy_inner destination, inner
|
|
53
|
-
when MapField::MapFieldType::REGISTER
|
|
54
|
-
destination[:registers][inner.field.name] = inner.register_value
|
|
55
|
-
when MapField::MapFieldType::SET
|
|
56
|
-
destination[:sets][inner.field.name] = ::Set.new inner.set_value
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
return destination
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
1
|
+
class Riak::Client::BeefcakeProtobuffsBackend
|
|
2
|
+
class CrdtLoader
|
|
3
|
+
class MapLoader
|
|
4
|
+
def self.for_value(resp)
|
|
5
|
+
return nil unless resp.map_value
|
|
6
|
+
new resp.map_value
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def initialize(map_value)
|
|
10
|
+
@value = map_value
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def rubyfy
|
|
14
|
+
accum = {
|
|
15
|
+
counters: {},
|
|
16
|
+
flags: {},
|
|
17
|
+
maps: {},
|
|
18
|
+
registers: {},
|
|
19
|
+
sets: {}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
contents_loop @value, accum
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def rubyfy_inner(accum, map_value)
|
|
28
|
+
destination = accum[:maps][map_value.field.name]
|
|
29
|
+
if destination.nil?
|
|
30
|
+
destination = accum[:maps][map_value.field.name] = {
|
|
31
|
+
counters: {},
|
|
32
|
+
flags: {},
|
|
33
|
+
maps: {},
|
|
34
|
+
registers: {},
|
|
35
|
+
sets: {}
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
contents_loop map_value.map_value, destination
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def contents_loop(rolling_value, destination)
|
|
43
|
+
return destination if rolling_value.nil?
|
|
44
|
+
|
|
45
|
+
rolling_value.each do |inner|
|
|
46
|
+
case inner.field.type
|
|
47
|
+
when MapField::MapFieldType::COUNTER
|
|
48
|
+
destination[:counters][inner.field.name] = inner.counter_value
|
|
49
|
+
when MapField::MapFieldType::FLAG
|
|
50
|
+
destination[:flags][inner.field.name] = inner.flag_value
|
|
51
|
+
when MapField::MapFieldType::MAP
|
|
52
|
+
rubyfy_inner destination, inner
|
|
53
|
+
when MapField::MapFieldType::REGISTER
|
|
54
|
+
destination[:registers][inner.field.name] = inner.register_value
|
|
55
|
+
when MapField::MapFieldType::SET
|
|
56
|
+
destination[:sets][inner.field.name] = ::Set.new inner.set_value
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
return destination
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'riak/client/beefcake/crdt/counter_loader'
|
|
2
|
+
require 'riak/client/beefcake/crdt/hyper_log_log_loader'
|
|
2
3
|
require 'riak/client/beefcake/crdt/map_loader'
|
|
3
4
|
require 'riak/client/beefcake/crdt/set_loader'
|
|
4
5
|
|
|
@@ -47,7 +48,7 @@ module Riak
|
|
|
47
48
|
def get_loader_for_value(value)
|
|
48
49
|
return nil if value.nil?
|
|
49
50
|
|
|
50
|
-
[CounterLoader, MapLoader, SetLoader].map do |loader|
|
|
51
|
+
[CounterLoader, HyperLogLogLoader, MapLoader, SetLoader].map do |loader|
|
|
51
52
|
loader.for_value value
|
|
52
53
|
end.compact.first
|
|
53
54
|
end
|
|
@@ -76,6 +77,8 @@ module Riak
|
|
|
76
77
|
registers: {},
|
|
77
78
|
sets: {},
|
|
78
79
|
}
|
|
80
|
+
when DtFetchResp::DataType::HLL
|
|
81
|
+
0
|
|
79
82
|
end
|
|
80
83
|
end
|
|
81
84
|
end
|
|
@@ -68,6 +68,8 @@ module Riak
|
|
|
68
68
|
case operations.first.type
|
|
69
69
|
when :counter
|
|
70
70
|
serialize_counter operations
|
|
71
|
+
when :hll
|
|
72
|
+
serialize_hyper_log_log operations
|
|
71
73
|
when :set
|
|
72
74
|
serialize_set operations
|
|
73
75
|
when :map
|
|
@@ -170,6 +172,17 @@ module Riak
|
|
|
170
172
|
)
|
|
171
173
|
end
|
|
172
174
|
|
|
175
|
+
def serialize_hyper_log_log(hyper_log_log_ops)
|
|
176
|
+
adds = ::Set.new
|
|
177
|
+
hyper_log_log_ops.each do |o|
|
|
178
|
+
adds.add [o.value[:add]] if o.value[:add]
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
HllOp.new(
|
|
182
|
+
adds: adds.to_a.flatten
|
|
183
|
+
)
|
|
184
|
+
end
|
|
185
|
+
|
|
173
186
|
def serialize_inner_set(set_op)
|
|
174
187
|
value = set_op.value or nil
|
|
175
188
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
end
|
|
3
|
-
end
|
|
4
|
-
end
|
|
1
|
+
|
|
2
|
+
end
|
|
3
|
+
end
|
|
4
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require 'beefcake'
|
|
2
|
-
|
|
3
|
-
module Riak
|
|
4
|
-
class Client
|
|
5
|
-
# @private
|
|
6
|
-
class BeefcakeProtobuffsBackend
|
|
1
|
+
require 'beefcake'
|
|
2
|
+
|
|
3
|
+
module Riak
|
|
4
|
+
class Client
|
|
5
|
+
# @private
|
|
6
|
+
class BeefcakeProtobuffsBackend
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
require 'beefcake'
|
|
2
|
-
|
|
3
|
-
module Riak
|
|
4
|
-
class Client
|
|
5
|
-
# @private
|
|
6
|
-
class BeefcakeProtobuffsBackend
|
|
1
|
+
require 'beefcake'
|
|
2
|
+
|
|
3
|
+
module Riak
|
|
4
|
+
class Client
|
|
5
|
+
# @private
|
|
6
|
+
class BeefcakeProtobuffsBackend
|
|
7
7
|
## Generated from riak.proto
|
|
8
8
|
require "beefcake"
|
|
9
9
|
|
|
@@ -150,6 +150,7 @@ class RpbBucketProps
|
|
|
150
150
|
optional :datatype, :bytes, 26
|
|
151
151
|
optional :consistent, :bool, 27
|
|
152
152
|
optional :write_once, :bool, 28
|
|
153
|
+
optional :hll_precision, :uint32, 29
|
|
153
154
|
end
|
|
154
155
|
|
|
155
156
|
class RpbAuthReq
|
|
@@ -682,6 +683,7 @@ class DtFetchResp
|
|
|
682
683
|
COUNTER = 1
|
|
683
684
|
SET = 2
|
|
684
685
|
MAP = 3
|
|
686
|
+
HLL = 4
|
|
685
687
|
end
|
|
686
688
|
end
|
|
687
689
|
|
|
@@ -693,6 +695,10 @@ class SetOp
|
|
|
693
695
|
include Beefcake::Message
|
|
694
696
|
end
|
|
695
697
|
|
|
698
|
+
class HllOp
|
|
699
|
+
include Beefcake::Message
|
|
700
|
+
end
|
|
701
|
+
|
|
696
702
|
class MapUpdate
|
|
697
703
|
include Beefcake::Message
|
|
698
704
|
|
|
@@ -750,6 +756,7 @@ class DtValue
|
|
|
750
756
|
optional :counter_value, :sint64, 1
|
|
751
757
|
repeated :set_value, :bytes, 2
|
|
752
758
|
repeated :map_value, MapEntry, 3
|
|
759
|
+
optional :hll_value, :uint64, 4
|
|
753
760
|
end
|
|
754
761
|
|
|
755
762
|
class DtFetchResp
|
|
@@ -767,6 +774,10 @@ class SetOp
|
|
|
767
774
|
repeated :removes, :bytes, 2
|
|
768
775
|
end
|
|
769
776
|
|
|
777
|
+
class HllOp
|
|
778
|
+
repeated :adds, :bytes, 1
|
|
779
|
+
end
|
|
780
|
+
|
|
770
781
|
class MapUpdate
|
|
771
782
|
required :field, MapField, 1
|
|
772
783
|
optional :counter_op, CounterOp, 2
|
|
@@ -785,6 +796,7 @@ class DtOp
|
|
|
785
796
|
optional :counter_op, CounterOp, 1
|
|
786
797
|
optional :set_op, SetOp, 2
|
|
787
798
|
optional :map_op, MapOp, 3
|
|
799
|
+
optional :hll_op, HllOp, 4
|
|
788
800
|
end
|
|
789
801
|
|
|
790
802
|
class DtUpdateReq
|
|
@@ -809,6 +821,7 @@ class DtUpdateResp
|
|
|
809
821
|
optional :counter_value, :sint64, 3
|
|
810
822
|
repeated :set_value, :bytes, 4
|
|
811
823
|
repeated :map_value, MapEntry, 5
|
|
824
|
+
optional :hll_value, :uint64, 6
|
|
812
825
|
end
|
|
813
826
|
## Generated from riak_ts.proto
|
|
814
827
|
require "beefcake"
|
|
@@ -878,9 +891,26 @@ class TsListKeysResp
|
|
|
878
891
|
include Beefcake::Message
|
|
879
892
|
end
|
|
880
893
|
|
|
894
|
+
class TsCoverageReq
|
|
895
|
+
include Beefcake::Message
|
|
896
|
+
end
|
|
897
|
+
|
|
898
|
+
class TsCoverageResp
|
|
899
|
+
include Beefcake::Message
|
|
900
|
+
end
|
|
901
|
+
|
|
902
|
+
class TsCoverageEntry
|
|
903
|
+
include Beefcake::Message
|
|
904
|
+
end
|
|
905
|
+
|
|
906
|
+
class TsRange
|
|
907
|
+
include Beefcake::Message
|
|
908
|
+
end
|
|
909
|
+
|
|
881
910
|
class TsQueryReq
|
|
882
911
|
optional :query, TsInterpolation, 1
|
|
883
912
|
optional :stream, :bool, 2, :default => false
|
|
913
|
+
optional :cover_context, :bytes, 3
|
|
884
914
|
end
|
|
885
915
|
|
|
886
916
|
class TsQueryResp
|
|
@@ -950,7 +980,34 @@ class TsListKeysResp
|
|
|
950
980
|
repeated :keys, TsRow, 1
|
|
951
981
|
optional :done, :bool, 2
|
|
952
982
|
end
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
983
|
+
|
|
984
|
+
class TsCoverageReq
|
|
985
|
+
optional :query, TsInterpolation, 1
|
|
986
|
+
required :table, :bytes, 2
|
|
987
|
+
optional :replace_cover, :bytes, 3
|
|
988
|
+
repeated :unavailable_cover, :bytes, 4
|
|
989
|
+
end
|
|
990
|
+
|
|
991
|
+
class TsCoverageResp
|
|
992
|
+
repeated :entries, TsCoverageEntry, 1
|
|
993
|
+
end
|
|
994
|
+
|
|
995
|
+
class TsCoverageEntry
|
|
996
|
+
required :ip, :bytes, 1
|
|
997
|
+
required :port, :uint32, 2
|
|
998
|
+
required :cover_context, :bytes, 3
|
|
999
|
+
optional :range, TsRange, 4
|
|
1000
|
+
end
|
|
1001
|
+
|
|
1002
|
+
class TsRange
|
|
1003
|
+
required :field_name, :bytes, 1
|
|
1004
|
+
required :lower_bound, :sint64, 2
|
|
1005
|
+
required :lower_bound_inclusive, :bool, 3
|
|
1006
|
+
required :upper_bound, :sint64, 4
|
|
1007
|
+
required :upper_bound_inclusive, :bool, 5
|
|
1008
|
+
required :desc, :bytes, 6
|
|
1009
|
+
end
|
|
1010
|
+
|
|
1011
|
+
end
|
|
1012
|
+
end
|
|
1013
|
+
end
|