Class: Moped::Protocol::Reply
- Includes:
- Message
- Defined in:
- lib/moped/protocol/reply.rb
Overview
The Protocol class representing messages received from a mongo connection.
Instance Attribute Summary collapse
-
#count ⇒ Number
The number of documents returned.
-
#cursor_id ⇒ Number
The id of the cursor on the server.
-
#documents ⇒ Array
The returned documents.
-
#flags ⇒ Array<Symbol>
The flags for this reply.
-
#length ⇒ Number
The length of the message.
-
#offset ⇒ Number
The starting position within the cursor.
-
#op_code ⇒ Number
The operation code of this message (always 1).
-
#request_id ⇒ Number
The request id of the message.
-
#response_to ⇒ Number
The id that generated the message.
Class Method Summary collapse
-
.deserialize(buffer) ⇒ Reply
Consumes a buffer, returning the deserialized Reply message.
Methods included from Message
included, #inspect, #receive_replies, #serialize
Instance Attribute Details
#count ⇒ Number
Returns the number of documents returned.
48 |
# File 'lib/moped/protocol/reply.rb', line 48 int32 :count |
#cursor_id ⇒ Number
Returns the id of the cursor on the server.
40 |
# File 'lib/moped/protocol/reply.rb', line 40 int64 :cursor_id |
#documents ⇒ Array
Returns the returned documents.
52 |
# File 'lib/moped/protocol/reply.rb', line 52 document :documents, type: :array |
#flags ⇒ Array<Symbol>
Returns the flags for this reply.
34 35 36 |
# File 'lib/moped/protocol/reply.rb', line 34 flags :flags, cursor_not_found: 2 ** 0, query_failure: 2 ** 1, await_capable: 2 ** 3 |
#length ⇒ Number
Returns the length of the message.
18 |
# File 'lib/moped/protocol/reply.rb', line 18 int32 :length |
#offset ⇒ Number
Returns the starting position within the cursor.
44 |
# File 'lib/moped/protocol/reply.rb', line 44 int32 :offset |
#op_code ⇒ Number
Returns the operation code of this message (always 1).
30 |
# File 'lib/moped/protocol/reply.rb', line 30 int32 :op_code |
#request_id ⇒ Number
Returns the request id of the message.
22 |
# File 'lib/moped/protocol/reply.rb', line 22 int32 :request_id |
#response_to ⇒ Number
Returns the id that generated the message.
26 |
# File 'lib/moped/protocol/reply.rb', line 26 int32 :response_to |
Class Method Details
.deserialize(buffer) ⇒ Reply
Consumes a buffer, returning the deserialized Reply message.
reply from.
69 70 71 72 73 74 75 |
# File 'lib/moped/protocol/reply.rb', line 69 def deserialize(buffer) reply = allocate fields.each do |field| reply.__send__ :"deserialize_#{field}", buffer end reply end |