Module: Mongo::Protocol::Serializers::Header Private
- Defined in:
- lib/mongo/protocol/serializers.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
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 collapse
-
.deserialize(buffer, options = {}) ⇒ Array<Fixnum>
private
Deserializes the header value from the IO stream.
-
.serialize(buffer, value, validating_keys = nil) ⇒ String
private
Serializes the header value into the buffer.
Class Method Details
.deserialize(buffer, options = {}) ⇒ Array<Fixnum>
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.
Deserializes the header value from the IO stream
69 70 71 |
# 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
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.
Serializes the header value into the buffer
58 59 60 |
# File 'lib/mongo/protocol/serializers.rb', line 58 def self.serialize(buffer, value, validating_keys = nil) buffer.put_bytes(value.pack(HEADER_PACK)) end |