ruby_skynet 1.3.0.alpha2 → 1.3.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +0 -2
- data/lib/ruby_skynet/ruby_skynet.rb +1 -1
- data/lib/ruby_skynet/static_service_registry.rb +3 -3
- data/lib/ruby_skynet/version.rb +1 -1
- data/test/service_registry_test.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6740cfd40beae05bf039e9bd5fa02281cf6a5e8a
|
4
|
+
data.tar.gz: 4fe0295d46526174f6756a505982a9e67d6cd127
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f49f801c0796148c2269a6a82db40980f8bbf6542bffd7bd9b448aebda4497c7a316a4d7a7a9ba512898234221bcb51e634ddd91d67d631ea7ed751b9f35fd22
|
7
|
+
data.tar.gz: 1420af0774b7404a1fdc227ff64d64300d214f4b505b17cacba14d56ddde5147a46259fd1067d15dc18940c785caba230552742a8ac0636eb893b0665d03829f
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -51,7 +51,7 @@ module RubySkynet
|
|
51
51
|
# By default it connects to a local ZooKeeper instance
|
52
52
|
# Use .configure! to supply a configuration file with any other settings
|
53
53
|
sync_cattr_reader :service_registry do
|
54
|
-
ServiceRegistry.new
|
54
|
+
ServiceRegistry.new(registry: {})
|
55
55
|
end
|
56
56
|
|
57
57
|
# Returns the current Registry Config information
|
@@ -10,15 +10,15 @@ require 'thread_safe'
|
|
10
10
|
# Format of the YAML file
|
11
11
|
# key: [String] "<name>/<version>/<region>"
|
12
12
|
# value: [Array<String>] 'host:port', 'host:port'
|
13
|
-
|
14
13
|
#
|
15
14
|
module RubySkynet
|
16
15
|
class StaticServiceRegistry
|
17
16
|
include SemanticLogger::Loggable
|
18
17
|
|
19
18
|
# Create a service registry
|
20
|
-
def initialize(
|
21
|
-
@services =
|
19
|
+
def initialize(params = {})
|
20
|
+
@services = params[:registry]
|
21
|
+
raise "Missing :registry in config that must list the availables services" unless @services
|
22
22
|
end
|
23
23
|
|
24
24
|
# Returns the Service Registry as a Hash
|
data/lib/ruby_skynet/version.rb
CHANGED
@@ -75,7 +75,8 @@ class ServiceRegistryTest < Test::Unit::TestCase
|
|
75
75
|
|
76
76
|
should "using * version match" do
|
77
77
|
assert (servers = RubySkynet.service_registry.servers_for(@service_name, '*', @region)), RubySkynet.service_registry.to_h.inspect
|
78
|
-
|
78
|
+
expected = RubySkynet::ServiceRegistry.respond_to?(:score_for_server) ? 3 : 4
|
79
|
+
assert_equal expected, servers.size, servers
|
79
80
|
assert_equal true, servers.include?("#{@hostname}:#{@port}"), servers
|
80
81
|
assert_equal true, servers.include?("#{@hostname}:#{@port+1}"), servers
|
81
82
|
assert_equal true, servers.include?("#{@hostname}:#{@port+3}"), servers
|
@@ -110,6 +111,7 @@ class ServiceRegistryTest < Test::Unit::TestCase
|
|
110
111
|
['10.0.11.0', 0 ],
|
111
112
|
].each do |test|
|
112
113
|
should "handle score #{test[1]}" do
|
114
|
+
skip "Not applicable to Static Service Registry" unless RubySkynet::ServiceRegistry.respond_to?(:score_for_server)
|
113
115
|
local_ip_address = "192.168.11.0"
|
114
116
|
assert_equal test[1], RubySkynet::ServiceRegistry.score_for_server(test[0], local_ip_address), "Local: #{local_ip_address} Server: #{test[0]} Score: #{test[1]}"
|
115
117
|
end
|