Class: Protobuf::Rpc::Connectors::Base

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/protobuf/rpc/connectors/base.rb

Direct Known Subclasses

Socket, Zmq

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

initialize_logger, #log_exception, #log_signature, #logger, logger, logger=, #sign_message

Constructor Details

#initialize(options) ⇒ Base

Returns a new instance of Base.



31
32
33
# File 'lib/protobuf/rpc/connectors/base.rb', line 31

def initialize(options)
  @options = DEFAULT_OPTIONS.merge(options)
end

Instance Attribute Details

#complete_cbObject

Returns the value of attribute complete_cb.



29
30
31
# File 'lib/protobuf/rpc/connectors/base.rb', line 29

def complete_cb
  @complete_cb
end

#failure_cbObject

Returns the value of attribute failure_cb.



29
30
31
# File 'lib/protobuf/rpc/connectors/base.rb', line 29

def failure_cb
  @failure_cb
end

#optionsObject (readonly)

Returns the value of attribute options.



28
29
30
# File 'lib/protobuf/rpc/connectors/base.rb', line 28

def options
  @options
end

#success_cbObject

Returns the value of attribute success_cb.



29
30
31
# File 'lib/protobuf/rpc/connectors/base.rb', line 29

def success_cb
  @success_cb
end

Instance Method Details

#first_alive_load_balance?Boolean

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/protobuf/rpc/connectors/base.rb', line 35

def first_alive_load_balance?
  ENV.has_key?("PB_FIRST_ALIVE_LOAD_BALANCE") ||
    options[:first_alive_load_balance]
end

#ping_portObject



44
45
46
# File 'lib/protobuf/rpc/connectors/base.rb', line 44

def ping_port
  @ping_port ||= ENV["PB_RPC_PING_PORT"]
end

#ping_port_enabled?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/protobuf/rpc/connectors/base.rb', line 48

def ping_port_enabled?
  ENV.has_key?("PB_RPC_PING_PORT")
end

#send_requestObject



40
41
42
# File 'lib/protobuf/rpc/connectors/base.rb', line 40

def send_request
  raise 'If you inherit a Connector from Base you must implement send_request'
end