Class: Riak::Client::BeefcakeProtobuffsBackend
- Inherits:
-
ProtobuffsBackend
show all
- Includes:
- ObjectMethods
- Defined in:
- lib/riak/client/beefcake/messages.rb,
lib/riak/client/beefcake/socket.rb,
lib/riak/client/beefcake/operator.rb,
lib/riak/client/beefcake/protocol.rb,
lib/riak/client/beefcake/crdt_loader.rb,
lib/riak/client/beefcake/crdt_operator.rb,
lib/riak/client/beefcake/ts_cell_codec.rb,
lib/riak/client/beefcake/object_methods.rb,
lib/riak/client/beefcake/crdt/map_loader.rb,
lib/riak/client/beefcake/crdt/set_loader.rb,
lib/riak/client/beefcake/message_overlay.rb,
lib/riak/client/beefcake_protobuffs_backend.rb,
lib/riak/client/beefcake/crdt/counter_loader.rb,
lib/riak/client/beefcake/time_series_get_operator.rb,
lib/riak/client/beefcake/time_series_put_operator.rb,
lib/riak/client/beefcake/crdt/hyper_log_log_loader.rb,
lib/riak/client/beefcake/time_series_list_operator.rb,
lib/riak/client/beefcake/bucket_properties_operator.rb,
lib/riak/client/beefcake/time_series_query_operator.rb,
lib/riak/client/beefcake/time_series_delete_operator.rb
Defined Under Namespace
Modules: ObjectMethods, TsColumnType
Classes: BeefcakeSocket, BucketPropertiesOperator, CounterOp, CrdtLoader, CrdtOperator, DtFetchReq, DtFetchResp, DtOp, DtUpdateReq, DtUpdateResp, DtValue, GSetOp, HllOp, MapEntry, MapField, MapOp, MapUpdate, Operator, Protocol, RpbAuthReq, RpbBucketKeyPreflistItem, RpbBucketProps, RpbCSBucketReq, RpbCSBucketResp, RpbCommitHook, RpbContent, RpbCounterGetReq, RpbCounterGetResp, RpbCounterUpdateReq, RpbCounterUpdateResp, RpbCoverageEntry, RpbCoverageReq, RpbCoverageResp, RpbDelReq, RpbErrorResp, RpbGetBucketKeyPreflistReq, RpbGetBucketKeyPreflistResp, RpbGetBucketReq, RpbGetBucketResp, RpbGetBucketTypeReq, RpbGetClientIdResp, RpbGetReq, RpbGetResp, RpbGetServerInfoResp, RpbIndexBodyResp, RpbIndexObject, RpbIndexReq, RpbIndexResp, RpbLink, RpbListBucketsReq, RpbListBucketsResp, RpbListKeysReq, RpbListKeysResp, RpbMapRedReq, RpbMapRedResp, RpbModFun, RpbPair, RpbPutReq, RpbPutResp, RpbResetBucketReq, RpbSearchDoc, RpbSearchQueryReq, RpbSearchQueryResp, RpbSetBucketReq, RpbSetBucketTypeReq, RpbSetClientIdReq, RpbYokozunaIndex, RpbYokozunaIndexDeleteReq, RpbYokozunaIndexGetReq, RpbYokozunaIndexGetResp, RpbYokozunaIndexPutReq, RpbYokozunaSchema, RpbYokozunaSchemaGetReq, RpbYokozunaSchemaGetResp, RpbYokozunaSchemaPutReq, SetOp, TimeSeriesDeleteOperator, TimeSeriesGetOperator, TimeSeriesListOperator, TimeSeriesPutOperator, TimeSeriesQueryOperator, TsCell, TsCellCodec, TsColumnDescription, TsCoverageEntry, TsCoverageReq, TsCoverageResp, TsDelReq, TsDelResp, TsGetReq, TsGetResp, TsInterpolation, TsListKeysReq, TsListKeysResp, TsPutReq, TsPutResp, TsQueryReq, TsQueryResp, TsRange, TsRow
Constant Summary
ObjectMethods::ENCODING
ProtobuffsBackend::MESSAGE_CODES, ProtobuffsBackend::QUORUMS, ProtobuffsBackend::UINTMAX
FeatureDetection::VERSION
Instance Attribute Summary
#client, #node
Class Method Summary
collapse
Instance Method Summary
collapse
-
#beefcake ⇒ Object
Generated from riak_ts.proto.
-
#bucket_properties_operator ⇒ Object
-
#crdt_loader ⇒ Object
private
Returns a new CrdtLoader for deserializing a protobuffs response full of CRDTs.
-
#crdt_operator ⇒ Object
private
Returns a new CrdtOperator for serializing CRDT operations into protobuffs and sending them to a Riak cluster.
-
#create_search_index(name, schema = nil, n_val = nil, timeout = nil) ⇒ Object
-
#create_search_schema(name, content) ⇒ Object
-
#delete_object(bucket, key, options = {}) ⇒ Object
-
#delete_search_index(name) ⇒ Object
-
#fetch_object(bucket, key, options = {}) ⇒ Object
-
#get_bucket_props(bucket, options = { }) ⇒ Object
-
#get_bucket_type_props(bucket_type) ⇒ Object
-
#get_client_id ⇒ Object
-
#get_counter(bucket, key, options = {}) ⇒ Object
-
#get_index(bucket, index, query, query_options = {}, &block) ⇒ Object
-
#get_preflist(bucket, key, type = nil, options = {}) ⇒ Object
-
#get_search_index(name) ⇒ Object
-
#get_search_schema(name) ⇒ Object
-
#list_buckets(options = {}, &blk) ⇒ Object
override the simple list_buckets.
-
#list_keys(bucket, options = {}, &block) ⇒ Object
-
#mapred(mr, &block) ⇒ Object
-
#new_socket ⇒ Object
-
#ping ⇒ Object
-
#post_counter(bucket, key, amount, options = {}) ⇒ Object
-
#protocol ⇒ Object
-
#reload_object(robject, options = {}) ⇒ Object
-
#reset_bucket_props(bucket, options) ⇒ Object
-
#search(index, query, options = {}) ⇒ Object
-
#server_info ⇒ Object
-
#set_bucket_props(bucket, props, type = nil) ⇒ Object
-
#set_client_id(id) ⇒ Object
-
#store_object(robject, options = {}) ⇒ Object
-
#time_series_delete_operator ⇒ Object
-
#time_series_get_operator(convert_timestamp) ⇒ Object
-
#time_series_list_operator(convert_timestamp) ⇒ Object
-
#time_series_put_operator ⇒ Object
-
#time_series_query_operator(convert_timestamp) ⇒ Object
-
#write_protobuff(code, message) ⇒ Object
#dump_object, #load_object
#initialize, simple, #socket, #teardown
#get_server_version, #http_props_clearable?, #index_pagination?, #index_return_terms?, #index_streaming?, #key_object_bucket_timeouts?, #mapred_phaseless?, #pb_conditionals?, #pb_head?, #pb_indexes?, #pb_search?, #quorum_controls?, #server_version, #tombstone_vclocks?
#escape, #maybe_escape, #maybe_unescape, #unescape
#i18n_scope, #t
Class Method Details
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 10
def self.configured?
begin
require 'beefcake'
require 'riak/client/beefcake/messages'
require 'riak/client/beefcake/message_overlay'
require 'riak/client/beefcake/object_methods'
require 'riak/client/beefcake/bucket_properties_operator'
require 'riak/client/beefcake/crdt_operator'
require 'riak/client/beefcake/crdt_loader'
require 'riak/client/beefcake/time_series_delete_operator'
require 'riak/client/beefcake/time_series_get_operator'
require 'riak/client/beefcake/time_series_list_operator'
require 'riak/client/beefcake/time_series_put_operator'
require 'riak/client/beefcake/time_series_query_operator'
require 'riak/client/beefcake/protocol'
require 'riak/client/beefcake/socket'
true
rescue LoadError, NameError => e
false
end
end
|
Instance Method Details
Generated from riak_ts.proto
8
|
# File 'lib/riak/client/beefcake/messages.rb', line 8
require "beefcake"
|
#bucket_properties_operator ⇒ Object
2
3
4
|
# File 'lib/riak/client/beefcake/bucket_properties_operator.rb', line 2
def bucket_properties_operator
BucketPropertiesOperator.new(self)
end
|
#crdt_loader ⇒ Object
This method is part of a private API.
You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new CrdtLoader for deserializing a protobuffs response full of CRDTs.
13
14
15
|
# File 'lib/riak/client/beefcake/crdt_loader.rb', line 13
def crdt_loader
return CrdtLoader.new self
end
|
#crdt_operator ⇒ Object
This method is part of a private API.
You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new CrdtOperator for serializing CRDT operations into protobuffs and sending them to a Riak cluster.
10
11
12
|
# File 'lib/riak/client/beefcake/crdt_operator.rb', line 10
def crdt_operator
return CrdtOperator.new self
end
|
#create_search_index(name, schema = nil, n_val = nil, timeout = nil) ⇒ Object
389
390
391
392
393
394
395
396
397
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 389
def create_search_index(name, schema = nil, n_val = nil, timeout = nil)
index = RpbYokozunaIndex.new(name: name, schema: schema, n_val: n_val)
req = RpbYokozunaIndexPutReq.new(index: index, timeout: timeout)
protocol do |p|
p.write :YokozunaIndexPutReq, req
p.expect :PutResp
end
end
|
#create_search_schema(name, content) ⇒ Object
426
427
428
429
430
431
432
433
434
435
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 426
def create_search_schema(name, content)
schema = RpbYokozunaSchema.new(:name => name, :content => content)
req = RpbYokozunaSchemaPutReq.new(:schema => schema)
protocol do |p|
p.write :YokozunaSchemaPutReq, req
p.expect :PutResp
end
true
end
|
#delete_object(bucket, key, options = {}) ⇒ Object
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 162
def delete_object(bucket, key, options = {})
if bucket.is_a? Bucket
options[:type] = bucket.type.name if bucket.needs_type?
bucket = bucket.name
end
options = normalize_quorums(options)
options[:bucket] = maybe_encode(bucket)
options[:key] = maybe_encode(key)
options[:vclock] = Base64.decode64(options[:vclock]) if options[:vclock]
req = RpbDelReq.new(prune_unsupported_options(:DelReq, options))
protocol do |p|
p.write :DelReq, req
p.expect :DelResp
end
return true
end
|
#delete_search_index(name) ⇒ Object
417
418
419
420
421
422
423
424
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 417
def delete_search_index(name)
req = RpbYokozunaIndexDeleteReq.new(:name => name)
protocol do |p|
p.write :YokozunaIndexDeleteReq, req
p.expect :DelResp
end
true
end
|
#fetch_object(bucket, key, options = {}) ⇒ Object
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 98
def fetch_object(bucket, key, options = {})
options = prune_unsupported_options(:GetReq, normalize_quorums(options))
bucket = Bucket === bucket ? bucket.name : bucket
req = RpbGetReq.new(options.merge(:bucket => maybe_encode(bucket), :key => maybe_encode(key)))
resp = protocol do |p|
p.write :GetReq, req
p.expect :GetResp, RpbGetResp, empty_body_acceptable: true
end
if :empty == resp
raise Riak::ProtobuffsFailedRequest.new(:not_found, t('not_found'))
end
template = RObject.new(client.bucket(bucket), key)
load_object(resp, template)
end
|
#get_bucket_props(bucket, options = { }) ⇒ Object
245
246
247
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 245
def get_bucket_props(bucket, options = { })
bucket_properties_operator.get bucket, options
end
|
#get_bucket_type_props(bucket_type) ⇒ Object
264
265
266
267
268
269
270
271
272
273
274
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 264
def get_bucket_type_props(bucket_type)
bucket_type = bucket_type.name if bucket_type.is_a? BucketType
req = RpbGetBucketTypeReq.new type: bucket_type
resp = protocol do |p|
p.write :GetBucketTypeReq, req
p.expect(:GetBucketResp, RpbGetBucketResp)
end
resp.props.to_hash
end
|
#get_client_id ⇒ Object
67
68
69
70
71
72
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 67
def get_client_id
protocol do |p|
p.write :GetClientIdReq
p.expect(:GetClientIdResp, RpbGetClientIdResp).client_id
end
end
|
#get_counter(bucket, key, options = {}) ⇒ Object
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 202
def get_counter(bucket, key, options = {})
bucket = bucket.name if bucket.is_a? Bucket
options = normalize_quorums(options)
options[:bucket] = bucket
options[:key] = key
request = RpbCounterGetReq.new options
resp = protocol do |p|
p.write :CounterGetReq, request
p.expect :CounterGetResp, RpbCounterGetResp, empty_body_acceptable: true
end
if :empty == resp
return 0
end
return resp.value || 0
end
|
#get_index(bucket, index, query, query_options = {}, &block) ⇒ Object
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 342
def get_index(bucket, index, query, query_options = {}, &block)
return super unless pb_indexes?
bucket = bucket.name if Bucket === bucket
options = if Range === query
{
:qtype => RpbIndexReq::IndexQueryType::RANGE,
:range_min => query.begin.to_s,
:range_max => query.end.to_s
}
else
{
:qtype => RpbIndexReq::IndexQueryType::EQ,
:key => query.to_s
}
end
options.merge!(:bucket => bucket, :index => index.to_s)
options.merge!(query_options)
options[:stream] = block_given?
req = RpbIndexReq.new(options)
protocol do |p|
p.write :IndexReq, req
decode_index_response(p, &block)
end
end
|
#get_preflist(bucket, key, type = nil, options = {}) ⇒ Object
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 181
def get_preflist(bucket, key, type = nil, options = {})
if type.nil? && bucket.is_a?(Riak::BucketTyped::Bucket)
type = bucket.type.name
end
bucket = bucket.name if bucket.is_a? Bucket
type = type.name if type.is_a? BucketType
message = RpbGetBucketKeyPreflistReq.new(
bucket: bucket,
key: key,
type: type
)
resp = protocol do |p|
p.write :GetBucketKeyPreflistReq, message
p.expect :GetBucketKeyPreflistResp, RpbGetBucketKeyPreflistResp
end
resp.preflist
end
|
#get_search_index(name) ⇒ Object
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 399
def get_search_index(name)
req = RpbYokozunaIndexGetReq.new(:name => name)
begin
resp = protocol do |p|
p.write :YokozunaIndexGetReq, req
p.expect :YokozunaIndexGetResp, RpbYokozunaIndexGetResp, empty_body_acceptable: true
end
rescue ProtobuffsErrorResponse => e
if e.code == 0 && e.original_message =~ /notfound/
raise Riak::ProtobuffsFailedRequest.new(:not_found, t('not_found'))
end
raise e
end
resp
end
|
#get_search_schema(name) ⇒ Object
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 437
def get_search_schema(name)
req = RpbYokozunaSchemaGetReq.new(:name => name)
begin
resp = protocol do |p|
p.write :YokozunaSchemaGetReq, req
p.expect :YokozunaSchemaGetResp, RpbYokozunaSchemaGetResp
end
rescue ProtobuffsErrorResponse => e
if e.code == 0 && e.original_message =~ /notfound/
raise Riak::ProtobuffsFailedRequest.new(:not_found, t('not_found'))
end
raise e
end
resp.schema ? resp.schema : resp
end
|
#list_buckets(options = {}, &blk) ⇒ Object
override the simple list_buckets
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 301
def list_buckets(options = {}, &blk)
if block_given?
return streaming_list_buckets options, &blk
end
raise t("streaming_bucket_list_without_block") if options[:stream]
request = RpbListBucketsReq.new options
resp = protocol do |p|
p.write :ListBucketsReq, request
p.expect :ListBucketsResp, RpbListBucketsResp, empty_body_acceptable: true
end
return [] if :empty == resp
resp.buckets
end
|
#list_keys(bucket, options = {}, &block) ⇒ Object
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 276
def list_keys(bucket, options = {}, &block)
bucket = bucket.name if Bucket === bucket
req = RpbListKeysReq.new(options.merge(:bucket => maybe_encode(bucket)))
keys = []
protocol do |p|
p.write :ListKeysReq, req
while msg = p.expect(:ListKeysResp, RpbListKeysResp)
break if msg.done
if block_given?
yield msg.keys
else
keys += msg.keys
end
end
end
return keys unless block_given?
return true
end
|
#mapred(mr, &block) ⇒ Object
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 321
def mapred(mr, &block)
raise MapReduceError.new(t("empty_map_reduce_query")) if mr.query.empty? && !mapred_phaseless?
req = RpbMapRedReq.new(:request => mr.to_json, :content_type => "application/json")
results = MapReduce::Results.new(mr)
protocol do |p|
p.write :MapRedReq, req
while msg = p.expect(:MapRedResp, RpbMapRedResp)
break if msg.done
if block_given?
yield msg.phase, JSON.parse(msg.response)
else
results.add msg.phase, JSON.parse(msg.response)
end
end
end
block_given? || results.report
end
|
#new_socket ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 51
def new_socket
BeefcakeSocket.new(
@node.host,
@node.pb_port,
authentication: client.authentication,
connect_timeout: client.connect_timeout
)
end
|
60
61
62
63
64
65
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 60
def ping
protocol do |p|
p.write :PingReq
p.expect :PingResp
end
end
|
#post_counter(bucket, key, amount, options = {}) ⇒ Object
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 223
def post_counter(bucket, key, amount, options = {})
bucket = bucket.name if bucket.is_a? Bucket
options = normalize_quorums(options)
options[:bucket] = bucket
options[:key] = key
options[:amount] = amount
options[:returnvalue] = options[:returnvalue] || options[:return_value]
request = RpbCounterUpdateReq.new options
resp = protocol do |p|
p.write :CounterUpdateReq, request
p.expect :CounterUpdateResp, RpbCounterUpdateResp, empty_body_acceptable: true
end
return nil if :empty == resp
return resp.value
end
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 33
def protocol
p = Protocol.new(
socket,
read_timeout: client.read_timeout,
write_timeout: client.write_timeout
)
in_request = false
result = nil
begin
in_request = true
result = yield p
in_request = false
ensure
reset_socket if in_request
end
return result
end
|
#reload_object(robject, options = {}) ⇒ Object
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 116
def reload_object(robject, options = {})
options = normalize_quorums(options)
options[:bucket] = maybe_encode(robject.bucket.name)
options[:type] = maybe_encode(robject.bucket.type.name) if robject.bucket.needs_type?
options[:key] = maybe_encode(robject.key)
options[:if_modified] = maybe_encode Base64.decode64(robject.vclock) if robject.vclock
req = RpbGetReq.new(prune_unsupported_options(:GetReq, options))
resp = protocol do |p|
p.write :GetReq, req
p.expect :GetResp, RpbGetResp, empty_body_acceptable: true
end
if :empty == resp
raise Riak::ProtobuffsFailedRequest.new(:not_found, t('not_found'))
end
load_object(resp, robject)
end
|
#reset_bucket_props(bucket, options) ⇒ Object
253
254
255
256
257
258
259
260
261
262
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 253
def reset_bucket_props(bucket, options)
bucket = bucket.name if Bucket === bucket
req = RpbResetBucketReq.new(bucket: maybe_encode(bucket),
type: options[:type])
protocol do |p|
p.write :ResetBucketReq, req
p.expect :ResetBucketResp
end
end
|
#search(index, query, options = {}) ⇒ Object
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 370
def search(index, query, options = {})
return super unless pb_search?
options = options.symbolize_keys
options[:op] = options.delete(:'q.op') if options[:'q.op']
req = RpbSearchQueryReq.new(options.merge(:index => index || 'search', :q => query))
resp = protocol do |p|
p.write :SearchQueryReq, req
p.expect :SearchQueryResp, RpbSearchQueryResp
end
resp.docs = [] if resp.docs.nil?
ret = { 'max_score' => resp.max_score, 'num_found' => resp.num_found }
ret['docs'] = resp.docs.map { |d| decode_doc d }
return ret
end
|
#server_info ⇒ Object
74
75
76
77
78
79
80
81
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 74
def server_info
resp = protocol do |p|
p.write :GetServerInfoReq
p.expect(:GetServerInfoResp, RpbGetServerInfoResp)
end
{ node: resp.node, server_version: resp.server_version }
end
|
#set_bucket_props(bucket, props, type = nil) ⇒ Object
249
250
251
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 249
def set_bucket_props(bucket, props, type = nil)
bucket_properties_operator.put bucket, props, type: type
end
|
#set_client_id(id) ⇒ Object
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 83
def set_client_id(id)
value = case id
when Integer
[id].pack("N")
else
id.to_s
end
req = RpbSetClientIdReq.new(:client_id => value)
protocol do |p|
p.write :SetClientIdReq, req
p.expect :SetClientIdResp
end
return true
end
|
#store_object(robject, options = {}) ⇒ Object
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 136
def store_object(robject, options = {})
options[:return_body] ||= options[:returnbody]
options = normalize_quorums(options)
if robject.prevent_stale_writes
unless pb_conditionals?
other = fetch_object(robject.bucket, robject.key)
raise Riak::ProtobuffsFailedRequest.new(:stale_object, t("stale_write_prevented")) unless other.vclock == robject.vclock
end
if robject.vclock
options[:if_not_modified] = true
else
options[:if_none_match] = true
end
end
req = dump_object(robject, prune_unsupported_options(:PutReq, options))
resp = protocol do |p|
p.write(:PutReq, req)
p.expect :PutResp, RpbPutResp, empty_body_acceptable: true
end
return true if :empty == resp
load_object resp, robject
end
|
#time_series_delete_operator ⇒ Object
5
6
7
|
# File 'lib/riak/client/beefcake/time_series_delete_operator.rb', line 5
def time_series_delete_operator
TimeSeriesDeleteOperator.new(self)
end
|
#time_series_get_operator(convert_timestamp) ⇒ Object
5
6
7
|
# File 'lib/riak/client/beefcake/time_series_get_operator.rb', line 5
def time_series_get_operator(convert_timestamp)
TimeSeriesGetOperator.new(self, convert_timestamp)
end
|
#time_series_list_operator(convert_timestamp) ⇒ Object
5
6
7
|
# File 'lib/riak/client/beefcake/time_series_list_operator.rb', line 5
def time_series_list_operator(convert_timestamp)
TimeSeriesListOperator.new(self, convert_timestamp)
end
|
#time_series_put_operator ⇒ Object
5
6
7
|
# File 'lib/riak/client/beefcake/time_series_put_operator.rb', line 5
def time_series_put_operator
TimeSeriesPutOperator.new(self)
end
|
#time_series_query_operator(convert_timestamp) ⇒ Object
5
6
7
|
# File 'lib/riak/client/beefcake/time_series_query_operator.rb', line 5
def time_series_query_operator(convert_timestamp)
TimeSeriesQueryOperator.new(self, convert_timestamp)
end
|
#write_protobuff(code, message) ⇒ Object
456
457
458
459
460
|
# File 'lib/riak/client/beefcake_protobuffs_backend.rb', line 456
def write_protobuff(code, message)
encoded = message.encode
= [encoded.length+1, MESSAGE_CODES.index(code)].pack("NC")
socket.write( + encoded)
end
|