riak-client 1.2.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +1 -7
- data/README.markdown +66 -0
- data/RELEASE_NOTES.md +27 -0
- data/lib/riak/bucket.rb +24 -5
- data/lib/riak/client.rb +42 -7
- data/lib/riak/client/beefcake/message_codes.rb +56 -0
- data/lib/riak/client/beefcake/messages.rb +190 -18
- data/lib/riak/client/beefcake_protobuffs_backend.rb +143 -10
- data/lib/riak/client/feature_detection.rb +26 -1
- data/lib/riak/client/http_backend.rb +58 -9
- data/lib/riak/client/http_backend/bucket_streamer.rb +15 -0
- data/lib/riak/client/http_backend/chunked_json_streamer.rb +42 -0
- data/lib/riak/client/http_backend/configuration.rb +17 -1
- data/lib/riak/client/http_backend/key_streamer.rb +4 -32
- data/lib/riak/client/protobuffs_backend.rb +12 -34
- data/lib/riak/counter.rb +101 -0
- data/lib/riak/index_collection.rb +71 -0
- data/lib/riak/list_buckets.rb +28 -0
- data/lib/riak/locale/en.yml +14 -0
- data/lib/riak/multiget.rb +123 -0
- data/lib/riak/node.rb +2 -0
- data/lib/riak/node/configuration.rb +32 -21
- data/lib/riak/node/defaults.rb +2 -0
- data/lib/riak/node/generation.rb +19 -7
- data/lib/riak/node/version.rb +2 -16
- data/lib/riak/robject.rb +1 -0
- data/lib/riak/secondary_index.rb +67 -0
- data/lib/riak/version.rb +1 -1
- data/riak-client.gemspec +3 -2
- data/spec/integration/riak/counters_spec.rb +51 -0
- data/spec/integration/riak/http_backends_spec.rb +24 -14
- data/spec/integration/riak/node_spec.rb +6 -28
- data/spec/riak/beefcake_protobuffs_backend_spec.rb +84 -0
- data/spec/riak/bucket_spec.rb +55 -5
- data/spec/riak/client_spec.rb +34 -0
- data/spec/riak/counter_spec.rb +122 -0
- data/spec/riak/index_collection_spec.rb +50 -0
- data/spec/riak/list_buckets_spec.rb +41 -0
- data/spec/riak/multiget_spec.rb +76 -0
- data/spec/riak/robject_spec.rb +4 -1
- data/spec/riak/secondary_index_spec.rb +225 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/sometimes.rb +2 -2
- data/spec/support/unified_backend_examples.rb +4 -0
- metadata +41 -47
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 31c844652f0920188a681f67ae0421582deb39e6
|
4
|
+
data.tar.gz: a61519055a317cc9a252bff17903bb08126f5abe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e76e0fe22bedb857baf87de6d99da8529eaccd79fc0fe39b78fe0f850b8d244193e24aa83481793ae5e1b80d09b578f1213efff2e360c6f51cac622e8d921bb1
|
7
|
+
data.tar.gz: cff6a9f0e542399e9249eb9ddf0258137c7f52dc33ff5ead84c16781a1c34d0fe49099256c95b134203b51a26d0f46a698596b8d9c958c37226fd0703dfe8c3d
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -12,6 +12,7 @@ end
|
|
12
12
|
|
13
13
|
platforms :mri do
|
14
14
|
gem 'yajl-ruby'
|
15
|
+
gem 'debugger'
|
15
16
|
end
|
16
17
|
|
17
18
|
platforms :jruby do
|
@@ -21,10 +22,3 @@ end
|
|
21
22
|
platforms :jruby, :rbx do
|
22
23
|
gem 'json'
|
23
24
|
end
|
24
|
-
# platforms :mri_18, :jruby do
|
25
|
-
# gem 'ruby-debug'
|
26
|
-
# end
|
27
|
-
|
28
|
-
# platforms :mri_19 do
|
29
|
-
# gem 'ruby-debug19'
|
30
|
-
# end
|
data/README.markdown
CHANGED
@@ -136,6 +136,72 @@ client['users'].enable_index!
|
|
136
136
|
client['users'].disable_index!
|
137
137
|
```
|
138
138
|
|
139
|
+
## Secondary Index Examples
|
140
|
+
|
141
|
+
Riak supports secondary indexes. Secondary indexing, or "2i," gives you the
|
142
|
+
ability to tag objects with multiple queryable values at write time, and then
|
143
|
+
query them later.
|
144
|
+
|
145
|
+
* [Using Secondary Indexes](http://docs.basho.com/riak/latest/dev/using/2i/)
|
146
|
+
* [Secondary Index implementation notes](http://docs.basho.com/riak/latest/dev/advanced/2i/)
|
147
|
+
|
148
|
+
### Tagging Objects
|
149
|
+
|
150
|
+
Objects are tagged with a hash kept behind the `indexes` method. Secondary index
|
151
|
+
storage logic is in `lib/riak/rcontent.rb`.
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
object = bucket.get_or_new 'cobb.salad'
|
155
|
+
|
156
|
+
# Indexes end with the "_bin" suffix to indicate they're binary or string
|
157
|
+
# indexes. They can have multiple values.
|
158
|
+
object.indexes[:ingredients_bin] = %w{lettuce tomato bacon egg chives}
|
159
|
+
|
160
|
+
# Indexes ending with the "_int" suffix are indexed as integers. They can
|
161
|
+
# have multiple values too.
|
162
|
+
object.indexes[:calories_int] = [220]
|
163
|
+
|
164
|
+
# You must re-save the object to store indexes.
|
165
|
+
object.store
|
166
|
+
```
|
167
|
+
|
168
|
+
### Finding Objects
|
169
|
+
|
170
|
+
Secondary index queries return a list of keys exactly matching a scalar or
|
171
|
+
within a range.
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
# The Bucket#get_index method allows querying by scalar...
|
175
|
+
bucket.get_index 'calories_int', 220 # => ['cobb.salad']
|
176
|
+
|
177
|
+
# or range.
|
178
|
+
bucket.get_index 'calories_int', 100..300 # => ['cobb.salad']
|
179
|
+
|
180
|
+
# Binary indexes also support both ranges and scalars.
|
181
|
+
bucket.get_index 'ingredients_bin', 'tomata'..'tomatz' # => ['cobb.salad']
|
182
|
+
|
183
|
+
# The collection from #get_index also provides a continuation for pagination:
|
184
|
+
c = bucket.get_index 'ingredients_bin', 'lettuce', max_results: 5
|
185
|
+
c.length # => 5
|
186
|
+
c.continuation # => "g2gCbQAAA="
|
187
|
+
|
188
|
+
# You can use that continuation to get the next page of results:
|
189
|
+
c2 = bucket.get_index 'ingredients_bin', 'lettuce', max_results: 5, continuation: c.continuation
|
190
|
+
|
191
|
+
# More complicated operations may benefit by using the `SecondaryIndex` object:
|
192
|
+
q = Riak::SecondaryIndex.new bucket, 'ingredients_bin', 'lettuce', max_results: 5
|
193
|
+
|
194
|
+
# SecondaryIndex objects give you access to the keys...
|
195
|
+
q.keys # => ['cobb.salad', 'wedge.salad', 'buffalo_chicken.wrap', ...]
|
196
|
+
|
197
|
+
# but can also fetch values for you in parallel.
|
198
|
+
q.values # => [<RObject {recipes,cobb.salad} ...>, <RObject {recipes,wedge...
|
199
|
+
|
200
|
+
# They also provide simpler pagination:
|
201
|
+
q.has_next_page? # => true
|
202
|
+
q2 = q.next_page
|
203
|
+
```
|
204
|
+
|
139
205
|
## How to Contribute
|
140
206
|
|
141
207
|
* Fork the project on [Github](http://github.com/basho/riak-ruby-client). If you have already forked, use `git pull --rebase` to reapply your changes on top of the mainline. Example:
|
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
# Riak Ruby Client Release Notes
|
2
2
|
|
3
|
+
## 1.4.0 Feature Release - 2013-08-16
|
4
|
+
|
5
|
+
Release 1.4.0 adds support for Riak 1.4 and fixes a few bugs.
|
6
|
+
|
7
|
+
Features for all Riak versions:
|
8
|
+
|
9
|
+
* Multi-get parallelizes fetching multiple objects from one or more
|
10
|
+
buckets.
|
11
|
+
|
12
|
+
Features for Riak 1.4 and newer:
|
13
|
+
|
14
|
+
* Bucket properties are settable and resettable over Protocol Buffers.
|
15
|
+
* Distributed counters are implemented by the `Riak::Counter` class.
|
16
|
+
* The full set of improvements to Secondary Indexes
|
17
|
+
are available, including pagination, streaming, and return_terms.
|
18
|
+
These features are available through the existing `Bucket#get_index`
|
19
|
+
interface as well as the new `Riak::SecondaryIndex` interface.
|
20
|
+
* The new streaming bucket list is available in the Ruby client.
|
21
|
+
* Setting timeout values for object CRUD, key listing, and bucket
|
22
|
+
listing is now possible.
|
23
|
+
|
24
|
+
Bugfixes:
|
25
|
+
|
26
|
+
* Tests pass and don't stall in Ruby 2.0.
|
27
|
+
* Zero-length key and bucket names are forbidden in the client.
|
28
|
+
* Test server works with Riak 1.4.
|
29
|
+
|
3
30
|
## 1.2.0 Feature Release - 2013-05-15
|
4
31
|
|
5
32
|
Release 1.2.0 adds support for Riak 1.3 and fixes a number of bugs.
|
data/lib/riak/bucket.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'riak/util/translation'
|
2
2
|
require 'riak/client'
|
3
3
|
require 'riak/robject'
|
4
|
+
require 'riak/counter'
|
4
5
|
require 'riak/failed_request'
|
5
6
|
|
6
7
|
module Riak
|
@@ -24,6 +25,7 @@ module Riak
|
|
24
25
|
def initialize(client, name)
|
25
26
|
raise ArgumentError, t("client_type", :client => client.inspect) unless Client === client
|
26
27
|
raise ArgumentError, t("string_type", :string => name.inspect) unless String === name
|
28
|
+
raise ArgumentError, t('zero_length_bucket') if name == ''
|
27
29
|
@client, @name = client, name
|
28
30
|
end
|
29
31
|
|
@@ -35,12 +37,12 @@ module Riak
|
|
35
37
|
# @return [Array<String>] Keys in this bucket
|
36
38
|
# @note This operation has serious performance implications and
|
37
39
|
# should not be used in production applications.
|
38
|
-
def keys(&block)
|
40
|
+
def keys(options={}, &block)
|
39
41
|
warn(t('list_keys', :backtrace => caller.join("\n "))) unless Riak.disable_list_keys_warnings
|
40
42
|
if block_given?
|
41
|
-
@client.list_keys(self, &block)
|
43
|
+
@client.list_keys(self, options, &block)
|
42
44
|
else
|
43
|
-
@client.list_keys(self)
|
45
|
+
@client.list_keys(self, options)
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
@@ -98,6 +100,15 @@ module Riak
|
|
98
100
|
end
|
99
101
|
alias :[] :get
|
100
102
|
|
103
|
+
# Retrieve multiple keys from this bucket.
|
104
|
+
# @param [Array<String>] array of keys to fetch
|
105
|
+
# @return [Hash<String, Riak::RObject>] hash of keys to objects
|
106
|
+
def get_many(keys)
|
107
|
+
pairs = keys.map{|k| [self, k]}
|
108
|
+
results = Multiget.get_all @client, pairs
|
109
|
+
results.keys.inject(Hash.new) { |mem, var| mem[var[1]] = results[var]; mem }
|
110
|
+
end
|
111
|
+
|
101
112
|
# Create a new blank object
|
102
113
|
# @param [String] key the key of the new object
|
103
114
|
# @return [RObject] the new, unsaved object
|
@@ -122,6 +133,14 @@ module Riak
|
|
122
133
|
end
|
123
134
|
end
|
124
135
|
|
136
|
+
# Gets a counter object. Counters initially hvae a value of zero, and can be
|
137
|
+
# incremented and decremented by integer values.
|
138
|
+
# @param [String] key the key of the counter to fetch
|
139
|
+
# @return [Counter]
|
140
|
+
def counter(key)
|
141
|
+
Riak::Counter.new self, key
|
142
|
+
end
|
143
|
+
|
125
144
|
# Checks whether an object exists in Riak.
|
126
145
|
# @param [String] key the key to check
|
127
146
|
# @param [Hash] options quorum options
|
@@ -155,8 +174,8 @@ module Riak
|
|
155
174
|
# Range of values to query
|
156
175
|
# @return [Array<String>] a list of keys that match the index
|
157
176
|
# query
|
158
|
-
def get_index(index, query)
|
159
|
-
client.get_index(self, index, query)
|
177
|
+
def get_index(index, query, options={})
|
178
|
+
client.get_index(self, index, query, options)
|
160
179
|
end
|
161
180
|
|
162
181
|
# @return [true, false] whether the bucket allows divergent siblings
|
data/lib/riak/client.rb
CHANGED
@@ -14,7 +14,10 @@ require 'riak/client/excon_backend'
|
|
14
14
|
require 'riak/client/protobuffs_backend'
|
15
15
|
require 'riak/client/beefcake_protobuffs_backend'
|
16
16
|
require 'riak/bucket'
|
17
|
+
require 'riak/multiget'
|
18
|
+
require 'riak/secondary_index'
|
17
19
|
require 'riak/stamp'
|
20
|
+
require 'riak/list_buckets'
|
18
21
|
|
19
22
|
module Riak
|
20
23
|
# A client connection to Riak.
|
@@ -70,6 +73,9 @@ module Riak
|
|
70
73
|
# @return [Client::Pool] A pool of protobuffs connections
|
71
74
|
attr_reader :protobuffs_pool
|
72
75
|
|
76
|
+
# @return [Integer] The number of threads for multiget requests
|
77
|
+
attr_reader :multiget_threads
|
78
|
+
|
73
79
|
# Creates a client connection to Riak
|
74
80
|
# @param [Hash] options configuration options for the client
|
75
81
|
# @option options [Array] :nodes A list of nodes this client connects to.
|
@@ -119,6 +125,7 @@ module Riak
|
|
119
125
|
self.protobuffs_backend = options[:protobuffs_backend] || :Beefcake
|
120
126
|
self.client_id = options[:client_id] if options[:client_id]
|
121
127
|
self.ssl = options[:ssl] if options[:ssl]
|
128
|
+
self.multiget_threads = options[:multiget_threads]
|
122
129
|
end
|
123
130
|
|
124
131
|
# Yields a backend for operations that are protocol-independent.
|
@@ -148,6 +155,7 @@ module Riak
|
|
148
155
|
# @option options [Boolean] :props (false) whether to retreive the bucket properties
|
149
156
|
# @return [Bucket] the requested bucket
|
150
157
|
def bucket(name, options={})
|
158
|
+
raise ArgumentError, t('zero_length_bucket') if name == ''
|
151
159
|
unless (options.keys - [:props]).empty?
|
152
160
|
raise ArgumentError, "invalid options"
|
153
161
|
end
|
@@ -162,10 +170,13 @@ module Riak
|
|
162
170
|
# @note This is an expensive operation and should be used only
|
163
171
|
# in development.
|
164
172
|
# @return [Array<Bucket>] a list of buckets
|
165
|
-
def buckets
|
173
|
+
def buckets(options={}, &block)
|
166
174
|
warn(t('list_buckets', :backtrace => caller.join("\n "))) unless Riak.disable_list_keys_warnings
|
175
|
+
|
176
|
+
return ListBuckets.new self, options, block if block_given?
|
177
|
+
|
167
178
|
backend do |b|
|
168
|
-
b.list_buckets.map {|name| Bucket.new(self, name) }
|
179
|
+
b.list_buckets(options).map {|name| Bucket.new(self, name) }
|
169
180
|
end
|
170
181
|
end
|
171
182
|
alias :list_buckets :buckets
|
@@ -187,6 +198,24 @@ module Riak
|
|
187
198
|
end
|
188
199
|
end
|
189
200
|
|
201
|
+
# Set the number of threads to use for multiget operations.
|
202
|
+
# If set to nil, defaults to twice the number of nodes.
|
203
|
+
# @param [Integer] count The number of threads to use.
|
204
|
+
# @raise [ArgumentError] when a non-nil, non-positive-Integer count is given
|
205
|
+
def multiget_threads=(count)
|
206
|
+
if count.nil?
|
207
|
+
@multiget_threads = nodes.length * 2
|
208
|
+
return
|
209
|
+
end
|
210
|
+
|
211
|
+
if count.is_a?(Integer) && count > 0
|
212
|
+
@multiget_threads = count
|
213
|
+
return
|
214
|
+
end
|
215
|
+
|
216
|
+
raise ArgumentError, t("invalid_multiget_thread_count")
|
217
|
+
end
|
218
|
+
|
190
219
|
# Set the client ID for this client. Must be a string or Fixnum value 0 =<
|
191
220
|
# value < MAX_CLIENT_ID.
|
192
221
|
# @param [String, Fixnum] value The internal client ID used by Riak to route responses
|
@@ -268,14 +297,20 @@ module Riak
|
|
268
297
|
end
|
269
298
|
|
270
299
|
# Queries a secondary index on a bucket. See Bucket#get_index
|
271
|
-
def get_index(bucket, index, query)
|
300
|
+
def get_index(bucket, index, query, options={})
|
272
301
|
backend do |b|
|
273
|
-
b.get_index bucket, index, query
|
302
|
+
b.get_index bucket, index, query, options
|
274
303
|
end
|
275
304
|
end
|
276
305
|
|
306
|
+
# Get multiple objects in parallel.
|
307
|
+
def get_many(pairs)
|
308
|
+
Multiget.get_all self, pairs
|
309
|
+
end
|
310
|
+
|
277
311
|
# Get an object. See Bucket#get
|
278
312
|
def get_object(bucket, key, options = {})
|
313
|
+
raise ArgumentError, t("zero_length_key") if key == ''
|
279
314
|
backend do |b|
|
280
315
|
b.fetch_object(bucket, key, options)
|
281
316
|
end
|
@@ -307,14 +342,14 @@ module Riak
|
|
307
342
|
end
|
308
343
|
|
309
344
|
# Retrieves a list of keys in the given bucket. See Bucket#keys
|
310
|
-
def list_keys(bucket, &block)
|
345
|
+
def list_keys(bucket, options={}, &block)
|
311
346
|
if block_given?
|
312
347
|
backend do |b|
|
313
|
-
b.list_keys bucket, &block
|
348
|
+
b.list_keys bucket, options, &block
|
314
349
|
end
|
315
350
|
else
|
316
351
|
backend do |b|
|
317
|
-
b.list_keys bucket
|
352
|
+
b.list_keys bucket, options
|
318
353
|
end
|
319
354
|
end
|
320
355
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Riak
|
2
|
+
class Client
|
3
|
+
module BeefcakeMessageCodes
|
4
|
+
MESSAGE_TO_CODE = {
|
5
|
+
:ErrorResp => 0,
|
6
|
+
:PingReq => 1,
|
7
|
+
:PingResp => 2,
|
8
|
+
:GetClientIdReq => 3,
|
9
|
+
:GetClientIdResp => 4,
|
10
|
+
:SetClientIdReq => 5,
|
11
|
+
:SetClientIdResp => 6,
|
12
|
+
:GetServerInfoReq => 7,
|
13
|
+
:GetServerInfoResp => 8,
|
14
|
+
:GetReq => 9,
|
15
|
+
:GetResp => 10,
|
16
|
+
:PutReq => 11,
|
17
|
+
:PutResp => 12,
|
18
|
+
:DelReq => 13,
|
19
|
+
:DelResp => 14,
|
20
|
+
:ListBucketsReq => 15,
|
21
|
+
:ListBucketsResp => 16,
|
22
|
+
:ListKeysReq => 17,
|
23
|
+
:ListKeysResp => 18,
|
24
|
+
:GetBucketReq => 19,
|
25
|
+
:GetBucketResp => 20,
|
26
|
+
:SetBucketReq => 21,
|
27
|
+
:SetBucketResp => 22,
|
28
|
+
:MapRedReq => 23,
|
29
|
+
:MapRedResp => 24,
|
30
|
+
:IndexReq => 25,
|
31
|
+
:IndexResp => 26,
|
32
|
+
:SearchQueryReq => 27,
|
33
|
+
:SearchQueryResp => 28,
|
34
|
+
:ResetBucketReq => 29,
|
35
|
+
:ResetBucketResp => 30,
|
36
|
+
:CSBucketReq => 40,
|
37
|
+
:CSBucketResp => 41,
|
38
|
+
:CounterUpdateReq => 50,
|
39
|
+
:CounterUpdateResp => 51,
|
40
|
+
:CounterGetReq => 52,
|
41
|
+
:CounterGetResp => 53,
|
42
|
+
}
|
43
|
+
|
44
|
+
CODE_TO_MESSAGE = MESSAGE_TO_CODE.invert
|
45
|
+
|
46
|
+
# ugly shims
|
47
|
+
def self.index(message_name)
|
48
|
+
MESSAGE_TO_CODE[message_name]
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.[](message_code)
|
52
|
+
CODE_TO_MESSAGE[message_code]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -11,10 +11,90 @@ module Riak
|
|
11
11
|
optional :value, :bytes, 2
|
12
12
|
end
|
13
13
|
|
14
|
+
# module-function pair for commit hooks and other properties that take
|
15
|
+
# functions
|
16
|
+
class RpbModFun
|
17
|
+
include Beefcake::Message
|
18
|
+
|
19
|
+
required :module, :bytes, 1
|
20
|
+
required :function, :bytes, 2
|
21
|
+
end
|
22
|
+
|
23
|
+
class RpbCommitHook
|
24
|
+
include Beefcake::Message
|
25
|
+
|
26
|
+
optional :modfun, RpbModFun, 1
|
27
|
+
optional :name, :bytes, 2
|
28
|
+
end
|
29
|
+
|
14
30
|
class RpbBucketProps
|
15
31
|
include Beefcake::Message
|
16
|
-
|
17
|
-
|
32
|
+
|
33
|
+
# riak_core_app
|
34
|
+
optional :n_val, :uint32, 1
|
35
|
+
optional :allow_mult, :bool, 2
|
36
|
+
optional :last_write_wins, :bool, 3
|
37
|
+
|
38
|
+
# riak_core values with special handling, see below
|
39
|
+
repeated :precommit, RpbCommitHook, 4
|
40
|
+
optional :has_precommit, :bool, 5, :default => false
|
41
|
+
repeated :postcommit, RpbCommitHook, 6
|
42
|
+
optional :has_postcommit, :bool, 7, :default => false
|
43
|
+
|
44
|
+
optional :chash_keyfun, RpbModFun, 8
|
45
|
+
|
46
|
+
# riak_kv_app
|
47
|
+
optional :linkfun, RpbModFun, 9
|
48
|
+
optional :old_vclock, :uint32, 10
|
49
|
+
optional :young_vclock, :uint32, 11
|
50
|
+
optional :big_vclock, :uint32, 12
|
51
|
+
optional :small_vclock, :uint32, 13
|
52
|
+
optional :pr, :uint32, 14
|
53
|
+
optional :r, :uint32, 15
|
54
|
+
optional :w, :uint32, 16
|
55
|
+
optional :pw, :uint32, 17
|
56
|
+
optional :dw, :uint32, 18
|
57
|
+
optional :rw, :uint32, 19
|
58
|
+
optional :basic_quorum, :bool, 20
|
59
|
+
optional :notfound_ok, :bool, 21
|
60
|
+
|
61
|
+
# riak_kv_multi_backend
|
62
|
+
optional :backend, :bytes, 22
|
63
|
+
|
64
|
+
# riak_search bucket fixup
|
65
|
+
optional :search, :bool, 23
|
66
|
+
|
67
|
+
module RpbReplMode
|
68
|
+
FALSE = 0
|
69
|
+
REALTIME = 1
|
70
|
+
FULLSYNC = 2
|
71
|
+
TRUE = 3
|
72
|
+
end
|
73
|
+
|
74
|
+
optional :repl, RpbReplMode, 24
|
75
|
+
|
76
|
+
# "repeated" elements with zero items are indistinguishable
|
77
|
+
# from a nil, so we have to manage has_precommit/has_postcommit
|
78
|
+
# flags.
|
79
|
+
def precommit=(newval)
|
80
|
+
@precommit = newval
|
81
|
+
@has_precommit = !!newval
|
82
|
+
end
|
83
|
+
|
84
|
+
def has_precommit=(newval)
|
85
|
+
@has_precommit = newval
|
86
|
+
@precommit ||= [] if newval
|
87
|
+
end
|
88
|
+
|
89
|
+
def postcommit=(newval)
|
90
|
+
@postcommit = newval
|
91
|
+
@has_postcommit = !!newval
|
92
|
+
end
|
93
|
+
|
94
|
+
def has_postcommit=(newval)
|
95
|
+
@has_postcommit = newval
|
96
|
+
@postcommit ||= [] if newval
|
97
|
+
end
|
18
98
|
end
|
19
99
|
|
20
100
|
class RpbLink
|
@@ -72,6 +152,9 @@ module Riak
|
|
72
152
|
optional :if_modified, :bytes, 7
|
73
153
|
optional :head, :bool, 8
|
74
154
|
optional :deletedvclock, :bool, 9
|
155
|
+
optional :timeout, :uint32, 10
|
156
|
+
optional :sloppy_quorum, :bool, 11
|
157
|
+
optional :n_val, :uint32, 12
|
75
158
|
end
|
76
159
|
|
77
160
|
class RpbGetResp
|
@@ -94,6 +177,10 @@ module Riak
|
|
94
177
|
optional :if_not_modified, :bool, 9
|
95
178
|
optional :if_none_match, :bool, 10
|
96
179
|
optional :return_head, :bool, 11
|
180
|
+
optional :timeout, :uint32, 12
|
181
|
+
optional :asis, :bool, 13
|
182
|
+
optional :sloppy_quorum, :bool, 14
|
183
|
+
optional :n_val, :uint32, 15
|
97
184
|
end
|
98
185
|
|
99
186
|
class RpbPutResp
|
@@ -105,25 +192,36 @@ module Riak
|
|
105
192
|
|
106
193
|
class RpbDelReq
|
107
194
|
include Beefcake::Message
|
108
|
-
required :bucket,
|
109
|
-
required :key,
|
110
|
-
optional :rw,
|
111
|
-
optional :vclock,
|
112
|
-
optional :r,
|
113
|
-
optional :w,
|
114
|
-
optional :pr,
|
115
|
-
optional :pw,
|
116
|
-
optional :dw,
|
195
|
+
required :bucket, :bytes, 1
|
196
|
+
required :key, :bytes, 2
|
197
|
+
optional :rw, :uint32, 3
|
198
|
+
optional :vclock, :bytes, 4
|
199
|
+
optional :r, :uint32, 5
|
200
|
+
optional :w, :uint32, 6
|
201
|
+
optional :pr, :uint32, 7
|
202
|
+
optional :pw, :uint32, 8
|
203
|
+
optional :dw, :uint32, 9
|
204
|
+
optional :timeout, :uint32, 10
|
205
|
+
optional :sloppy_quorum, :bool, 11
|
206
|
+
optional :n_val, :uint32, 12
|
207
|
+
end
|
208
|
+
|
209
|
+
class RpbListBucketsReq
|
210
|
+
include Beefcake::Message
|
211
|
+
optional :timeout, :uint32, 1
|
212
|
+
optional :stream, :bool, 2
|
117
213
|
end
|
118
214
|
|
119
215
|
class RpbListBucketsResp
|
120
216
|
include Beefcake::Message
|
121
217
|
repeated :buckets, :bytes, 1
|
218
|
+
optional :done, :bool, 2
|
122
219
|
end
|
123
220
|
|
124
221
|
class RpbListKeysReq
|
125
222
|
include Beefcake::Message
|
126
223
|
required :bucket, :bytes, 1
|
224
|
+
optional :timeout, :uint32, 2
|
127
225
|
end
|
128
226
|
|
129
227
|
class RpbListKeysResp
|
@@ -148,6 +246,11 @@ module Riak
|
|
148
246
|
required :props, RpbBucketProps, 2
|
149
247
|
end
|
150
248
|
|
249
|
+
class RpbResetBucketReq
|
250
|
+
include Beefcake::Message
|
251
|
+
required :bucket, :bytes, 1
|
252
|
+
end
|
253
|
+
|
151
254
|
class RpbMapRedReq
|
152
255
|
include Beefcake::Message
|
153
256
|
required :request, :bytes, 1
|
@@ -168,17 +271,25 @@ module Riak
|
|
168
271
|
RANGE = 1
|
169
272
|
end
|
170
273
|
|
171
|
-
required :bucket,
|
172
|
-
required :index,
|
173
|
-
required :qtype,
|
174
|
-
optional :key,
|
175
|
-
optional :range_min,
|
176
|
-
optional :range_max,
|
274
|
+
required :bucket, :bytes, 1
|
275
|
+
required :index, :bytes, 2
|
276
|
+
required :qtype, IndexQueryType, 3
|
277
|
+
optional :key, :bytes, 4
|
278
|
+
optional :range_min, :bytes, 5
|
279
|
+
optional :range_max, :bytes, 6
|
280
|
+
optional :return_terms, :bool, 7
|
281
|
+
optional :stream, :bool, 8
|
282
|
+
optional :max_results, :uint32, 9
|
283
|
+
optional :continuation, :bytes, 10
|
284
|
+
optional :timeout, :uint32, 11
|
177
285
|
end
|
178
286
|
|
179
287
|
class RpbIndexResp
|
180
288
|
include Beefcake::Message
|
181
|
-
repeated :keys,
|
289
|
+
repeated :keys, :bytes, 1
|
290
|
+
repeated :results, RpbPair, 2
|
291
|
+
optional :continuation, :bytes, 3
|
292
|
+
optional :done, :bool, 4
|
182
293
|
end
|
183
294
|
|
184
295
|
class RpbSearchDoc
|
@@ -208,6 +319,67 @@ module Riak
|
|
208
319
|
optional :max_score, :float, 2
|
209
320
|
optional :num_found, :uint32, 3
|
210
321
|
end
|
322
|
+
|
323
|
+
class RpbResetBucketReq
|
324
|
+
include Beefcake::Message
|
325
|
+
required :bucket, :bytes, 1
|
326
|
+
end
|
327
|
+
|
328
|
+
class RpbCSBucketReq
|
329
|
+
include Beefcake::Message
|
330
|
+
required :bucket, :bytes, 1
|
331
|
+
required :start_key, :bytes, 2
|
332
|
+
optional :end_key, :bytes, 3
|
333
|
+
optional :start_incl, :bool, 4, default: true
|
334
|
+
optional :end_incl, :bool, 5, default: false
|
335
|
+
optional :continuation, :bytes, 6
|
336
|
+
optional :max_results, :uint32, 7
|
337
|
+
optional :timeout, :uint32, 8
|
338
|
+
end
|
339
|
+
|
340
|
+
class RpbIndexObject
|
341
|
+
include Beefcake::Message
|
342
|
+
required :key, :bytes, 1
|
343
|
+
required :object, RpbGetResp, 2
|
344
|
+
end
|
345
|
+
|
346
|
+
class RpbCSBucketResp
|
347
|
+
include Beefcake::Message
|
348
|
+
repeated :objects, RpbIndexObject, 1
|
349
|
+
optional :continuation, :bytes, 2
|
350
|
+
optional :done, :bool, 3
|
351
|
+
end
|
352
|
+
|
353
|
+
class RpbCounterUpdateReq
|
354
|
+
include Beefcake::Message
|
355
|
+
required :bucket, :bytes, 1
|
356
|
+
required :key, :bytes, 2
|
357
|
+
required :amount, :sint64, 3
|
358
|
+
optional :w, :uint32, 4
|
359
|
+
optional :dw, :uint32, 5
|
360
|
+
optional :pw, :uint32, 6
|
361
|
+
optional :returnvalue, :bool, 7
|
362
|
+
end
|
363
|
+
|
364
|
+
class RpbCounterUpdateResp
|
365
|
+
include Beefcake::Message
|
366
|
+
optional :value, :sint64, 1
|
367
|
+
end
|
368
|
+
|
369
|
+
class RpbCounterGetReq
|
370
|
+
include Beefcake::Message
|
371
|
+
required :bucket, :bytes, 1
|
372
|
+
required :key, :bytes, 2
|
373
|
+
optional :r, :uint32, 3
|
374
|
+
optional :pr, :uint32, 4
|
375
|
+
optional :basic_quorum, :bool, 5
|
376
|
+
optional :notfound_ok, :bool, 6
|
377
|
+
end
|
378
|
+
|
379
|
+
class RpbCounterGetResp
|
380
|
+
include Beefcake::Message
|
381
|
+
optional :value, :sint64, 1
|
382
|
+
end
|
211
383
|
end
|
212
384
|
end
|
213
385
|
end
|