Class: Dryad::Consul::ConfigProvider

Inherits:
Dryad::Core::ConfigProvider
  • Object
show all
Includes:
Singleton
Defined in:
lib/dryad/consul/config_provider.rb

Constant Summary collapse

WATCHER_EXECUTION_INTERVAL =
5 * 60

Instance Method Summary collapse

Constructor Details

#initializeConfigProvider

Returns a new instance of ConfigProvider.



10
11
12
# File 'lib/dryad/consul/config_provider.rb', line 10

def initialize
  @timers = {}
end

Instance Method Details

#load(path, observer = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/dryad/consul/config_provider.rb', line 14

def load(path, observer = nil)
  config = Dryad::Consul::KeyValueClient.get(path)
  if config.nil?
    nil
  else
    observer.version = config.ModifyIndex unless observer.nil?
    add_observer(observer, path)
    Dryad::Core::ConfigDesc.new(path, config.Value, config.ModifyIndex)
  end
end