Class: Naminori::Service::Base
- Inherits:
-
Object
- Object
- Naminori::Service::Base
- Defined in:
- lib/naminori/service/base.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #default_config ⇒ Object
- #healty?(ip) ⇒ Boolean
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
21 22 23 24 25 |
# File 'lib/naminori/service/base.rb', line 21 def initialize(={}) @config = Naminori::Service::Configure.new( default_config.merge() ) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/naminori/service/base.rb', line 5 def config @config end |
Class Method Details
.event(lb_name, options) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/naminori/service/base.rb', line 7 def event(lb_name, ) case when Naminori::Serf.join? Naminori::Lb.get_lb(lb_name).add_member(event_ip, self.new()) when Naminori::Serf.leave? || Naminori::Serf.failed? Naminori::Lb.get_lb(lb_name).delete_member(event_ip, self.new()) end end |
.event_ip ⇒ Object
16 17 18 |
# File 'lib/naminori/service/base.rb', line 16 def event_ip Naminori::Serf.gets[:ip] end |
Instance Method Details
#default_config ⇒ Object
31 32 33 |
# File 'lib/naminori/service/base.rb', line 31 def default_config raise "Called abstract method: default_config" end |
#healty?(ip) ⇒ Boolean
27 28 29 |
# File 'lib/naminori/service/base.rb', line 27 def healty?(ip) raise "Called abstract method: healty?" end |