Class: Riak::Client::ProtobuffsBackend

Inherits:
Object
  • Object
show all
Includes:
Util::Translation
Defined in:
riak-client/lib/riak/client/protobuffs_backend.rb

Constant Summary

MESSAGE_CODES =

Message Codes Enum

ErrorResp
   PingReq
   PingResp
   GetClientIdReq
   GetClientIdResp
   SetClientIdReq
   SetClientIdResp
   GetServerInfoReq
   GetServerInfoResp
   GetReq
   GetResp
   PutReq
   PutResp
   DelReq
   DelResp
   ListBucketsReq
   ListBucketsResp
   ListKeysReq
   ListKeysResp
   GetBucketReq
   GetBucketResp
   SetBucketReq
   SetBucketResp
   MapRedReq
   MapRedResp
].map {|s| s.intern }.freeze
UINTMAX =
0xffffffff
QUORUMS =
{
  "one" => UINTMAX - 1,
  "quorum" => UINTMAX - 2,
  "all" => UINTMAX - 3,
  "default" => UINTMAX - 4
}.freeze

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from Util::Translation

#i18n_scope, #t

Constructor Details

- (ProtobuffsBackend) initialize(client)

A new instance of ProtobuffsBackend



62
63
64
# File 'riak-client/lib/riak/client/protobuffs_backend.rb', line 62

def initialize(client)
  @client = client
end

Instance Attribute Details

- (Object) client

Returns the value of attribute client



61
62
63
# File 'riak-client/lib/riak/client/protobuffs_backend.rb', line 61

def client
  @client
end

Class Method Details

+ (Object) simple(method, code)



54
55
56
57
58
59
# File 'riak-client/lib/riak/client/protobuffs_backend.rb', line 54

def self.simple(method, code)
  define_method method do
    socket.write([1, MESSAGE_CODES.index(code)].pack('NC'))
    decode_response
  end
end