class Naminori::Service::Base
Attributes
config[R]
Public Class Methods
new(config_klass)
click to toggle source
# File lib/naminori/service/base.rb, line 6 def initialize(config_klass) config_klass.config = default_config.merge(config_klass.config) @config = config_klass end
Public Instance Methods
default_config()
click to toggle source
# File lib/naminori/service/base.rb, line 27 def default_config raise "Called abstract method: default_config" end
healty?(ip)
click to toggle source
# File lib/naminori/service/base.rb, line 23 def healty?(ip) raise "Called abstract method: healty?" end
run()
click to toggle source
# File lib/naminori/service/base.rb, line 11 def run if Naminori::Serf.role?(config.role.to_s) ip = Naminori::Serf.gets[:ip] case when Naminori::Serf.join? Object.const_get("Naminori::Lb::#{config.lb.to_s.capitalize}").add_member(ip, self) when Naminori::Serf.leave? || Naminori::Serf.failed? Object.const_get("Naminori::Lb::#{config.lb.to_s.capitalize}").delete_member(ip, self) end end end