riak-client 2.0.0 → 2.1.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/README.markdown +55 -12
- data/RELEASE_NOTES.md +20 -1
- data/lib/riak.rb +1 -0
- data/lib/riak/client.rb +2 -1
- data/lib/riak/client/beefcake/crdt/counter_loader.rb +18 -0
- data/lib/riak/client/beefcake/crdt/map_loader.rb +64 -0
- data/lib/riak/client/beefcake/crdt/set_loader.rb +18 -0
- data/lib/riak/client/beefcake/crdt_loader.rb +16 -59
- data/lib/riak/client/beefcake/crdt_operator.rb +2 -1
- data/lib/riak/client/instrumentation.rb +19 -0
- data/lib/riak/crdt/base.rb +16 -0
- data/lib/riak/errors/backend_creation.rb +9 -0
- data/lib/riak/instrumentation.rb +6 -0
- data/lib/riak/version.rb +1 -1
- data/riak-client.gemspec +3 -2
- data/spec/integration/riak/counters_spec.rb +1 -1
- data/spec/integration/riak/crdt_spec.rb +68 -23
- data/spec/integration/riak/protobuffs_backends_spec.rb +1 -1
- data/spec/integration/riak/threading_spec.rb +4 -4
- data/spec/integration/yokozuna/index_spec.rb +5 -5
- data/spec/integration/yokozuna/queries_spec.rb +15 -16
- data/spec/integration/yokozuna/schema_spec.rb +2 -2
- data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +8 -8
- data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +1 -1
- data/spec/riak/beefcake_protobuffs_backend_spec.rb +8 -8
- data/spec/riak/bucket_spec.rb +38 -38
- data/spec/riak/client_spec.rb +26 -27
- data/spec/riak/core_ext/to_param_spec.rb +2 -2
- data/spec/riak/counter_spec.rb +11 -11
- data/spec/riak/crdt/counter_spec.rb +4 -2
- data/spec/riak/crdt/inner_counter_spec.rb +1 -1
- data/spec/riak/crdt/inner_flag_spec.rb +4 -4
- data/spec/riak/crdt/inner_map_spec.rb +3 -3
- data/spec/riak/crdt/inner_register_spec.rb +5 -5
- data/spec/riak/crdt/inner_set_spec.rb +1 -1
- data/spec/riak/crdt/map_spec.rb +2 -2
- data/spec/riak/crdt/set_spec.rb +4 -2
- data/spec/riak/crdt/shared_examples.rb +15 -15
- data/spec/riak/crdt/typed_collection_spec.rb +16 -22
- data/spec/riak/escape_spec.rb +10 -10
- data/spec/riak/feature_detection_spec.rb +1 -1
- data/spec/riak/index_collection_spec.rb +7 -4
- data/spec/riak/instrumentation_spec.rb +124 -0
- data/spec/riak/link_spec.rb +12 -12
- data/spec/riak/list_buckets_spec.rb +2 -2
- data/spec/riak/map_reduce/filter_builder_spec.rb +5 -5
- data/spec/riak/map_reduce/phase_spec.rb +20 -20
- data/spec/riak/map_reduce_spec.rb +50 -50
- data/spec/riak/multiget_spec.rb +5 -5
- data/spec/riak/node_spec.rb +3 -3
- data/spec/riak/robject_spec.rb +46 -45
- data/spec/riak/search_spec.rb +11 -11
- data/spec/riak/secondary_index_spec.rb +9 -9
- data/spec/riak/stamp_spec.rb +5 -5
- data/spec/riak/walk_spec_spec.rb +30 -30
- data/spec/spec_helper.rb +6 -0
- data/spec/support/certs/ca.crt +19 -20
- data/spec/support/certs/client.crl +13 -0
- data/spec/support/certs/client.crt +68 -69
- data/spec/support/certs/client.csr +18 -0
- data/spec/support/certs/client.key +25 -25
- data/spec/support/certs/server.crl +11 -11
- data/spec/support/certs/server.crt +68 -69
- data/spec/support/certs/server.key +25 -25
- data/spec/support/unified_backend_examples.rb +33 -33
- metadata +31 -5
data/lib/riak/version.rb
CHANGED
data/riak-client.gemspec
CHANGED
@@ -15,12 +15,13 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.required_ruby_version = '>= 1.9.3'
|
16
16
|
|
17
17
|
# Deps
|
18
|
-
gem.add_development_dependency "rspec", "~> 3.0
|
18
|
+
gem.add_development_dependency "rspec", "~> 3.0"
|
19
19
|
gem.add_development_dependency 'rake', '~> 10.1.1'
|
20
20
|
gem.add_development_dependency 'yard', '~> 0.8.7'
|
21
21
|
gem.add_development_dependency 'kramdown', '~> 1.4'
|
22
22
|
gem.add_development_dependency 'simplecov', '~> 0.8.2'
|
23
|
-
|
23
|
+
gem.add_development_dependency "instrumentable", "~> 1.1.0"
|
24
|
+
|
24
25
|
gem.add_runtime_dependency "i18n", ">=0.4.0"
|
25
26
|
gem.add_runtime_dependency "beefcake", "~> 1.0"
|
26
27
|
gem.add_runtime_dependency "multi_json", "~>1.0"
|
@@ -5,17 +5,17 @@ describe "CRDTs", integration: true, test_client: true do
|
|
5
5
|
let(:bucket) { random_bucket }
|
6
6
|
|
7
7
|
describe 'configuration' do
|
8
|
-
it "
|
8
|
+
it "allows default bucket-types to be configured for each data type" do
|
9
9
|
expect(Riak::Crdt::Set.new(bucket, 'set').bucket_type).to eq 'sets'
|
10
|
-
|
10
|
+
|
11
11
|
Riak::Crdt::DEFAULT_BUCKET_TYPES[:set] = 'new_set_default'
|
12
12
|
expect(Riak::Crdt::Set.new(bucket, 'set').bucket_type).to eq 'new_set_default'
|
13
13
|
|
14
14
|
Riak::Crdt::DEFAULT_BUCKET_TYPES[:set] = 'sets'
|
15
15
|
expect(Riak::Crdt::Set.new(bucket, 'set').bucket_type).to eq 'sets'
|
16
16
|
end
|
17
|
-
|
18
|
-
it "
|
17
|
+
|
18
|
+
it "allows override bucket-types for instances" do
|
19
19
|
expect(Riak::Crdt::Set.new(bucket, 'set', 'other_bucket_type').bucket_type).to eq 'other_bucket_type'
|
20
20
|
end
|
21
21
|
end
|
@@ -48,10 +48,10 @@ describe "CRDTs", integration: true, test_client: true do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
describe 'counters' do
|
53
53
|
subject { Riak::Crdt::Counter.new bucket, random_key }
|
54
|
-
it '
|
54
|
+
it 'allows straightforward counter ops' do
|
55
55
|
start = subject.value
|
56
56
|
subject.increment
|
57
57
|
expect(subject.value).to eq(start + 1)
|
@@ -62,8 +62,8 @@ describe "CRDTs", integration: true, test_client: true do
|
|
62
62
|
subject.decrement
|
63
63
|
expect(subject.value).to eq(start)
|
64
64
|
end
|
65
|
-
|
66
|
-
it '
|
65
|
+
|
66
|
+
it 'allows batched counter ops' do
|
67
67
|
start = subject.value
|
68
68
|
subject.batch do |s|
|
69
69
|
s.increment
|
@@ -73,12 +73,27 @@ describe "CRDTs", integration: true, test_client: true do
|
|
73
73
|
end
|
74
74
|
expect(subject.value).to eq(start + 5)
|
75
75
|
end
|
76
|
+
|
77
|
+
it 'asks for and accepts a returned body by default' do
|
78
|
+
other = Riak::Crdt::Counter.new subject.bucket, subject.key
|
79
|
+
|
80
|
+
start = subject.value
|
81
|
+
|
82
|
+
expect(subject.value).to eq start
|
83
|
+
|
84
|
+
other.increment 10
|
85
|
+
|
86
|
+
subject.increment 1
|
87
|
+
|
88
|
+
expect(subject.dirty?).to_not be
|
89
|
+
expect(subject.value).to eq(start + 10 + 1)
|
90
|
+
end
|
76
91
|
end
|
77
92
|
describe 'sets' do
|
78
93
|
|
79
94
|
subject { Riak::Crdt::Set.new bucket, random_key }
|
80
|
-
|
81
|
-
it '
|
95
|
+
|
96
|
+
it 'allows straightforward set ops' do
|
82
97
|
start = subject.members
|
83
98
|
addition = random_key
|
84
99
|
|
@@ -91,7 +106,7 @@ describe "CRDTs", integration: true, test_client: true do
|
|
91
106
|
expect(subject.members).to_not include(addition)
|
92
107
|
expect(subject.members).to eq(start)
|
93
108
|
end
|
94
|
-
|
109
|
+
|
95
110
|
it 'lets Riak silently accept removals after reload' do
|
96
111
|
addition = random_key
|
97
112
|
subject.add addition
|
@@ -104,10 +119,10 @@ describe "CRDTs", integration: true, test_client: true do
|
|
104
119
|
expect{ other.remove 'an element not in the set' }.to_not raise_error
|
105
120
|
end
|
106
121
|
|
107
|
-
it '
|
122
|
+
it 'allows batched set ops' do
|
108
123
|
subject.add 'zero'
|
109
124
|
subject.reload
|
110
|
-
|
125
|
+
|
111
126
|
subject.batch do |s|
|
112
127
|
s.add 'first'
|
113
128
|
s.remove 'zero'
|
@@ -115,11 +130,26 @@ describe "CRDTs", integration: true, test_client: true do
|
|
115
130
|
|
116
131
|
expect(subject.members.to_a).to eq %w{first}
|
117
132
|
end
|
133
|
+
|
134
|
+
it 'asks for and accepts a returned body by default' do
|
135
|
+
other = Riak::Crdt::Set.new subject.bucket, subject.key
|
136
|
+
|
137
|
+
expect(subject.include? 'coffee').to_not be
|
138
|
+
expect(other.include? 'coffee').to_not be
|
139
|
+
|
140
|
+
other.add 'coffee'
|
141
|
+
subject.add 'tea'
|
142
|
+
|
143
|
+
expect(subject.dirty?).to_not be
|
144
|
+
|
145
|
+
expect(other.include? 'coffee').to be
|
146
|
+
expect(subject.include? 'coffee').to be
|
147
|
+
end
|
118
148
|
end
|
119
149
|
describe 'maps' do
|
120
150
|
subject { Riak::Crdt::Map.new bucket, random_key }
|
121
|
-
|
122
|
-
it '
|
151
|
+
|
152
|
+
it 'allows straightforward map ops' do
|
123
153
|
subject.registers['first'] = 'hello'
|
124
154
|
expect(subject.registers['first']).to eq('hello')
|
125
155
|
|
@@ -150,8 +180,8 @@ describe "CRDTs", integration: true, test_client: true do
|
|
150
180
|
subject.flags.delete 'yes'
|
151
181
|
end.to_not raise_error
|
152
182
|
end
|
153
|
-
|
154
|
-
it '
|
183
|
+
|
184
|
+
it 'allows batched map ops' do
|
155
185
|
subject.batch do |s|
|
156
186
|
s.registers['condiment'] = 'ketchup'
|
157
187
|
s.counters['banana'].increment
|
@@ -160,9 +190,24 @@ describe "CRDTs", integration: true, test_client: true do
|
|
160
190
|
expect(subject.registers['condiment']).to eq 'ketchup'
|
161
191
|
expect(subject.counters['banana'].value).to eq 1
|
162
192
|
end
|
163
|
-
|
193
|
+
|
194
|
+
it 'asks for and accepts a returned body by default' do
|
195
|
+
other = Riak::Crdt::Map.new subject.bucket, subject.key
|
196
|
+
|
197
|
+
expect(subject.sets['bees'].include? 'honey').to_not be
|
198
|
+
expect(other.sets['bees'].include? 'honey').to_not be
|
199
|
+
|
200
|
+
other.sets['bees'].add 'honey'
|
201
|
+
subject.counters['stings'].increment
|
202
|
+
|
203
|
+
expect(subject.dirty?).to_not be
|
204
|
+
|
205
|
+
expect(other.sets['bees'].include? 'honey').to be
|
206
|
+
expect(subject.sets['bees'].include? 'honey').to be
|
207
|
+
end
|
208
|
+
|
164
209
|
describe 'containing a map' do
|
165
|
-
it '
|
210
|
+
it 'bubbles straightforward map ops up' do
|
166
211
|
street_map = subject.maps['street']
|
167
212
|
|
168
213
|
street_map.registers['bird'] = 'avenue'
|
@@ -170,8 +215,8 @@ describe "CRDTs", integration: true, test_client: true do
|
|
170
215
|
|
171
216
|
expect(subject.maps['street'])
|
172
217
|
end
|
173
|
-
|
174
|
-
it '
|
218
|
+
|
219
|
+
it 'includes inner-map ops in the outer-map batch' do
|
175
220
|
subject.batch do |m|
|
176
221
|
m.maps['road'].counters['speedbumps'].increment 4
|
177
222
|
m.maps['road'].sets['signs'].add 'yield'
|
@@ -183,7 +228,7 @@ describe "CRDTs", integration: true, test_client: true do
|
|
183
228
|
end
|
184
229
|
|
185
230
|
describe 'containing a register' do
|
186
|
-
it '
|
231
|
+
it 'bubbles straightforward register ops up' do
|
187
232
|
subject.registers['hkey_local_machine'] = 'registry'
|
188
233
|
|
189
234
|
expect(subject.registers['hkey_local_machine']).to eq 'registry'
|
@@ -191,7 +236,7 @@ describe "CRDTs", integration: true, test_client: true do
|
|
191
236
|
end
|
192
237
|
|
193
238
|
describe 'containing a flag' do
|
194
|
-
it '
|
239
|
+
it 'bubbles straightforward flag ops up' do
|
195
240
|
subject.flags['enable_magic'] = true
|
196
241
|
|
197
242
|
expect(subject.flags['enable_magic']).to be
|
@@ -19,7 +19,7 @@ describe "Protocol Buffers", test_client: true do
|
|
19
19
|
describe "searching yokozuna" do
|
20
20
|
include_context "search corpus setup"
|
21
21
|
|
22
|
-
it '
|
22
|
+
it 'returns documents with UTF-8 fields (GH #75)' do
|
23
23
|
utf8 = Encoding.find('UTF-8')
|
24
24
|
results = @backend.search @search_bucket.name, 'fearless elephant rushed', df: 'text'
|
25
25
|
results['docs'].each do |d|
|
@@ -62,7 +62,7 @@ describe "Multithreaded client", :test_client => true do
|
|
62
62
|
@bucket = random_bucket 'threading'
|
63
63
|
end
|
64
64
|
|
65
|
-
it '
|
65
|
+
it 'gets in parallel' do
|
66
66
|
data = "the gun is good"
|
67
67
|
ro = @bucket.new('test')
|
68
68
|
ro.content_type = "application/json"
|
@@ -76,7 +76,7 @@ describe "Multithreaded client", :test_client => true do
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
it '
|
79
|
+
it 'puts in parallel' do
|
80
80
|
data = "the tabernacle is indestructible and everlasting"
|
81
81
|
|
82
82
|
n = 10
|
@@ -97,7 +97,7 @@ describe "Multithreaded client", :test_client => true do
|
|
97
97
|
# This is a 1.0+ spec because putting with the same client ID
|
98
98
|
# will not create siblings on 0.14 in the same way. This will
|
99
99
|
# also likely fail for nodes with vnode_vclocks = false.
|
100
|
-
it '
|
100
|
+
it 'puts conflicts in parallel' do
|
101
101
|
@bucket.allow_mult = true
|
102
102
|
expect(@bucket.allow_mult).to eq(true)
|
103
103
|
|
@@ -123,7 +123,7 @@ describe "Multithreaded client", :test_client => true do
|
|
123
123
|
end.to_set).to eq((0...n).to_set)
|
124
124
|
end
|
125
125
|
|
126
|
-
it '
|
126
|
+
it 'lists-keys and gets in parallel', :slow => true do
|
127
127
|
count = 100
|
128
128
|
threads = 2
|
129
129
|
|
@@ -10,7 +10,7 @@ describe "Yokozuna", test_client: true, integration: true do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
context "without any indexes" do
|
13
|
-
it "
|
13
|
+
it "allows index creation" do
|
14
14
|
expect(@client.create_search_index(@index, "_yz_default", 3)).to eq(true)
|
15
15
|
end
|
16
16
|
end
|
@@ -21,16 +21,16 @@ describe "Yokozuna", test_client: true, integration: true do
|
|
21
21
|
wait_until{ !@client.get_search_index(@index).nil? }
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "allows index inspection" do
|
25
25
|
expect(@client.get_search_index(@index).name).to eq(@index)
|
26
26
|
expect{ @client.get_search_index("herp_derp") }.to raise_error(Riak::ProtobuffsFailedRequest)
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "has an index list" do
|
30
30
|
expect(@client.list_search_indexes.size).to be >= 1
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "associates a bucket with an index" do
|
34
34
|
@bucket = Riak::Bucket.new(@client, @index)
|
35
35
|
@bucket.props = {'search_index' => @index}
|
36
36
|
@bucket = @client.bucket(@index)
|
@@ -45,7 +45,7 @@ describe "Yokozuna", test_client: true, integration: true do
|
|
45
45
|
expect(@bucket.props).to include('search_index' => @index)
|
46
46
|
end
|
47
47
|
|
48
|
-
it "
|
48
|
+
it "indexes on object writes" do
|
49
49
|
object = @bucket.get_or_new("cat")
|
50
50
|
object.raw_data = {"cat_s"=>"Lela"}.to_json
|
51
51
|
object.content_type = 'application/json'
|
@@ -31,72 +31,71 @@ describe "Yokozuna queries", test_client: true, integration: true do
|
|
31
31
|
wait_until { @client.search(@index, "username_s:Z")['docs'].length > 0 }
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "produces results on single term queries" do
|
35
35
|
resp = @client.search(@index, "username_s:Z")
|
36
36
|
expect(resp).to include('docs')
|
37
37
|
expect(resp['docs'].size).to eq(1)
|
38
38
|
end
|
39
39
|
|
40
|
-
it "
|
40
|
+
it "produces results on multiple term queries" do
|
41
41
|
resp = @client.search(@index, "username_s:(F OR H)")
|
42
42
|
expect(resp).to include('docs')
|
43
43
|
expect(resp['docs'].size).to eq(2)
|
44
44
|
end
|
45
45
|
|
46
|
-
it "
|
46
|
+
it "produces results on queries with boolean logic" do
|
47
47
|
resp = @client.search(@index, "username_s:Z AND name_s:ryan")
|
48
48
|
expect(resp).to include('docs')
|
49
49
|
expect(resp['docs'].size).to eq(1)
|
50
50
|
end
|
51
51
|
|
52
|
-
it "
|
52
|
+
it "produces results on range queries" do
|
53
53
|
resp = @client.search(@index, "age_i:[30 TO 33]")
|
54
54
|
expect(resp).to include('docs')
|
55
55
|
expect(resp['docs'].size).to eq(2)
|
56
56
|
end
|
57
57
|
|
58
|
-
it "
|
58
|
+
it "produces results on phrase queries" do
|
59
59
|
resp = @client.search(@index, 'name_s:"bryan fink"')
|
60
60
|
expect(resp).to include('docs')
|
61
61
|
expect(resp['docs'].size).to eq(1)
|
62
62
|
end
|
63
63
|
|
64
|
-
it "
|
64
|
+
it "produces results on wildcard queries" do
|
65
65
|
resp = @client.search(@index, "name_s:*ryan*")
|
66
66
|
expect(resp).to include('docs')
|
67
67
|
expect(resp['docs'].size).to eq(2)
|
68
68
|
end
|
69
69
|
|
70
|
-
it "
|
70
|
+
it "produces results on regexp queries" do
|
71
71
|
resp = @client.search(@index, "name_s:/br.*/")
|
72
72
|
expect(resp).to include('docs')
|
73
73
|
expect(resp['docs'].size).to eq(2)
|
74
74
|
end
|
75
75
|
|
76
|
-
|
77
|
-
it "should support utf8" do
|
76
|
+
it "supports utf8" do
|
78
77
|
build_json_obj(@bucket, "ja", {"text_ja"=>"私はハイビスカスを食べるのが 大好き"})
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
sleep 1.1 # pause for index commit to trigger
|
79
|
+
resp = @client.search(@index, "text_ja:大好き")
|
80
|
+
expect(resp).to include('docs')
|
81
|
+
expect(resp['docs'].size).to eq 1
|
83
82
|
end
|
84
83
|
|
85
84
|
context "using parameters" do
|
86
|
-
it "
|
85
|
+
it "searches one row" do
|
87
86
|
resp = @client.search(@index, "*:*", {:rows => 1})
|
88
87
|
expect(resp).to include('docs')
|
89
88
|
expect(resp['docs'].size).to eq(1)
|
90
89
|
end
|
91
90
|
|
92
|
-
it "
|
91
|
+
it "searches with df" do
|
93
92
|
resp = @client.search(@index, "Olive", {:rows => 1, :df => 'dog_ss'})
|
94
93
|
expect(resp).to include('docs')
|
95
94
|
expect(resp['docs'].size).to eq(1)
|
96
95
|
resp['docs'].first['dog_ss']
|
97
96
|
end
|
98
97
|
|
99
|
-
it "
|
98
|
+
it "produces top result on sort" do
|
100
99
|
resp = @client.search(@index, "username_s:*", {:sort => "age_i asc"})
|
101
100
|
expect(resp).to include('docs')
|
102
101
|
expect(resp['docs'].first['age_i'].to_i).to eq(14)
|
@@ -10,14 +10,14 @@ describe "Yokozuna", test_client: true, integration: true do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
context 'with no schema' do
|
13
|
-
it '
|
13
|
+
it 'allows schema creation' do
|
14
14
|
@client.create_search_schema(@schema, SCHEMA_CONTENT)
|
15
15
|
wait_until{ !@client.get_search_schema(@schema).nil? }
|
16
16
|
expect(@client.get_search_schema(@schema)).not_to be_nil
|
17
17
|
end
|
18
18
|
end
|
19
19
|
context 'with a schema' do
|
20
|
-
it '
|
20
|
+
it 'has a readable schema' do
|
21
21
|
@client.create_search_schema(@schema, SCHEMA_CONTENT)
|
22
22
|
wait_until{ !@client.get_search_schema(@schema).nil? }
|
23
23
|
schema_resp = @client.get_search_schema(@schema)
|
@@ -17,7 +17,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend::CrdtOperator do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
it '
|
20
|
+
it 'serializes a counter operation into protobuffs' do
|
21
21
|
result = subject.serialize operation
|
22
22
|
|
23
23
|
expect(result).to be_a backend_class::DtOp
|
@@ -25,7 +25,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend::CrdtOperator do
|
|
25
25
|
expect(result.counter_op.increment).to eq increment
|
26
26
|
end
|
27
27
|
|
28
|
-
it '
|
28
|
+
it 'serializes multiple counter operations into protobuffs' do
|
29
29
|
result = subject.serialize [operation, operation]
|
30
30
|
|
31
31
|
expect{result.encode}.to_not raise_error
|
@@ -49,7 +49,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend::CrdtOperator do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
it '
|
52
|
+
it 'serializes a set operation into protobuffs' do
|
53
53
|
result = subject.serialize operation
|
54
54
|
|
55
55
|
expect{result.encode}.to_not raise_error
|
@@ -62,7 +62,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend::CrdtOperator do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
describe 'operating on a map' do
|
65
|
-
it '
|
65
|
+
it 'serializes inner counter operations' do
|
66
66
|
counter_op = Riak::Crdt::Operation::Update.new.tap do |op|
|
67
67
|
op.name = 'inner_counter'
|
68
68
|
op.type = :counter
|
@@ -85,7 +85,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend::CrdtOperator do
|
|
85
85
|
expect(map_update.counter_op.increment).to eq 12345
|
86
86
|
end
|
87
87
|
|
88
|
-
it '
|
88
|
+
it 'serializes inner flag operations' do
|
89
89
|
flag_op = Riak::Crdt::Operation::Update.new.tap do |op|
|
90
90
|
op.name = 'inner_flag'
|
91
91
|
op.type = :flag
|
@@ -127,7 +127,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend::CrdtOperator do
|
|
127
127
|
expect(map_update.flag_op).to eq backend_class::MapUpdate::FlagOp::DISABLE
|
128
128
|
end
|
129
129
|
|
130
|
-
it '
|
130
|
+
it 'serializes inner register operations' do
|
131
131
|
register_op = Riak::Crdt::Operation::Update.new.tap do |op|
|
132
132
|
op.name = 'inner_register'
|
133
133
|
op.type = :register
|
@@ -169,7 +169,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend::CrdtOperator do
|
|
169
169
|
expect(map_delete.type).to eq backend_class::MapField::MapFieldType::REGISTER
|
170
170
|
end
|
171
171
|
|
172
|
-
it '
|
172
|
+
it 'serializes inner set operations' do
|
173
173
|
set_op = Riak::Crdt::Operation::Update.new.tap do |op|
|
174
174
|
op.name = 'inner_set'
|
175
175
|
op.type = :set
|
@@ -191,7 +191,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend::CrdtOperator do
|
|
191
191
|
expect(map_update.set_op.adds).to eq 'added_member'
|
192
192
|
end
|
193
193
|
|
194
|
-
it '
|
194
|
+
it 'serializes inner map operations' do
|
195
195
|
register_op = Riak::Crdt::Operation::Update.new.tap do |op|
|
196
196
|
op.name = 'inner_inner_register'
|
197
197
|
op.type = :register
|