Class: DeadmanCheck::KeySet
- Inherits:
-
Object
- Object
- DeadmanCheck::KeySet
- Defined in:
- lib/deadman_check_keyset.rb
Overview
KeySet Class
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#key ⇒ Object
Returns the value of attribute key.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
- #_configure_diplomat(host, port) ⇒ Object
- #_update_consul_key(host, port, key) ⇒ Object
-
#initialize(host, port, key) ⇒ KeySet
constructor
A new instance of KeySet.
- #run_consul_key_update ⇒ Object
Constructor Details
#initialize(host, port, key) ⇒ KeySet
Returns a new instance of KeySet.
10 11 12 13 14 |
# File 'lib/deadman_check_keyset.rb', line 10 def initialize(host, port, key) @host = host @port = port @key = key end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
8 9 10 |
# File 'lib/deadman_check_keyset.rb', line 8 def host @host end |
#key ⇒ Object
Returns the value of attribute key.
8 9 10 |
# File 'lib/deadman_check_keyset.rb', line 8 def key @key end |
#port ⇒ Object
Returns the value of attribute port.
8 9 10 |
# File 'lib/deadman_check_keyset.rb', line 8 def port @port end |
Instance Method Details
#_configure_diplomat(host, port) ⇒ Object
16 17 18 19 20 |
# File 'lib/deadman_check_keyset.rb', line 16 def _configure_diplomat(host, port) Diplomat.configure do |config| config.url = "http://#{host}:#{port}" end end |
#_update_consul_key(host, port, key) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/deadman_check_keyset.rb', line 22 def _update_consul_key(host, port, key) DeadmanCheck::DeadmanCheckGlobal.new.configure_diplomat(host, port) epoch_time_now = DeadmanCheck::DeadmanCheckGlobal.new.get_epoch_time Diplomat::Kv.put(key, "#{epoch_time_now}") puts "Consul key #{key} updated EPOCH to #{epoch_time_now}" end |
#run_consul_key_update ⇒ Object
29 30 31 |
# File 'lib/deadman_check_keyset.rb', line 29 def run_consul_key_update _update_consul_key(@host, @port, @key) end |