Module: Serfx
- Defined in:
- lib/serfx.rb,
lib/serfx/log.rb,
lib/serfx/utils.rb,
lib/serfx/version.rb,
lib/serfx/commands.rb,
lib/serfx/response.rb,
lib/serfx/connection.rb,
lib/serfx/exceptions.rb,
lib/serfx/utils/handler.rb,
lib/serfx/utils/async_job.rb
Overview
Provides version as a contsant for the serf gem
Defined Under Namespace
Modules: Commands, Utils Classes: Connection, Log, RPCError, Response
Constant Summary collapse
- VERSION =
'0.0.8'
Class Method Summary collapse
-
.connect(opts = {}) ⇒ Object
Creates a serf rpc connection, performs handshake and auth (if authkey is supplied).
Class Method Details
.connect(opts = {}) ⇒ Object
Creates a serf rpc connection, performs handshake and auth (if authkey is supplied). If a block is provided, the connection object will be yield-ed and the connection will be closed after the block’s execution, otherwise the connection will be returned Params:
opts
-
An optional hash which can have following keys:
-
host => Serf host’s rpc bind address (127.0.0.1 by default)
-
port => Serf host’s rpc port (7373 by default)
-
authkey => Encryption key for RPC communiction
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/serfx.rb', line 20 def self.connect(opts = {}) conn = Serfx::Connection.new(opts) conn.handshake conn.auth if opts.key?(:authkey) res = nil if block_given? res = yield conn conn.close unless conn.closed? res else conn end end |