linda 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +5 -0
- data/README.md +5 -0
- data/lib/linda/test/tuplespace.rb +71 -18
- data/lib/linda/tuplespace.rb +1 -1
- data/lib/linda/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 222fc25528f372a65dedf1ba623a39bedb5a1611
|
4
|
+
data.tar.gz: 122f6d8a6d936b20e4b39f3946c499916c7124e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa137ac6811892d6ffda280d7c43a821a5daee3d92f57548d065b2efb41c848f032bf5086f3953f9d6f00aabb2037e9aea841e1156dbf4a4929eabc5e012598d
|
7
|
+
data.tar.gz: 682893a29a0406d0e5edc61a28f6fc879aa2214b6f2b20f0b78b9af605b1b29812d7f2bb0a8b7498775d4b2d9ef507523326bb5e85650ffbf9da455d55e93094
|
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -98,6 +98,11 @@ Tuple/TupleSpace Functions
|
|
98
98
|
- callback Tuples which matches when TupleSpace#write(tuple) is called.
|
99
99
|
|
100
100
|
|
101
|
+
### TupleSpace#cancel(callback_id)
|
102
|
+
|
103
|
+
- remove read/take/watch callback by Callback-ID.
|
104
|
+
|
105
|
+
|
101
106
|
Test your Linda implementation
|
102
107
|
------------------------------
|
103
108
|
|
@@ -37,24 +37,24 @@ module Linda
|
|
37
37
|
assert_equal @space.size, 0
|
38
38
|
_tuple1 = nil
|
39
39
|
@space.read [1,2] do |tuple|
|
40
|
-
_tuple1 = tuple
|
40
|
+
_tuple1 = tuple.data
|
41
41
|
end
|
42
42
|
_tuple2 = nil
|
43
43
|
@space.read [1,"a"] do |tuple|
|
44
|
-
_tuple2 = tuple
|
44
|
+
_tuple2 = tuple.data
|
45
45
|
end
|
46
46
|
_tuple3 = nil
|
47
47
|
@space.read [1,2,3] do |tuple|
|
48
|
-
_tuple3 = tuple
|
48
|
+
_tuple3 = tuple.data
|
49
49
|
end
|
50
50
|
@space.write [1,2,3]
|
51
|
-
assert_equal _tuple1
|
51
|
+
assert_equal _tuple1, [1,2,3]
|
52
52
|
assert_equal _tuple2, nil
|
53
|
-
assert_equal _tuple3
|
53
|
+
assert_equal _tuple3, [1,2,3]
|
54
54
|
assert_equal @space.read([1]).data, [1,2,3]
|
55
55
|
assert_equal @space.size, 1
|
56
56
|
@space.write [1,2,4]
|
57
|
-
assert_equal _tuple1
|
57
|
+
assert_equal _tuple1, [1,2,3]
|
58
58
|
assert_equal @space.size, 2
|
59
59
|
end
|
60
60
|
|
@@ -82,28 +82,28 @@ module Linda
|
|
82
82
|
assert_equal @space.size, 0
|
83
83
|
_tuple1 = nil
|
84
84
|
@space.take [1,2] do |tuple|
|
85
|
-
_tuple1 = tuple
|
85
|
+
_tuple1 = tuple.data
|
86
86
|
end
|
87
87
|
_tuple2 = nil
|
88
88
|
@space.take [1,"a"] do |tuple|
|
89
|
-
_tuple2 = tuple
|
89
|
+
_tuple2 = tuple.data
|
90
90
|
end
|
91
91
|
_tuple3 = nil
|
92
92
|
@space.read [1,2,3] do |tuple|
|
93
|
-
_tuple3 = tuple
|
93
|
+
_tuple3 = tuple.data
|
94
94
|
end
|
95
95
|
_tuple4 = nil
|
96
96
|
@space.take [1,2,3] do |tuple|
|
97
|
-
_tuple4 = tuple
|
97
|
+
_tuple4 = tuple.data
|
98
98
|
end
|
99
99
|
1.upto(3) do |i|
|
100
100
|
@space.write [1,2,3,"a"*i]
|
101
101
|
end
|
102
102
|
assert_equal @space.size, 1
|
103
|
-
assert_equal _tuple1
|
103
|
+
assert_equal _tuple1, [1,2,3,"a"]
|
104
104
|
assert_equal _tuple2, nil
|
105
|
-
assert_equal _tuple3
|
106
|
-
assert_equal _tuple4
|
105
|
+
assert_equal _tuple3, [1,2,3,"aa"]
|
106
|
+
assert_equal _tuple4, [1,2,3,"aa"]
|
107
107
|
assert_equal @space.take([1]).data, [1,2,3,"aaa"]
|
108
108
|
assert_equal @space.size, 0
|
109
109
|
end
|
@@ -112,20 +112,20 @@ module Linda
|
|
112
112
|
assert_equal @space.size, 0
|
113
113
|
_tuple1 = nil
|
114
114
|
@space.take [1] do |tuple|
|
115
|
-
_tuple1 = tuple
|
115
|
+
_tuple1 = tuple.data
|
116
116
|
end
|
117
117
|
results = []
|
118
118
|
@space.watch [1,2] do |tuple|
|
119
|
-
results << tuple
|
119
|
+
results << tuple.data
|
120
120
|
end
|
121
121
|
@space.write [1,2,3]
|
122
122
|
@space.write [1,2,"aa"]
|
123
123
|
@space.write [1,"a",3]
|
124
|
-
assert_equal _tuple1
|
124
|
+
assert_equal _tuple1, [1,2,3]
|
125
125
|
assert_equal @space.size, 2
|
126
126
|
assert_equal results.size, 2
|
127
|
-
assert_equal results[0]
|
128
|
-
assert_equal results[1]
|
127
|
+
assert_equal results[0], [1,2,3]
|
128
|
+
assert_equal results[1], [1,2,"aa"]
|
129
129
|
end
|
130
130
|
|
131
131
|
def test_tuple_expire
|
@@ -143,6 +143,59 @@ module Linda
|
|
143
143
|
assert_equal @space.size, 0
|
144
144
|
end
|
145
145
|
|
146
|
+
def test_cancel_read
|
147
|
+
_tuple1 = nil
|
148
|
+
_tuple2 = nil
|
149
|
+
callback_id1 = @space.read [1,2] do |tuple|
|
150
|
+
_tuple1 = tuple.data
|
151
|
+
end
|
152
|
+
callback_id2 = @space.read [1,2] do |tuple|
|
153
|
+
_tuple2 = tuple.data
|
154
|
+
end
|
155
|
+
@space.cancel callback_id1
|
156
|
+
@space.write [1,2,3]
|
157
|
+
sleep 1
|
158
|
+
assert_equal _tuple1, nil
|
159
|
+
assert_equal _tuple2, [1,2,3]
|
160
|
+
assert callback_id1 != callback_id2
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_cancel_take
|
164
|
+
_tuple1 = nil
|
165
|
+
_tuple2 = nil
|
166
|
+
callback_id1 = @space.take [1,2] do |tuple|
|
167
|
+
_tuple1 = tuple.data
|
168
|
+
end
|
169
|
+
callback_id2 = @space.take [1,2] do |tuple|
|
170
|
+
_tuple2 = tuple.data
|
171
|
+
end
|
172
|
+
@space.cancel callback_id1
|
173
|
+
@space.write [1,2,3]
|
174
|
+
sleep 1
|
175
|
+
assert_equal _tuple1, nil
|
176
|
+
assert_equal _tuple2, [1,2,3]
|
177
|
+
assert callback_id1 != callback_id2
|
178
|
+
end
|
179
|
+
|
180
|
+
|
181
|
+
def test_cancel_watch
|
182
|
+
_tuple1 = nil
|
183
|
+
_tuple2 = nil
|
184
|
+
callback_id1 = @space.watch [1,2] do |tuple|
|
185
|
+
_tuple1 = tuple.data
|
186
|
+
end
|
187
|
+
callback_id2 = @space.watch [1,2] do |tuple|
|
188
|
+
_tuple2 = tuple.data
|
189
|
+
end
|
190
|
+
@space.write [1,2,3]
|
191
|
+
@space.cancel callback_id1
|
192
|
+
@space.write [1,2,3,4]
|
193
|
+
sleep 1
|
194
|
+
assert_equal _tuple1, [1,2,3]
|
195
|
+
assert_equal _tuple2, [1,2,3,4]
|
196
|
+
assert callback_id1 != callback_id2
|
197
|
+
end
|
198
|
+
|
146
199
|
end
|
147
200
|
end
|
148
201
|
end
|
data/lib/linda/tuplespace.rb
CHANGED
data/lib/linda/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -119,3 +119,4 @@ test_files:
|
|
119
119
|
- test/test_helper.rb
|
120
120
|
- test/test_tuple.rb
|
121
121
|
- test/test_tuplespace.rb
|
122
|
+
has_rdoc:
|