Method: Etcd::Leader#initialize
- Defined in:
- lib/etcd/leader.rb
#initialize(service_key, opts = {}) ⇒ Leader
Returns a new instance of Leader.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/etcd/leader.rb', line 8 def initialize(service_key, opts={}) # Unique service keys are necessary for avoiding clashes between different services in the etcd cluster @service_key = service_key @etcd = opts[:etcd] || Etcd.client @node_name = opts[:name] || SecureRandom.uuid @ttl = opts[:ttl] || 10 # Local Threads of execution @main_loop = nil @refresh_loop = nil # Some basic attributes @started = false @is_leader = false @current_leader = nil @membership_key = nil @modified_index = nil end |