Module: Riakpb::Util::Encode
- Included in:
- Client::Rpc
- Defined in:
- lib/riakpb/util/encode.rb
Instance Method Summary collapse
-
#assemble_request(mc, msg = '') ⇒ String
Construct a Request Message for Riakpb, which adheres to the following structure:.
- #encode_message(mc, msg = '') ⇒ Object
Instance Method Details
#assemble_request(mc, msg = '') ⇒ String
Construct a Request Message for Riakpb, which adheres to the following structure:
00 00 00 07 09 0A 01 62 12 01 6B
|----Len---|MC|----Message-----|
15 16 17 18 19 20 |
# File 'lib/riakpb/util/encode.rb', line 15 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) mc, msg end |
#encode_message(mc, msg = '') ⇒ Object
22 23 24 25 26 |
# File 'lib/riakpb/util/encode.rb', line 22 def (mc, msg='') = [mc].pack('c') + msg = [.size].pack('N') + end |