Module: Revactor::UNIX
- Defined in:
- lib/revactor/unix.rb
Overview
The UNIX module holds all Revactor functionality related to the UNIX domain sockets, including drop-in replacements for Ruby UNIX Sockets which can operate concurrently using Actors.
Defined Under Namespace
Classes: ConnectError, Listener, Socket
Constant Summary collapse
- CONNECT_TIMEOUT =
Number of seconds to wait for a connection
10
Class Method Summary collapse
-
.connect(path, options = {}) ⇒ Object
Connect to the specified path for a UNIX domain socket Accepts the following options:.
-
.listen(path, options = {}) ⇒ Object
Listen on the specified path.
Class Method Details
.connect(path, options = {}) ⇒ Object
Connect to the specified path for a UNIX domain socket Accepts the following options:
:active - Controls how data is read from the socket. See the
documentation for Revactor::UNIX::Socket#active=
24 25 26 27 28 29 30 31 |
# File 'lib/revactor/unix.rb', line 24 def self.connect(path, = {}) socket = begin Socket.connect path, rescue SystemCallError raise ConnectError, "connection refused" end socket.attach Rev::Loop.default end |
.listen(path, options = {}) ⇒ Object
Listen on the specified path. Accepts the following options:
:active - Default active setting for new connections. See the
documentation Rev::UNIX::Socket#active= for more info
:controller - The controlling actor, default Actor.current
:filter - An symbol/class or array of symbols/classes which implement
#encode and #decode methods to transform data sent and
received data respectively via Revactor::UNIX::Socket.
See the "Filters" section in the README for more information
45 46 47 |
# File 'lib/revactor/unix.rb', line 45 def self.listen(path, = {}) Listener.new(path, ).attach(Rev::Loop.default).disable end |