Module: Mongo::Protocol::Serializers::Sections::PayloadZero Private
Relationships & Source Files | |
Defined in: | lib/mongo/protocol/serializers.rb |
Overview
MongoDB wire protocol serialization strategy for a payload 0 type Section of OP_MSG.
Constant Summary
-
TYPE =
The byte identifier for this payload type.
0x0
-
TYPE_BYTE =
The byte corresponding to this payload type.
TYPE.chr.force_encoding(BSON::BINARY).freeze
Class Method Summary
-
.deserialize(buffer, options = {}) ⇒ Array<BSON::Document>
Internal use only
Deserializes a section of payload type 0 of an OP_MSG from the IO stream.
-
.serialize(buffer, value, max_bson_size = nil, validating_keys = nil) ⇒ BSON::ByteBuffer
Internal use only
Serializes a section of an OP_MSG, payload type 0.
Class Method Details
.deserialize(buffer, options = {}) ⇒ Array
<BSON::Document
>
Deserializes a section of payload type 0 of an OP_MSG from the IO stream.
# File 'lib/mongo/protocol/serializers.rb', line 287
def self.deserialize(buffer, = {}) mode = [:deserialize_as_bson] ? :bson : nil BSON::Document.from_bson(buffer, **{ mode: mode }) end
.serialize(buffer, value, max_bson_size = nil, validating_keys = nil) ⇒ BSON::ByteBuffer
Serializes a section of an OP_MSG, payload type 0.
# File 'lib/mongo/protocol/serializers.rb', line 270
def self.serialize(buffer, value, max_bson_size = nil, validating_keys = nil) buffer.put_byte(TYPE_BYTE) Serializers::Document.serialize(buffer, value, max_bson_size) end