Class: Mongo::Socket::Unix Private

Inherits:
Mongo::Socket show all
Defined in:
build/ruby-driver-v2.18/lib/mongo/socket/unix.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.

Wrapper for Unix sockets.

Since:

  • 2.0.0

Constant Summary

Constants inherited from Mongo::Socket

SSL_ERROR, TIMEOUT_ERROR, TIMEOUT_PACK, WRITE_CHUNK_SIZE

Instance Attribute Summary collapse

Attributes inherited from Mongo::Socket

#family, #options, #socket, #timeout

Instance Method Summary collapse

Methods inherited from Mongo::Socket

#alive?, #close, #connectable?, #connection_address, #connection_generation, #eof?, #gets, #monitor?, #read, #readbyte, #summary, #write

Constructor Details

#initialize(path, timeout, options = {}) ⇒ Unix

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.

Initializes a new Unix socket.

Examples:

Create the Unix socket.

Unix.new('/path/to.sock', 5)

Parameters:

  • path (String)

    The path.

  • timeout (Float)

    The socket timeout value.

  • options (Hash) (defaults to: {})

    The options.

Options Hash (options):

  • :connect_timeout (Float)

    Connect timeout (unused).

  • :connection_address (Address)

    Address of the connection that created this socket.

  • :connection_generation (Integer)

    Generation of the connection (for non-monitoring connections) that created this socket.

  • :monitor (true | false)

    Whether this socket was created by a monitoring connection.

Since:

  • 2.0.0



45
46
47
48
49
50
# File 'build/ruby-driver-v2.18/lib/mongo/socket/unix.rb', line 45

def initialize(path, timeout, options = {})
  super(timeout, options)
  @path = path
  @socket = ::UNIXSocket.new(path)
  set_socket_options(@socket)
end

Instance Attribute Details

#pathString (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 path The path to connect to.

Returns:

  • (String)

    path The path to connect to.

Since:

  • 2.0.0



53
54
55
# File 'build/ruby-driver-v2.18/lib/mongo/socket/unix.rb', line 53

def path
  @path
end