dryad-cluster 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8fd45bcfbd26933d504e288d423714c6bdc44999e2f0ada2b229ef871b5374e
4
- data.tar.gz: ef3c7bd1242df7b566daa8ad3ee0a4e0cc5b41ccb48fce20aff2a1e04f26b5aa
3
+ metadata.gz: d1307a6537d19b819449916c7c2750ed95e33548cf6885a86961e2d7e91c2ad2
4
+ data.tar.gz: d7040e156d4d136c18731e9e2e40ad11ad9585bf1963bd8cb041a1ab5ef272dd
5
5
  SHA512:
6
- metadata.gz: d308a809da8afe6b078739fbc2908c230130a16933e6c8437d199679d850890395173591089313d2e2fe32fa3cc06701b4f5da4cff893f1ca591d907af52063f
7
- data.tar.gz: cf12e9bc11cd13703d7287ea775cff28f5431563bf788b5b1cf4a15de2615abc396ae15ad36ff7ed0497df2b7aa2705dd900d35e4498e4f371b9e08df71eb0e3
6
+ metadata.gz: 52e72dec04aa5648343e3c8c00275d136a8736b1087731072cad558420d6676c6d92b9e839265eeb41efce18a6d758267c36a163db6b168dc8368ecb756dba58
7
+ data.tar.gz: b667cb5c55f432dcfdf7417c120a0f099474f713b5c275db0e75904de27b90d6fe108c37948e8677b8364ad4d6d55b7c10c1feb6403c81236ffad0ecc7eafe13
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dryad-cluster (1.0.0)
4
+ dryad-cluster (1.1.0)
5
5
  concurrent-ruby (~> 1.1, >= 1.1.5)
6
- dryad-consul (= 1.0.0)
7
- dryad-core (= 1.0.0)
6
+ dryad-consul (= 1.1.0)
7
+ dryad-core (= 1.1.0)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -15,11 +15,11 @@ GEM
15
15
  diplomat (2.2.5)
16
16
  deep_merge (~> 1.0, >= 1.0.1)
17
17
  faraday (~> 0.9)
18
- dryad-consul (1.0.0)
18
+ dryad-consul (1.1.0)
19
19
  concurrent-ruby (~> 1.1, >= 1.1.5)
20
20
  diplomat (~> 2.2, >= 2.2.4)
21
- dryad-core (= 1.0.0)
22
- dryad-core (1.0.0)
21
+ dryad-core (= 1.1.0)
22
+ dryad-core (1.1.0)
23
23
  faraday (0.15.4)
24
24
  multipart-post (>= 1.2, < 3)
25
25
  multipart-post (2.1.1)
@@ -32,8 +32,19 @@ module Dryad
32
32
  end
33
33
 
34
34
  def sorted_instances(service_name, schema, groups, observer)
35
- registry = Object.const_get(@configuration.registry).instance
36
- sis = registry.service_instances(service_name, schema, groups, observer)
35
+ sis = if @configuration.cluster.nil?
36
+ registry = Object.const_get(@configuration.registry).instance
37
+ registry.service_instances(service_name, schema, groups, observer)
38
+ else
39
+ (@configuration.cluster[service_name.to_sym] || []).map do |s|
40
+ Dryad::Core::ServiceInstance.new(
41
+ name: service_name,
42
+ schema: schema,
43
+ address: s[:address],
44
+ port: s[:port]
45
+ )
46
+ end
47
+ end
37
48
  sis.sort {|a, b| "#{a.address}:#{a.port}" <=> "#{b.address}:#{b.port}"}
38
49
  end
39
50
  end
@@ -1,5 +1,5 @@
1
1
  module Dryad
2
2
  module Cluster
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dryad-cluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.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-07-11 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dryad-core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.1
19
+ version: 1.1.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: 1.0.1
26
+ version: 1.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dryad-consul
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.1
33
+ version: 1.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.1
40
+ version: 1.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: concurrent-ruby
43
43
  requirement: !ruby/object:Gem::Requirement