Class: EM::Mongo::ServerResponse
- Inherits:
-
Object
- Object
- EM::Mongo::ServerResponse
- Defined in:
- lib/em-mongo/server_response.rb
Instance Attribute Summary (collapse)
-
- (Object) connection
readonly
Returns the value of attribute connection.
-
- (Object) cursor_id
readonly
Returns the value of attribute cursor_id.
-
- (Object) docs
readonly
Returns the value of attribute docs.
-
- (Object) number_returned
readonly
Returns the value of attribute number_returned.
-
- (Object) op
readonly
Returns the value of attribute op.
-
- (Object) request_id
readonly
Returns the value of attribute request_id.
-
- (Object) response_to
readonly
Returns the value of attribute response_to.
-
- (Object) result_flags
readonly
Returns the value of attribute result_flags.
-
- (Object) size
readonly
Returns the value of attribute size.
-
- (Object) starting_from
readonly
Returns the value of attribute starting_from.
Instance Method Summary (collapse)
-
- (ServerResponse) initialize(buffer, connection)
constructor
A new instance of ServerResponse.
Constructor Details
- (ServerResponse) initialize(buffer, connection)
A new instance of ServerResponse
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/em-mongo/server_response.rb', line 9 def initialize(buffer, connection) @connection = connection # Header @size = buffer.get_int @request_id = buffer.get_int @response_to = buffer.get_int @op = buffer.get_int # Response Header @result_flags = buffer.get_int @cursor_id = buffer.get_long @starting_from = buffer.get_int @number_returned = buffer.get_int # Documents @docs = (1..number_returned).map do size= @connection.peek_size(buffer) buf = buffer.get(size) BSON::BSON_CODER.deserialize(buf) end end |
Instance Attribute Details
- (Object) connection (readonly)
Returns the value of attribute connection
4 5 6 |
# File 'lib/em-mongo/server_response.rb', line 4 def connection @connection end |
- (Object) cursor_id (readonly)
Returns the value of attribute cursor_id
4 5 6 |
# File 'lib/em-mongo/server_response.rb', line 4 def cursor_id @cursor_id end |
- (Object) docs (readonly)
Returns the value of attribute docs
4 5 6 |
# File 'lib/em-mongo/server_response.rb', line 4 def docs @docs end |
- (Object) number_returned (readonly)
Returns the value of attribute number_returned
4 5 6 |
# File 'lib/em-mongo/server_response.rb', line 4 def number_returned @number_returned end |
- (Object) op (readonly)
Returns the value of attribute op
4 5 6 |
# File 'lib/em-mongo/server_response.rb', line 4 def op @op end |
- (Object) request_id (readonly)
Returns the value of attribute request_id
4 5 6 |
# File 'lib/em-mongo/server_response.rb', line 4 def request_id @request_id end |
- (Object) response_to (readonly)
Returns the value of attribute response_to
4 5 6 |
# File 'lib/em-mongo/server_response.rb', line 4 def response_to @response_to end |
- (Object) result_flags (readonly)
Returns the value of attribute result_flags
4 5 6 |
# File 'lib/em-mongo/server_response.rb', line 4 def result_flags @result_flags end |
- (Object) size (readonly)
Returns the value of attribute size
4 5 6 |
# File 'lib/em-mongo/server_response.rb', line 4 def size @size end |
- (Object) starting_from (readonly)
Returns the value of attribute starting_from
4 5 6 |
# File 'lib/em-mongo/server_response.rb', line 4 def starting_from @starting_from end |