Class: Mongo::Server::PendingConnection Private

Inherits:
ConnectionBase show all
Extended by:
Forwardable
Defined in:
lib/mongo/server/pending_connection.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class encapsulates connections during handshake and authentication.

Since:

  • 2.0.0

Constant Summary

Constants inherited from ConnectionBase

ConnectionBase::DEFAULT_MAX_BSON_OBJECT_SIZE, ConnectionBase::MAX_BSON_COMMAND_OVERHEAD, ConnectionBase::REDUCED_MAX_BSON_SIZE

Constants included from Loggable

Loggable::PREFIX

Instance Attribute Summary collapse

Attributes inherited from ConnectionBase

#description, #options, #server

Attributes included from Monitoring::Publishable

#monitoring

Attributes inherited from ConnectionCommon

#compressor

Instance Method Summary collapse

Methods inherited from ConnectionBase

#app_metadata, #dispatch

Methods included from Monitoring::Publishable

#publish_cmap_event, #publish_event, #publish_sdam_event

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger

Constructor Details

#initialize(socket, description, server, monitoring, options = {}) ⇒ PendingConnection

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.

Returns a new instance of PendingConnection.

Since:

  • 2.0.0



24
25
26
27
28
29
30
31
# File 'lib/mongo/server/pending_connection.rb', line 24

def initialize(socket, description, server, monitoring, options = {})
  @socket = socket
  @description = description
  @options = options
  @server = server
  @monitoring = monitoring
  @id = options[:id]
end

Instance Attribute Details

#idInteger (readonly)

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.

Returns The ID for the connection. This is the same ID as that of the regular Connection object for which this PendingConnection instance was created.

Returns:

  • (Integer)

    The ID for the connection. This is the same ID as that of the regular Connection object for which this PendingConnection instance was created.

Since:

  • 2.0.0



36
37
38
# File 'lib/mongo/server/pending_connection.rb', line 36

def id
  @id
end

Instance Method Details

#ensure_connected {|@socket| ... } ⇒ Object

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.

Yields:

  • (@socket)

Since:

  • 2.0.0



38
39
40
# File 'lib/mongo/server/pending_connection.rb', line 38

def ensure_connected
  yield @socket
end