RingyDingy 1.5 → 1.6

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
  SHA1:
3
- metadata.gz: 49a70aaeac4ce0f4d9e3bddb018da38372ca5d0d
4
- data.tar.gz: 373f70d3c2e3bb548fdf5cfd81e32f77e40aeb32
3
+ metadata.gz: d8a4f704ed23112e54c4597dc6473483d8bdeb72
4
+ data.tar.gz: d2af91f407e5a026730d3bb8ae185a5e35b86c29
5
5
  SHA512:
6
- metadata.gz: 50ce6ae837b4dcde616b9c9d8dcf5376c01527a2a6300c9e6a7b2fa6b58e5787b4bbdf1aaa492fa5eec92d4f8562804b3af098dc7c8ff42d1470df7f323571a8
7
- data.tar.gz: eaec7dfff951f1b88bcfa18445a5427394d130a3e7a12e314004426cf1c28090602a74016c73fc7473c65ee8ac3d10ce831a0c2ccb19533abfc95660e0aafeb0
6
+ metadata.gz: d41e38e6c7519babb2960609c132ce61473b8dbdaa8df4117a24d17af8d6b8ae4dfe7b9b75ebb6269a2a952ebb02472780125f7ff5806d1fa60f9443410df33d
7
+ data.tar.gz: c86b6c4b10165c1fb58835c5d8b3992ab08c03d675826bb5ee2ca18bae72b42e05351cc73ec46dc0b5319972b305d5792cf406005ad079b64b28e55b219a98b6
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,8 @@
1
+ === 1.6 / 2013-06-05
2
+
3
+ * RingyDingy.new now allows a Rinda::RingFinger or TupleSpace reference as the
4
+ last "lookup" parameter in addition to a list of broadcast addresses.
5
+
1
6
  === 1.5 / 2013-05-03
2
7
 
3
8
  * Added RingyDingy::Lookup to handle lookup of services.
@@ -22,7 +22,7 @@ class RingyDingy
22
22
  ##
23
23
  # The version of RingyDingy you are using
24
24
 
25
- VERSION = '1.5'
25
+ VERSION = '1.6'
26
26
 
27
27
  ##
28
28
  # Interval to check the RingServer for our registration information.
@@ -65,9 +65,14 @@ class RingyDingy
65
65
  ##
66
66
  # Creates a new RingyDingy that registers +object+ as +service+ with
67
67
  # optional identifier +name+.
68
+ #
69
+ # The +lookup+ is used to locate a Rinda::RingServer. It can be unspecified
70
+ # (to look for a ring server in the BROADCAST_LIST), an Array of host names
71
+ # or IP address strings, a Rinda::RingFinger or RingyDingy::Lookup using a
72
+ # specific broadcast list or a reference to a Rinda::TupleSpace.
68
73
 
69
74
  def initialize object, service = :RingyDingy, name = nil,
70
- broadcast_list = BROADCAST_LIST
75
+ lookup = BROADCAST_LIST
71
76
  DRb.start_service unless DRb.primary_server
72
77
 
73
78
  @identifier = [Socket.gethostname.downcase, $PID, name].compact.join '_'
@@ -77,9 +82,20 @@ class RingyDingy
77
82
  @check_every = 15
78
83
  @renewer = Rinda::SimpleRenewer.new
79
84
 
80
- @ring_finger = Rinda::RingFinger.new broadcast_list
85
+ @ring_finger = nil
81
86
  @ring_server = nil
82
87
 
88
+ case lookup
89
+ when Array then
90
+ @ring_finger = Rinda::RingFinger.new lookup
91
+ when Rinda::RingFinger then
92
+ @ring_finger = lookup
93
+ when RingyDingy::Lookup then
94
+ @ring_finger = lookup.ring_finger
95
+ else
96
+ @ring_server = lookup
97
+ end
98
+
83
99
  @thread = nil
84
100
  end
85
101
 
@@ -50,8 +50,6 @@ class RingyDingy::Lookup
50
50
 
51
51
  def enumerate_tuple_spaces
52
52
  Thread.start do
53
- spaces = {}
54
-
55
53
  loop do
56
54
  @ring_finger.lookup_ring do |tuple_space|
57
55
  yield tuple_space
@@ -113,7 +111,7 @@ class RingyDingy::Lookup
113
111
  tuple = tuple_space.read template, renewer
114
112
 
115
113
  queue.push tuple[2]
116
- rescue DRb::DRbConnError => e
114
+ rescue DRb::DRbConnError
117
115
  end
118
116
  end
119
117
  end
@@ -89,6 +89,34 @@ class TestRingyDingy < Test::Unit::TestCase
89
89
  Rinda.const_set :RingFinger, orig_ring_finger
90
90
  end
91
91
 
92
+ def test_initialize_broadcast_list
93
+ service = RingyDingy.new @object, nil, 'blah', %w[192.0.2.1]
94
+
95
+ assert_equal %w[192.0.2.1], service.ring_finger.broadcast_list
96
+ end
97
+
98
+ def test_initialize_lookup
99
+ lookup = RingyDingy::Lookup.new %w[192.0.2.1]
100
+ service = RingyDingy.new @object, nil, 'blah', lookup
101
+
102
+ assert_same lookup.ring_finger, service.ring_finger
103
+ end
104
+
105
+ def test_initialize_ring_finger
106
+ ring_finger = Rinda::RingFinger.new %w[192.0.2.1]
107
+ service = RingyDingy.new @object, nil, 'blah', ring_finger
108
+
109
+ assert_same ring_finger, service.ring_finger
110
+ end
111
+
112
+ def test_initialize_tuple_space
113
+ tuple_space = Rinda::TupleSpace.new
114
+ service = RingyDingy.new @object, nil, 'blah', tuple_space
115
+
116
+ assert_nil service.ring_finger
117
+ assert_same tuple_space, service.ring_server
118
+ end
119
+
92
120
  def test_identifier
93
121
  assert_equal @identifier, @ringy_dingy.identifier
94
122
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RingyDingy
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.5'
4
+ version: '1.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -30,7 +30,7 @@ cert_chain:
30
30
  KDyY1VIazVgoC8XvR4h/95/iScPiuglzA+DBG1hip1xScAtw05BrXyUNrc9CEMYU
31
31
  wgF94UVoHRp6ywo8I7NP3HcwFQDFNEZPNGXsng==
32
32
  -----END CERTIFICATE-----
33
- date: 2013-05-03 00:00:00.000000000 Z
33
+ date: 2013-06-05 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: minitest
@@ -38,14 +38,14 @@ dependencies:
38
38
  requirements:
39
39
  - - ~>
40
40
  - !ruby/object:Gem::Version
41
- version: '4.6'
41
+ version: '4.7'
42
42
  type: :development
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ~>
47
47
  - !ruby/object:Gem::Version
48
- version: '4.6'
48
+ version: '4.7'
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rdoc
51
51
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file