Sha256: 866bc8fbadbf3427a47e0976124722139477f4c137692a75d0160cb3cc24a0e4
Contents?: true
Size: 785 Bytes
Versions: 7
Compression:
Stored size: 785 Bytes
Contents
require 'riak' module Riak module Util module Encode # Construct a Request Message for Riak, which adheres to the following structure: # # 00 00 00 07 09 0A 01 62 12 01 6B # |----Len---|MC|----Message-----| # # @raise [TypeError] if an invalid hostname is given # @return [String] the assigned hostname def assemble_request(mc, msg='') raise TypeError, t("message_code_invalid") unless mc.is_a?(Fixnum) raise TypeError, t("pb_message_invalid") unless msg.is_a?(String) encode_message mc, msg end def encode_message(mc, msg='') message = [mc].pack('c') + msg message = [message.size].pack('N') + message end end end end
Version data entries
7 entries across 7 versions & 1 rubygems