Class: Mongo::Protocol::Reply
| Relationships & Source Files | |
| Namespace Children | |
|
Classes:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Message
|
|
|
Instance Chain:
|
|
| Inherits: |
Mongo::Protocol::Message
|
| Defined in: | lib/mongo/protocol/reply.rb |
Overview
The MongoDB wire protocol message representing a reply
Constant Summary
-
FLAGS =
# File 'lib/mongo/protocol/reply.rb', line 84
Available flags for a
Replymessage.[ :cursor_not_found, :query_failure, :shard_config_stale, :await_capable ]
-
OP_CODE =
# File 'lib/mongo/protocol/reply.rb', line 81
The operation code required to specify a
Replymessage.1
Serializers - Included
HEADER_PACK, INT32_PACK, INT64_PACK, NULL, ZERO
Message - Inherited
Class Method Summary
Message - Inherited
| .deserialize | Deserializes messages from an IO stream. |
| .new | :nodoc: |
| .deserialize_array | Deserializes an array of fields in a message. |
| .deserialize_field | Deserializes a single field in a message. |
| .deserialize_header | Deserializes the header of the message. |
| .field | A method for declaring a message field. |
| .fields | A class method for getting the fields for a message class. |
Instance Attribute Summary
- #cursor_id ⇒ Fixnum rw
-
#cursor_not_found? ⇒ true, false
readonly
Determine if the reply had a cursor not found flag.
- #documents ⇒ Array<Hash> rw
- #flags ⇒ Array<Symbol> rw
- #number_returned ⇒ Fixnum rw
-
#query_failure? ⇒ true, false
readonly
Determine if the reply had a query failure flag.
- #starting_from ⇒ Fixnum rw
Message - Inherited
| #replyable? | The default for messages is not to require a reply after sending a message to the server. |
| #request_id | Returns the request id for the message. |
Instance Method Summary
-
#payload ⇒ BSON::Document
Return the event payload for monitoring.
- #upconverter private
Message - Inherited
| #== | Tests for equality between two wire protocol messages by comparing class and field values. |
| #eql? | Alias for Message#==. |
| #hash | Creates a hash from the values of the fields of a message. |
| #maybe_add_server_api, | |
| #maybe_compress | Compress the message, if supported by the wire protocol used and if the command being sent permits compression. |
| #maybe_decrypt | Possibly decrypt this message with libmongocrypt. |
| #maybe_encrypt | Possibly encrypt this message with libmongocrypt. |
| #maybe_inflate | Inflate a message if it is compressed. |
| #number_returned | Default number returned value for protocol messages. |
| #serialize | Serializes message into bytes that can be sent on the wire. |
| #set_request_id | Generates a request id for a message. |
| #to_s | Alias for Message#serialize. |
| #compress_if_possible | Compress the message, if the command being sent permits compression. |
| #fields | A method for getting the fields for a message class. |
| #merge_sections, | |
| #serialize_fields | Serializes message fields into a buffer. |
| #serialize_header | Serializes the header of the message consisting of 4 32bit integers. |
Constructor Details
This class inherits a constructor from Mongo::Protocol::Message
Instance Attribute Details
#cursor_id ⇒ Fixnum (rw)
# File 'lib/mongo/protocol/reply.rb', line 103
field :cursor_id, Int64
#cursor_not_found? ⇒ true, false (readonly)
Determine if the reply had a cursor not found flag.
# File 'lib/mongo/protocol/reply.rb', line 52
def cursor_not_found? flags.include?(:cursor_not_found) end
#documents ⇒ Array<Hash> (rw)
# File 'lib/mongo/protocol/reply.rb', line 115
field :documents, Document, :@number_returned
#flags ⇒ Array<Symbol> (rw)
#number_returned ⇒ Fixnum (rw)
# File 'lib/mongo/protocol/reply.rb', line 111
field :number_returned, Int32
#query_failure? ⇒ true, false (readonly)
Determine if the reply had a query failure flag.
# File 'lib/mongo/protocol/reply.rb', line 40
def query_failure? flags.include?(:query_failure) end
#starting_from ⇒ Fixnum (rw)
# File 'lib/mongo/protocol/reply.rb', line 107
field :starting_from, Int32
Instance Method Details
#payload ⇒ BSON::Document
Return the event payload for monitoring.
# File 'lib/mongo/protocol/reply.rb', line 64
def payload BSON::Document.new( reply: upconverter.command, request_id: request_id ) end
#upconverter (private)
[ GitHub ]# File 'lib/mongo/protocol/reply.rb', line 73
def upconverter @upconverter ||= Upconverter.new(documents, cursor_id, starting_from) end