Header — Documentation by YARD 0.9.37 (original) (raw)

Module: Mongo::Protocol::Serializers::HeaderPrivate

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 Summarycollapse

Class Method Details

.deserialize(buffer, options = {}) ⇒ Array

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, options = {}) 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