dryad-consul 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dryad/consul.rb +2 -0
- data/lib/dryad/consul/config_provider.rb +16 -0
- data/lib/dryad/consul/key_value_client.rb +19 -0
- data/lib/dryad/consul/version.rb +1 -6
- metadata +6 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6b3d7df222cf9cdd2cb3401a03af97b7f5cc5195f84307a71c3570a305d3c93c
         | 
| 4 | 
            +
              data.tar.gz: e953dfcdab5576ff3cf118be53cd1b041eeed557759c86a8bee1d300d7143de1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 47c719b64b1bffce5646a2708f0211e9de0d512d039956080af23338f6a692724ea79292ecd26da25b609af95d9221c752b0a67450c2da528a294d4de9a94bf9
         | 
| 7 | 
            +
              data.tar.gz: 2a1de26f4e4070560ae93b318091e397cb9f1796fda92bd6cf834fd854406f176fdc5cd00142f59053fb0a1f6c816bfa5bb4e1863cb0d05b355f16bfb13043cb
         | 
    
        data/lib/dryad/consul.rb
    CHANGED
    
    
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            module Dryad
         | 
| 2 | 
            +
              module Consul
         | 
| 3 | 
            +
                class ConfigProvider < Dryad::Core::ConfigProvider
         | 
| 4 | 
            +
                  class << self
         | 
| 5 | 
            +
                    def load(path, listener = nil)
         | 
| 6 | 
            +
                      config = Dryad::Consul::KeyValueClient.get(path)
         | 
| 7 | 
            +
                      if config.nil?
         | 
| 8 | 
            +
                        raise Dryad::Core::ConfigurationNotFound, path
         | 
| 9 | 
            +
                      else
         | 
| 10 | 
            +
                        Dryad::Core::ConfigDesc.new(path, config.Value, config.ModifyIndex)
         | 
| 11 | 
            +
                      end
         | 
| 12 | 
            +
                    end
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
            end
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            require "ostruct"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Dryad
         | 
| 4 | 
            +
              module Consul
         | 
| 5 | 
            +
                class KeyValueClient
         | 
| 6 | 
            +
                  class << self
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                    # Get a value by its key, potentially blocking for the first or next value
         | 
| 9 | 
            +
                    # @param key [String] the key
         | 
| 10 | 
            +
                    # @return [OpenStruct] The base64-decoded value associated with the key
         | 
| 11 | 
            +
                    def get(path)
         | 
| 12 | 
            +
                      OpenStruct.new ::Diplomat::Kv.get(path, decode_values: true).first
         | 
| 13 | 
            +
                    rescue Diplomat::KeyNotFound
         | 
| 14 | 
            +
                      nil
         | 
| 15 | 
            +
                    end
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
    
        data/lib/dryad/consul/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: dryad-consul
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Pan Jie
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019-05- | 
| 11 | 
            +
            date: 2019-05-29 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: dryad-core
         | 
| @@ -16,14 +16,14 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - '='
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 0. | 
| 19 | 
            +
                    version: 0.2.0
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - '='
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 0. | 
| 26 | 
            +
                    version: 0.2.0
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: diplomat
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -104,6 +104,8 @@ files: | |
| 104 104 | 
             
            - bin/setup
         | 
| 105 105 | 
             
            - dryad-consul.gemspec
         | 
| 106 106 | 
             
            - lib/dryad/consul.rb
         | 
| 107 | 
            +
            - lib/dryad/consul/config_provider.rb
         | 
| 108 | 
            +
            - lib/dryad/consul/key_value_client.rb
         | 
| 107 109 | 
             
            - lib/dryad/consul/service.rb
         | 
| 108 110 | 
             
            - lib/dryad/consul/service_client.rb
         | 
| 109 111 | 
             
            - lib/dryad/consul/service_registry.rb
         |