Class: Synapse::BaseWatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/synapse/service_watcher/base.rb

Direct Known Subclasses

DnsWatcher, EC2Watcher, ZookeeperWatcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}, synapse) ⇒ BaseWatcher

Returns a new instance of BaseWatcher.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/synapse/service_watcher/base.rb', line 6

def initialize(opts={}, synapse)
  super()

  @synapse = synapse

  # set required service parameters
  %w{name discovery local_port}.each do |req|
    raise ArgumentError, "missing required option #{req}" unless opts[req]
  end

  @name = opts['name']
  @discovery = opts['discovery']
  @local_port = opts['local_port']

  # optional service parameters
  @listen = opts['listen'] || []
  @server_options = opts['server_options'] || ""
  @default_servers = opts['default_servers'] || []
  @server_port_override = opts['server_port_override']

  # set initial backends to default servers
  @backends = @default_servers

  validate_discovery_opts
end

Instance Attribute Details

#backendsObject (readonly)

Returns the value of attribute backends.



4
5
6
# File 'lib/synapse/service_watcher/base.rb', line 4

def backends
  @backends
end

#listenObject (readonly)

Returns the value of attribute listen.



4
5
6
# File 'lib/synapse/service_watcher/base.rb', line 4

def listen
  @listen
end

#local_portObject (readonly)

Returns the value of attribute local_port.



4
5
6
# File 'lib/synapse/service_watcher/base.rb', line 4

def local_port
  @local_port
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/synapse/service_watcher/base.rb', line 4

def name
  @name
end

#server_optionsObject (readonly)

Returns the value of attribute server_options.



4
5
6
# File 'lib/synapse/service_watcher/base.rb', line 4

def server_options
  @server_options
end

Instance Method Details

#startObject



32
33
34
# File 'lib/synapse/service_watcher/base.rb', line 32

def start
  log.info "synapse: starting stub watcher; this means doing nothing at all!"
end