Class: Dryad::Consul::ConfigProvider
- Inherits:
-
Dryad::Core::ConfigProvider
- Object
- Dryad::Core::ConfigProvider
- Dryad::Consul::ConfigProvider
- Includes:
- Singleton
- Defined in:
- lib/dryad/consul/config_provider.rb
Constant Summary collapse
- WATCHER_EXECUTION_INTERVAL =
5 * 60
Instance Method Summary collapse
-
#initialize ⇒ ConfigProvider
constructor
A new instance of ConfigProvider.
- #load(path, observer = nil) ⇒ Object
Constructor Details
#initialize ⇒ ConfigProvider
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 |