riak-client 2.5.0 → 2.6.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.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/RELNOTES.md +3 -0
  4. data/lib/riak/bucket.rb +1 -1
  5. data/lib/riak/client.rb +14 -7
  6. data/lib/riak/client/beefcake/messages.rb +13 -0
  7. data/lib/riak/multi.rb +101 -0
  8. data/lib/riak/multiexist.rb +14 -0
  9. data/lib/riak/multiget.rb +7 -107
  10. data/lib/riak/version.rb +1 -1
  11. metadata +12 -234
  12. data/.document +0 -5
  13. data/.gitignore +0 -44
  14. data/.rspec +0 -2
  15. data/Gemfile +0 -17
  16. data/Guardfile +0 -20
  17. data/Rakefile +0 -124
  18. data/riak-client.gemspec +0 -71
  19. data/spec/failover/failover.rb +0 -59
  20. data/spec/fixtures/bitcask.txt +0 -25
  21. data/spec/fixtures/cat.jpg +0 -0
  22. data/spec/fixtures/multipart-basic-conflict.txt +0 -15
  23. data/spec/fixtures/multipart-blank.txt +0 -7
  24. data/spec/fixtures/multipart-mapreduce.txt +0 -10
  25. data/spec/fixtures/multipart-with-body.txt +0 -16
  26. data/spec/fixtures/multipart-with-marked-tombstones.txt +0 -17
  27. data/spec/fixtures/multipart-with-unmarked-tombstone.txt +0 -16
  28. data/spec/fixtures/server.cert.crt +0 -15
  29. data/spec/fixtures/server.cert.key +0 -15
  30. data/spec/fixtures/test.pem +0 -1
  31. data/spec/fixtures/yz_schema_template.xml +0 -18
  32. data/spec/integration/riak/bucket_types_spec.rb +0 -308
  33. data/spec/integration/riak/conflict_resolution_spec.rb +0 -96
  34. data/spec/integration/riak/counters_spec.rb +0 -36
  35. data/spec/integration/riak/crdt/configuration_spec.rb +0 -38
  36. data/spec/integration/riak/crdt_search_spec.rb +0 -176
  37. data/spec/integration/riak/crdt_spec.rb +0 -332
  38. data/spec/integration/riak/crdt_validation/map_spec.rb +0 -63
  39. data/spec/integration/riak/crdt_validation/set_spec.rb +0 -122
  40. data/spec/integration/riak/encodings/crdt_spec.rb +0 -122
  41. data/spec/integration/riak/encodings/kv_spec.rb +0 -87
  42. data/spec/integration/riak/encodings/yz_spec.rb +0 -142
  43. data/spec/integration/riak/preflist_spec.rb +0 -43
  44. data/spec/integration/riak/properties_spec.rb +0 -69
  45. data/spec/integration/riak/protobuffs/interrupted_request_spec.rb +0 -33
  46. data/spec/integration/riak/protobuffs/timeouts_spec.rb +0 -178
  47. data/spec/integration/riak/protobuffs_backends_spec.rb +0 -40
  48. data/spec/integration/riak/search_spec.rb +0 -104
  49. data/spec/integration/riak/secondary_index_spec.rb +0 -72
  50. data/spec/integration/riak/security_spec.rb +0 -105
  51. data/spec/integration/riak/threading_spec.rb +0 -154
  52. data/spec/integration/riak/time_series_spec.rb +0 -212
  53. data/spec/integration/yokozuna/index_spec.rb +0 -61
  54. data/spec/integration/yokozuna/queries_spec.rb +0 -115
  55. data/spec/integration/yokozuna/schema_spec.rb +0 -49
  56. data/spec/riak/beefcake_protobuffs_backend/bucket_properties_operator_spec.rb +0 -247
  57. data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +0 -244
  58. data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +0 -53
  59. data/spec/riak/beefcake_protobuffs_backend/protocol_spec.rb +0 -189
  60. data/spec/riak/beefcake_protobuffs_backend/ts_cell_codec_spec.rb +0 -124
  61. data/spec/riak/beefcake_protobuffs_backend_spec.rb +0 -162
  62. data/spec/riak/bucket_properties_spec.rb +0 -135
  63. data/spec/riak/bucket_spec.rb +0 -275
  64. data/spec/riak/bucket_type_spec.rb +0 -50
  65. data/spec/riak/bucket_typed/bucket_spec.rb +0 -78
  66. data/spec/riak/client_spec.rb +0 -304
  67. data/spec/riak/core_ext/to_param_spec.rb +0 -15
  68. data/spec/riak/counter_spec.rb +0 -122
  69. data/spec/riak/crdt/counter_spec.rb +0 -55
  70. data/spec/riak/crdt/hyper_log_log_spec.rb +0 -56
  71. data/spec/riak/crdt/inner_counter_spec.rb +0 -21
  72. data/spec/riak/crdt/inner_flag_spec.rb +0 -39
  73. data/spec/riak/crdt/inner_map_spec.rb +0 -47
  74. data/spec/riak/crdt/inner_register_spec.rb +0 -40
  75. data/spec/riak/crdt/inner_set_spec.rb +0 -33
  76. data/spec/riak/crdt/map_spec.rb +0 -78
  77. data/spec/riak/crdt/set_spec.rb +0 -61
  78. data/spec/riak/crdt/shared_examples.rb +0 -88
  79. data/spec/riak/crdt/typed_collection_spec.rb +0 -225
  80. data/spec/riak/escape_spec.rb +0 -72
  81. data/spec/riak/feature_detection_spec.rb +0 -77
  82. data/spec/riak/index_collection_spec.rb +0 -53
  83. data/spec/riak/instrumentation_spec.rb +0 -124
  84. data/spec/riak/link_spec.rb +0 -85
  85. data/spec/riak/list_buckets_spec.rb +0 -41
  86. data/spec/riak/map_reduce/filter_builder_spec.rb +0 -32
  87. data/spec/riak/map_reduce/phase_spec.rb +0 -142
  88. data/spec/riak/map_reduce_spec.rb +0 -434
  89. data/spec/riak/multiget_spec.rb +0 -81
  90. data/spec/riak/node_spec.rb +0 -26
  91. data/spec/riak/robject_spec.rb +0 -542
  92. data/spec/riak/search/index_spec.rb +0 -72
  93. data/spec/riak/search/query_spec.rb +0 -88
  94. data/spec/riak/search/result_collection_spec.rb +0 -89
  95. data/spec/riak/search/result_document_spec.rb +0 -106
  96. data/spec/riak/search/schema_spec.rb +0 -63
  97. data/spec/riak/search_spec.rb +0 -107
  98. data/spec/riak/secondary_index_spec.rb +0 -225
  99. data/spec/riak/serializers_spec.rb +0 -121
  100. data/spec/riak/stamp_spec.rb +0 -54
  101. data/spec/riak/time_series/deletion_spec.rb +0 -33
  102. data/spec/riak/time_series/listing_spec.rb +0 -51
  103. data/spec/riak/time_series/submission_spec.rb +0 -35
  104. data/spec/riak/util/gzip_spec.rb +0 -49
  105. data/spec/riak/walk_spec_spec.rb +0 -203
  106. data/spec/spec_helper.rb +0 -67
  107. data/spec/support/certs/README.md +0 -13
  108. data/spec/support/certs/ca.crt +0 -21
  109. data/spec/support/certs/client.crl +0 -13
  110. data/spec/support/certs/client.crt +0 -94
  111. data/spec/support/certs/client.csr +0 -18
  112. data/spec/support/certs/client.key +0 -27
  113. data/spec/support/certs/empty_ca.crt +0 -21
  114. data/spec/support/certs/server.crl +0 -13
  115. data/spec/support/certs/server.crt +0 -94
  116. data/spec/support/certs/server.key +0 -27
  117. data/spec/support/crdt_search_config.rb +0 -112
  118. data/spec/support/crdt_search_fixtures.rb +0 -42
  119. data/spec/support/integration_setup.rb +0 -10
  120. data/spec/support/search_config.rb +0 -83
  121. data/spec/support/search_corpus_setup.rb +0 -39
  122. data/spec/support/test_client.rb +0 -52
  123. data/spec/support/test_client.yml.example +0 -10
  124. data/spec/support/unified_backend_examples.rb +0 -402
  125. data/spec/support/version_filter.rb +0 -12
  126. data/spec/support/wait_until.rb +0 -20
@@ -1,43 +0,0 @@
1
- require 'spec_helper'
2
- require 'riak'
3
-
4
- describe 'Preflist', integration: true, test_client: true do
5
- let(:bucket){ random_bucket }
6
- let(:robject) do
7
- bucket.get_or_new(random_key).tap do |robj|
8
- robj.data = 'asdf'
9
- robj.store
10
- end
11
- end
12
-
13
- matcher :be_a_preflist do
14
- match do |actual|
15
- actual.is_a?(Array) &&
16
- actual.first.is_a?(Riak::PreflistItem)
17
- end
18
- end
19
-
20
- it 'is available from RObjects' do
21
- begin
22
- expect(robject.preflist).to be_a_preflist
23
- rescue Riak::ProtobuffsErrorResponse
24
- skip('preflists are not supported')
25
- end
26
- end
27
-
28
- it 'is available from Buckets' do
29
- begin
30
- expect(bucket.get_preflist robject.key).to be_a_preflist
31
- rescue Riak::ProtobuffsErrorResponse
32
- skip('preflists are not supported')
33
- end
34
- end
35
-
36
- it 'is available from the Client' do
37
- begin
38
- expect(test_client.get_preflist bucket.name, robject.key).to be_a_preflist
39
- rescue Riak::ProtobuffsErrorResponse
40
- skip('preflists are not supported')
41
- end
42
- end
43
- end
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
- require 'riak/bucket_properties'
3
-
4
- describe Riak::BucketProperties, test_client: true, integration: true do
5
- describe 'Bucket Properties objects' do
6
- let(:bucket){ random_bucket 'props' }
7
- subject{ described_class.new bucket }
8
-
9
- let(:other_bucket) do
10
- random_bucket('props-other').tap do |b|
11
- p = described_class.new b
12
- p['r'] = 1
13
- p.store
14
- end
15
- end
16
- let(:other_props){ described_class.new other_bucket }
17
-
18
- before(:example) do
19
- bucket.clear_props
20
- subject.reload
21
- end
22
-
23
- it 'is initializable with a bucket' do
24
- expect{ described_class.new bucket }.to_not raise_error
25
- end
26
-
27
- it 'works like a hash' do
28
- expect(subject['r']).to eq 'quorum'
29
- expect{ subject['r'] = 1 }.to_not raise_error
30
- subject.store
31
- subject.reload
32
-
33
- expect(subject['r']).to eq 1
34
- end
35
-
36
- it 'can be merged from a hash' do
37
- bulk_props = { r: 1, w: 1, dw: 1 }
38
- expect{ subject.merge! bulk_props }.to_not raise_error
39
- subject.store
40
- subject.reload
41
-
42
- expect(subject['r']).to eq 1
43
- expect(subject['w']).to eq 1
44
- expect(subject['dw']).to eq 1
45
- end
46
-
47
- it 'can be merged from a bucket properties object' do
48
- expect(other_props['r']).to eq 1
49
- expect(subject['r']).to eq 'quorum'
50
-
51
- expect{ subject.merge! other_props }.to_not raise_error
52
- subject.store
53
- subject.reload
54
-
55
- expect(subject['r']).to eq 1
56
- end
57
-
58
- let(:modfun){ { 'mod' => 'validate_json', 'fun' => 'validate' } }
59
-
60
- it 'works with composite/modfun properties' do
61
- expect{ subject['precommit'] = modfun }.to_not raise_error
62
-
63
- subject.store
64
- subject.reload
65
-
66
- expect(subject['precommit']).to eq [modfun]
67
- end
68
- end
69
- end
@@ -1,33 +0,0 @@
1
- require 'spec_helper'
2
- require 'timeout'
3
-
4
- describe 'Protocol Buffers', test_client: true do
5
- describe 'interrupted requests' do
6
-
7
- let(:bucket){ random_bucket 'interrupted_requests' }
8
-
9
- before do
10
- first = bucket.new 'first'
11
- first.data = 'first'
12
- first.content_type = 'text/plain'
13
- first.store
14
-
15
- second = bucket.new 'second'
16
- second.data = 'second'
17
- second.content_type = 'text/plain'
18
- second.store
19
- end
20
-
21
- it 'fails out when a request is interrupted, and never returns the wrong payload' do
22
- expect do
23
- Timeout.timeout 1 do
24
- loop do
25
- expect(bucket.get('first').data).to eq 'first'
26
- end
27
- end
28
- end.to raise_error Timeout::Error
29
-
30
- expect(bucket.get('second').data).to eq 'second'
31
- end
32
- end
33
- end
@@ -1,178 +0,0 @@
1
- require 'socket'
2
- require 'spec_helper'
3
-
4
- require 'riak/client/beefcake/messages'
5
- require 'riak/client/beefcake/protocol'
6
-
7
- describe 'Protocol Buffers', test_client: true, integration: true, slow: true do
8
- if RUBY_VERSION >= '2.0.0'
9
- describe 'timeouts' do
10
- it 'raises error on connect timeout' do
11
- # unroutable TEST-NET (https://tools.ietf.org/html/rfc5737)
12
- config = {}
13
- config[:host] = '192.0.2.0'
14
- config[:pb_port] = 65535
15
-
16
- config[:connect_timeout] = 0.0001
17
- client = Riak::Client.new(config)
18
-
19
- expect do
20
- client.ping
21
- end.to raise_error RuntimeError, /timed out/
22
- end
23
-
24
- it 'raises error on read timeout' do
25
- ok_to_continue = false
26
- quitting = false
27
- port = 0
28
-
29
- server = nil
30
- thr = Thread.new do
31
- server = TCPServer.new port
32
- port = server.addr[1]
33
- ok_to_continue = true
34
- loop do
35
- begin
36
- Thread.start(server.accept) do |s|
37
- loop do
38
- p = Riak::Client::BeefcakeProtobuffsBackend::Protocol.new s
39
- begin
40
- msgname, _body = p.receive
41
- rescue IOError
42
- break if quitting
43
- raise
44
- end
45
- case msgname
46
- when :PingReq
47
- sleep 0.5
48
- p.write :PingResp
49
- else
50
- $stderr.puts("unknown msgname: #{msgname}")
51
- end
52
- end
53
- end
54
- rescue IOError
55
- break if quitting
56
- raise
57
- end
58
- end
59
- end
60
-
61
- loop do
62
- break if ok_to_continue
63
- sleep 0.1
64
- end
65
- ok_to_continue = false
66
-
67
- config = {}
68
- config[:pb_port] = port
69
- config[:client_id] = port
70
- config[:read_timeout] = 0.0001
71
- client = Riak::Client.new(config)
72
-
73
- max_ping_attempts = 16
74
- ping_count = 0
75
- loop do
76
- begin
77
- client.ping
78
- ping_count += 1
79
- break if ping_count > max_ping_attempts
80
- rescue RuntimeError => e
81
- break if e.message =~ /timed out/
82
- end
83
- sleep 0.5
84
- end
85
-
86
- quitting = true
87
- server.close
88
- thr.join
89
-
90
- expect(ping_count).to be < max_ping_attempts
91
- end
92
-
93
- it 'raises error on write timeout' do
94
- ok_to_continue = false
95
- quitting = false
96
- port = 0
97
-
98
- server = nil
99
- thr = Thread.new do
100
- server = TCPServer.new port
101
- port = server.addr[1]
102
- ok_to_continue = true
103
- loop do
104
- begin
105
- Thread.start(server.accept) do |s|
106
- loop do
107
- p = Riak::Client::BeefcakeProtobuffsBackend::Protocol.new s
108
- begin
109
- msgname, _body = p.receive
110
- rescue IOError
111
- break if quitting
112
- raise
113
- end
114
- case msgname
115
- when :PingReq
116
- p.write :PingResp
117
- when :GetServerInfoReq
118
- r = Riak::Client::BeefcakeProtobuffsBackend::RpbGetServerInfoResp.new
119
- r.node = 'dev1@127.0.0.1'.force_encoding('BINARY')
120
- r.server_version = '2.1.4'.force_encoding('BINARY')
121
- p.write :GetServerInfoResp, r
122
- when :PutReq
123
- r = Riak::Client::BeefcakeProtobuffsBackend::RpbPutResp.new
124
- p.write :PutResp, r
125
- else
126
- $stderr.puts("unknown msgname: #{msgname}")
127
- end
128
- end
129
- end
130
- rescue IOError
131
- break if quitting
132
- raise
133
- end
134
- end
135
- end
136
-
137
- loop do
138
- break if ok_to_continue
139
- sleep 0.1
140
- end
141
- ok_to_continue = false
142
-
143
- config = {}
144
- config[:pb_port] = port
145
- config[:client_id] = port
146
- config[:write_timeout] = 0.0001
147
- client = Riak::Client.new(config)
148
-
149
- bucket = client.bucket('timeouts')
150
-
151
- max_store_attempts = 16
152
- store_count = 0
153
- loop do
154
- begin
155
- obj = bucket.new "obj-#{store_count}"
156
- # write enough data to grow beyond socket buffer capacity
157
- obj.data = SecureRandom.urlsafe_base64(10_000_000)
158
- obj.content_type = 'text/plain'
159
- obj.store
160
- store_count += 1
161
- break if store_count > max_store_attempts
162
- rescue RuntimeError => e
163
- break if e.message =~ /timed out/
164
- end
165
- sleep 0.5
166
- end
167
-
168
- quitting = true
169
- server.close
170
- thr.join
171
-
172
- expect(store_count).to be < max_store_attempts
173
- end
174
- end
175
- else
176
- skip 'not supported in this version of Ruby'
177
- end
178
- end
@@ -1,40 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Protocol Buffers", test_client: true do
4
- before do
5
- @client = test_client
6
- @bucket = random_bucket 'protobuf_spec'
7
- end
8
-
9
- [:BeefcakeProtobuffsBackend].each do |klass|
10
- bklass = Riak::Client.const_get(klass)
11
- if bklass.configured?
12
- describe klass.to_s do
13
- before do
14
- @backend = bklass.new(@client, @client.node)
15
- end
16
-
17
- it_should_behave_like "Unified backend API"
18
-
19
- describe "searching yokozuna" do
20
- include_context "search corpus setup"
21
-
22
- it 'returns documents with UTF-8 fields (GH #75)' do
23
- utf8 = Encoding.find('UTF-8')
24
- results = @backend.search(
25
- @search_bucket.name,
26
- 'fearless elephant rushed',
27
- df: 'text'
28
- )
29
- results['docs'].each do |d|
30
- d.each do |(k, v)|
31
- expect(k.encoding).to eq(utf8)
32
- expect(v.encoding).to eq(utf8)
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,104 +0,0 @@
1
- require 'spec_helper'
2
- require 'riak/search'
3
-
4
- describe 'Object-oriented Search API', test_client: true, integration: true, search_config: true do
5
- before :all do
6
- create_index
7
- configure_bucket
8
- load_corpus
9
- end
10
-
11
- let(:term){ 'bitcask' }
12
-
13
- describe 'queries' do
14
- let(:index){ Riak::Search::Index.new test_client, index_name }
15
- subject { Riak::Search::Query.new test_client, index, term }
16
-
17
- it 'performs queries' do
18
- results = nil
19
- expect{ results = subject.results }.to_not raise_error
20
- expect(results.raw).to_not be_empty
21
- expect(results).to_not be_empty
22
- end
23
-
24
- it 'performs limited and sorted queries' do
25
- subject.rows = 5
26
- results = nil
27
- expect{ results = subject.results }.to_not raise_error
28
- expect(results.raw).to_not be_empty
29
- expect(results.length).to eq 5
30
- end
31
- end
32
-
33
- describe 'results from queries' do
34
- let(:index){ Riak::Search::Index.new test_client, index_name }
35
- let(:query){ Riak::Search::Query.new test_client, index, term }
36
- subject { query.results }
37
-
38
- it 'exposes search-result documents' do
39
- expect(subject).to_not be_empty
40
-
41
- expect(subject.docs).to_not be_empty
42
- expect(first = subject.docs.first).to be
43
-
44
- expect(first.score).to be_a Numeric
45
-
46
- expect(first.bucket_type).to be_a Riak::BucketType
47
- expect(first.bucket).to be_a Riak::Bucket
48
- expect(first.key).to be_a String
49
- end
50
-
51
- it 'exposes RObjects' do
52
- expect(subject).to_not be_empty
53
-
54
- expect(first = subject.first).to be_a Riak::RObject
55
- expect(first).to eq subject.docs.first.robject
56
-
57
- expect(first.key).to eq subject.docs.first.key
58
- end
59
- end
60
-
61
- describe 'indexes' do
62
- it 'tests for index existence and content' do
63
- existing_index = Riak::Search::Index.new test_client, index_name
64
- expect(existing_index).to be_exists # auto predicate matcher
65
-
66
- nonexistent_index = Riak::Search::Index.new(test_client, "nonexist-#{random_key}")
67
- expect(nonexistent_index).to_not be_exists
68
- end
69
-
70
- it 'creates indexes' do
71
- new_index = Riak::Search::Index.new test_client, "search-spec-#{random_key}"
72
- expect(new_index).to_not be_exist
73
- expect{ new_index.create! }.to_not raise_error
74
-
75
- wait_until{ new_index.exists? }
76
-
77
- expect(new_index).to be_exists
78
-
79
- expect{ new_index.create! }.to raise_error Riak::SearchError::IndexExistsError
80
- end
81
- end
82
-
83
- describe 'schemas' do
84
- it 'tests for schema existence and content' do
85
- existing_schema = Riak::Search::Schema.new test_client, '_yz_default'
86
- expect(existing_schema).to be_exists
87
-
88
- nonexistent_schema = Riak::Search::Schema.new(test_client, "nonexist-#{random_key}")
89
- expect(nonexistent_schema).to_not be_exists
90
- end
91
-
92
- it 'creates schemas' do
93
- new_schema = Riak::Search::Schema.new test_client, "search-spec-#{random_key}"
94
- expect(new_schema).to_not be_exist
95
- expect{ new_schema.create! schema_xml(new_schema.name) }.to_not raise_error
96
-
97
- wait_until{ new_schema.exists? }
98
-
99
- expect(new_schema).to be_exists
100
-
101
- expect{ new_schema.create! schema_xml(new_schema.name) }.to raise_error Riak::SearchError::SchemaExistsError
102
- end
103
- end
104
- end