Module: Mongo::Protocol::Serializers::Header Private
Relationships & Source Files | |
Defined in: | lib/mongo/protocol/serializers.rb |
Overview
MongoDB wire protocol serialization strategy for message headers.
Serializes and de-serializes four 32-bit integers consisting of the length of the message, the request id, the response id, and the op code for the operation.
Class Method Summary
-
.deserialize(buffer, options = {}) ⇒ Array<Fixnum>
Internal use only
Deserializes the header value from the IO stream.
-
.serialize(buffer, value, validating_keys = nil) ⇒ String
Internal use only
Serializes the header value into the buffer.
Class Method Details
.deserialize(buffer, options = {}) ⇒ Array
<Fixnum
>
Deserializes the header value from the IO stream
# File 'lib/mongo/protocol/serializers.rb', line 69
def self.deserialize(buffer, = {}) buffer.get_bytes(16).unpack(HEADER_PACK) end
.serialize(buffer, value, validating_keys = nil) ⇒ String
Serializes the header value into the buffer
# File 'lib/mongo/protocol/serializers.rb', line 58
def self.serialize(buffer, value, validating_keys = nil) buffer.put_bytes(value.pack(HEADER_PACK)) end