iotas 0.0.3 → 0.0.4
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.
- data/lib/iotas/door.rb +7 -5
- data/lib/iotas/particle.rb +20 -7
- data/lib/iotas/room.rb +8 -0
- data/lib/iotas/spin.rb +2 -2
- data/lib/version.rb +1 -1
- data/spec/board_spec.rb +2 -2
- data/spec/door_spec.rb +8 -4
- data/spec/particle_spec.rb +46 -29
- data/spec/room_spec.rb +42 -23
- data/spec/spin_spec.rb +2 -2
- data/test/{test_evendoors.rb → test_iotas.rb} +6 -6
- metadata +4 -4
data/lib/iotas/door.rb
CHANGED
@@ -44,7 +44,7 @@ module Iotas
|
|
44
44
|
#
|
45
45
|
def require_p p_kls
|
46
46
|
p = @spin.require_p p_kls
|
47
|
-
p.
|
47
|
+
p.init! self
|
48
48
|
p
|
49
49
|
end
|
50
50
|
#
|
@@ -72,14 +72,16 @@ module Iotas
|
|
72
72
|
@spin.release_p p
|
73
73
|
end
|
74
74
|
#
|
75
|
-
def send_p p
|
76
|
-
p.
|
75
|
+
def send_p p, a=nil
|
76
|
+
p.init! self
|
77
|
+
p.set_dst! a, self if a
|
77
78
|
@saved=nil if @saved==p # particle is sent back the data, all is good
|
78
79
|
@parent.send_p p # daddy will know what to do
|
79
80
|
end
|
80
81
|
#
|
81
|
-
def send_sys_p p
|
82
|
-
p.
|
82
|
+
def send_sys_p p, a=nil
|
83
|
+
p.init! self
|
84
|
+
p.set_dst! a, self if a
|
83
85
|
@saved=nil if @saved==p # particle is sent back the data, all is good
|
84
86
|
@parent.send_sys_p p # daddy will know what to do
|
85
87
|
end
|
data/lib/iotas/particle.rb
CHANGED
@@ -76,16 +76,19 @@ module Iotas
|
|
76
76
|
end
|
77
77
|
#
|
78
78
|
def reset!
|
79
|
-
@ts =
|
80
|
-
@src = @dst = @room = @door = @action = @link_value = nil
|
79
|
+
@ts = @src = @dst = @room = @door = @action = @link_value = nil
|
81
80
|
@dsts.clear
|
82
81
|
@link_fields.clear
|
83
82
|
@payload.clear
|
84
83
|
@merged.clear
|
85
84
|
end
|
86
85
|
#
|
87
|
-
|
88
|
-
|
86
|
+
def init! src
|
87
|
+
@src = src
|
88
|
+
@ts = Time.now
|
89
|
+
end
|
90
|
+
#
|
91
|
+
attr_reader :ts, :src, :dst, :room, :door, :action, :link_value, :payload
|
89
92
|
#
|
90
93
|
# routing
|
91
94
|
#
|
@@ -107,12 +110,16 @@ module Iotas
|
|
107
110
|
end
|
108
111
|
end
|
109
112
|
#
|
110
|
-
def
|
111
|
-
@dst = @room = @door = @action = nil
|
112
|
-
clear_dsts!
|
113
|
+
def add_dst a, d=''
|
113
114
|
add_dsts d+Iotas::ACT_SEP+a
|
114
115
|
end
|
115
116
|
#
|
117
|
+
def set_dst! a, d
|
118
|
+
@room = @door = nil
|
119
|
+
@action = a
|
120
|
+
@dst = d
|
121
|
+
end
|
122
|
+
#
|
116
123
|
def split_dst!
|
117
124
|
@dst = @room = @door = @action = nil
|
118
125
|
return if (n = next_dst).nil?
|
@@ -133,6 +140,12 @@ module Iotas
|
|
133
140
|
@dsts.shift
|
134
141
|
end
|
135
142
|
#
|
143
|
+
def dst_reached!
|
144
|
+
d = @dst
|
145
|
+
@dst = nil
|
146
|
+
d
|
147
|
+
end
|
148
|
+
#
|
136
149
|
def error! e, dst=nil
|
137
150
|
@action = Iotas::ACT_ERROR
|
138
151
|
@dst = dst||@src
|
data/lib/iotas/room.rb
CHANGED
@@ -134,6 +134,10 @@ module Iotas
|
|
134
134
|
#
|
135
135
|
def send_p p
|
136
136
|
puts " * send_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if @spin.debug_routing
|
137
|
+
if p.dst
|
138
|
+
puts " -> #{p.dst.path}#{Iotas::ACT_SEP}#{p.action}" if @spin.debug_routing
|
139
|
+
return @spin.post_p p
|
140
|
+
end
|
137
141
|
if p.src.nil?
|
138
142
|
# do not route orphan particles !!
|
139
143
|
p.error! Iotas::ERROR_ROUTE_NS, @spin
|
@@ -156,6 +160,10 @@ module Iotas
|
|
156
160
|
#
|
157
161
|
def send_sys_p p
|
158
162
|
puts " * send_sys_p #{(p.next_dst.nil? ? 'no dst' : p.next_dst)} ..." if @spin.debug_routing
|
163
|
+
if p.dst
|
164
|
+
puts " -> #{p.dst.path}#{Iotas::ACT_SEP}#{p.action}" if @spin.debug_routing
|
165
|
+
return @spin.post_sys_p p
|
166
|
+
end
|
159
167
|
if p.next_dst
|
160
168
|
p.split_dst!
|
161
169
|
if p.door
|
data/lib/iotas/spin.rb
CHANGED
@@ -128,11 +128,11 @@ module Iotas
|
|
128
128
|
while @run and (@sys_fifo.length>0 or @app_fifo.length>0)
|
129
129
|
while @run and @sys_fifo.length>0
|
130
130
|
p = @sys_fifo.shift
|
131
|
-
p.
|
131
|
+
p.dst_reached!.process_sys_p p
|
132
132
|
end
|
133
133
|
while @run and @app_fifo.length>0
|
134
134
|
p = @app_fifo.shift
|
135
|
-
p.
|
135
|
+
p.dst_reached!.process_p p
|
136
136
|
break
|
137
137
|
end
|
138
138
|
end
|
data/lib/version.rb
CHANGED
data/spec/board_spec.rb
CHANGED
@@ -68,9 +68,9 @@ describe Iotas::Board do
|
|
68
68
|
b0.process_p p0
|
69
69
|
p0.merged(0).should be_nil
|
70
70
|
# need to set it to p0 too, so case in Board0 is ok
|
71
|
-
p0.
|
71
|
+
p0.add_dst Iotas::ACT_FOLLOW
|
72
72
|
p0.split_dst!
|
73
|
-
p1.
|
73
|
+
p1.add_dst Iotas::ACT_FOLLOW
|
74
74
|
p1.split_dst!
|
75
75
|
b0.process_p p1
|
76
76
|
b0.ok.should be_true
|
data/spec/door_spec.rb
CHANGED
@@ -55,27 +55,31 @@ describe Iotas::Door do
|
|
55
55
|
d0 = Door0.new 'door0', f
|
56
56
|
p0 = d0.require_p Iotas::Particle
|
57
57
|
#
|
58
|
-
p0.
|
58
|
+
p0.add_dst 'SEND'
|
59
59
|
p0.split_dst!
|
60
60
|
d0.process_p p0
|
61
61
|
f.p.should eql p0
|
62
|
+
p0.clear_dsts!
|
62
63
|
#
|
63
|
-
p0.
|
64
|
+
p0.add_dst 'SEND_SYS'
|
64
65
|
p0.split_dst!
|
65
66
|
d0.process_p p0
|
66
67
|
f.sp.should eql p0
|
68
|
+
p0.clear_dsts!
|
67
69
|
#
|
68
|
-
p0.
|
70
|
+
p0.add_dst 'RELEASE'
|
69
71
|
p0.split_dst!
|
70
72
|
d0.process_p p0
|
71
73
|
p1 = d0.require_p Iotas::Particle
|
72
74
|
p1.should be p0
|
75
|
+
p0.clear_dsts!
|
73
76
|
#
|
74
|
-
p0.
|
77
|
+
p0.add_dst 'LOST'
|
75
78
|
p0.split_dst!
|
76
79
|
d0.process_p p0
|
77
80
|
p1 = d0.require_p Iotas::Particle
|
78
81
|
p1.should be p0
|
82
|
+
p0.clear_dsts!
|
79
83
|
#
|
80
84
|
d0.process_sys_p p0
|
81
85
|
p1 = @spin.require_p Iotas::Particle
|
data/spec/particle_spec.rb
CHANGED
@@ -80,52 +80,69 @@ describe Iotas::Particle do
|
|
80
80
|
#
|
81
81
|
it "wrong path should raise exeption" do
|
82
82
|
p = Iotas::Particle.new
|
83
|
-
lambda { p.
|
84
|
-
lambda { p.
|
85
|
-
lambda { p.
|
86
|
-
lambda { p.
|
87
|
-
lambda { p.
|
88
|
-
lambda { p.
|
89
|
-
lambda { p.
|
90
|
-
lambda { p.
|
91
|
-
lambda { p.
|
92
|
-
lambda { p.
|
93
|
-
lambda { p.
|
94
|
-
lambda { p.
|
83
|
+
lambda { p.add_dst 'action', '/room' }.should raise_error(Iotas::Exception)
|
84
|
+
lambda { p.add_dst 'action', 'room/' }.should raise_error(Iotas::Exception)
|
85
|
+
lambda { p.add_dst '', 'room/' }.should raise_error(Iotas::Exception)
|
86
|
+
lambda { p.add_dst 'action', 'room//door' }.should raise_error(Iotas::Exception)
|
87
|
+
lambda { p.add_dst ' ' }.should raise_error(Iotas::Exception)
|
88
|
+
lambda { p.add_dst ' ', '' }.should raise_error(Iotas::Exception)
|
89
|
+
lambda { p.add_dst 'f f' }.should raise_error(Iotas::Exception)
|
90
|
+
lambda { p.add_dst '', ' d' }.should raise_error(Iotas::Exception)
|
91
|
+
lambda { p.add_dst '' }.should raise_error(Iotas::Exception)
|
92
|
+
lambda { p.add_dst '', '' }.should raise_error(Iotas::Exception)
|
93
|
+
lambda { p.add_dst nil }.should raise_error(TypeError)
|
94
|
+
lambda { p.add_dst 'action', nil }.should raise_error(NoMethodError)
|
95
95
|
end
|
96
96
|
#
|
97
|
-
it "routing: set_dst!
|
97
|
+
it "routing: set_dst!" do
|
98
98
|
p = Iotas::Particle.new
|
99
|
-
d0 = Iotas::Door.new 'door0', nil
|
99
|
+
d0 = Iotas::Door.new 'door0', nil
|
100
|
+
#
|
101
|
+
p.set_dst! 'action', d0
|
102
|
+
p.action.should eql 'action'
|
103
|
+
p.dst.should be d0
|
104
|
+
end
|
105
|
+
#
|
106
|
+
it "routing: add_dst and split_dst!" do
|
107
|
+
p = Iotas::Particle.new
|
108
|
+
d0 = Iotas::Door.new 'door0', nil
|
100
109
|
#
|
101
|
-
p.
|
110
|
+
p.split_dst!
|
111
|
+
p.room.should be_nil
|
112
|
+
p.door.should be_nil
|
113
|
+
p.action.should be_nil
|
114
|
+
#
|
115
|
+
p.add_dst 'action', 'room0/room1/door'
|
102
116
|
p.split_dst!
|
103
117
|
p.room.should eql 'room0/room1'
|
104
118
|
p.door.should eql 'door'
|
105
119
|
p.action.should eql 'action'
|
120
|
+
p.clear_dsts!
|
106
121
|
#
|
107
|
-
p.
|
122
|
+
p.add_dst 'action', 'room/door'
|
108
123
|
p.split_dst!
|
109
124
|
p.room.should eql 'room'
|
110
125
|
p.door.should eql 'door'
|
111
126
|
p.action.should eql 'action'
|
127
|
+
p.clear_dsts!
|
112
128
|
#
|
113
|
-
p.
|
129
|
+
p.add_dst 'action', ''
|
114
130
|
p.split_dst!
|
115
|
-
p.room.should
|
116
|
-
p.door.should
|
131
|
+
p.room.should be_nil
|
132
|
+
p.door.should be_nil
|
117
133
|
p.action.should eql 'action'
|
134
|
+
p.clear_dsts!
|
118
135
|
#
|
119
|
-
p.
|
136
|
+
p.add_dst 'action'
|
120
137
|
p.split_dst!
|
121
|
-
p.room.should
|
122
|
-
p.door.should
|
138
|
+
p.room.should be_nil
|
139
|
+
p.door.should be_nil
|
123
140
|
p.action.should eql 'action'
|
124
|
-
#
|
125
141
|
p.clear_dsts!
|
142
|
+
#
|
126
143
|
p.add_dsts 'door?action,?action'
|
127
144
|
p.split_dst!
|
128
|
-
p.room.should
|
145
|
+
p.room.should be_nil
|
129
146
|
p.door.should eql 'door'
|
130
147
|
p.action.should eql 'action'
|
131
148
|
#
|
@@ -133,8 +150,8 @@ describe Iotas::Particle do
|
|
133
150
|
#
|
134
151
|
p.dst.should be d0
|
135
152
|
p.split_dst!
|
136
|
-
p.room.should
|
137
|
-
p.door.should
|
153
|
+
p.room.should be_nil
|
154
|
+
p.door.should be_nil
|
138
155
|
p.action.should eql 'action'
|
139
156
|
#
|
140
157
|
end
|
@@ -142,7 +159,7 @@ describe Iotas::Particle do
|
|
142
159
|
it "routing: error!" do
|
143
160
|
p = Iotas::Particle.new
|
144
161
|
d = Iotas::Door.new 'door', nil
|
145
|
-
p.
|
162
|
+
p.init! d
|
146
163
|
p.add_dsts 'door?action,?action'
|
147
164
|
p.next_dst.should eql 'door?action'
|
148
165
|
p.error! 'err_msg'
|
@@ -193,7 +210,7 @@ describe Iotas::Particle do
|
|
193
210
|
p0['k0'] = 'v0'
|
194
211
|
p0['k1'] = 'v1'
|
195
212
|
p0['k2'] = 'v2'
|
196
|
-
p0.
|
213
|
+
p0.init! s3
|
197
214
|
p0.set_link_fields 'k0,k2'
|
198
215
|
p0.add_dsts 'room0/room1/room2/doorX?myaction,door?action,?action'
|
199
216
|
p0.split_dst!
|
@@ -201,7 +218,7 @@ describe Iotas::Particle do
|
|
201
218
|
p1['k3'] = 'v6'
|
202
219
|
p1['k4'] = 'v7'
|
203
220
|
p1['k5'] = 'v8'
|
204
|
-
p1.
|
221
|
+
p1.init! s3
|
205
222
|
p1.dst_routed! s4
|
206
223
|
p1.set_link_fields 'k5,k4,k3'
|
207
224
|
p1.add_dsts 'room0/room1/door?action,output?action'
|
data/spec/room_spec.rb
CHANGED
@@ -58,24 +58,34 @@ describe Iotas::Room do
|
|
58
58
|
r4.search_down('dom0/r0/r1/r2').should be nil
|
59
59
|
end
|
60
60
|
#
|
61
|
-
it "routing success (direct)" do
|
61
|
+
it "routing success (direct add_dst)" do
|
62
62
|
room0 = Iotas::Room.new 'room0', @spin
|
63
63
|
door0 = Iotas::Door.new 'door0', room0
|
64
64
|
p = @spin.require_p Iotas::Particle
|
65
|
-
p.
|
66
|
-
p.
|
65
|
+
p.init! Fake.new( 'fake', @spin)
|
66
|
+
p.add_dst 'get', 'door0'
|
67
67
|
room0.send_p p
|
68
68
|
p.action.should eql 'get'
|
69
69
|
p.dst.should be door0
|
70
70
|
end
|
71
71
|
#
|
72
|
+
it "routing success (direct send)" do
|
73
|
+
room0 = Iotas::Room.new 'room0', @spin
|
74
|
+
door0 = Iotas::Door.new 'door0', room0
|
75
|
+
p = @spin.require_p Iotas::Particle
|
76
|
+
p.init! Fake.new( 'fake', @spin)
|
77
|
+
door0.send_p p, 'get'
|
78
|
+
p.action.should eql 'get'
|
79
|
+
p.dst.should be door0
|
80
|
+
end
|
81
|
+
#
|
72
82
|
it "routing success through Spin@world" do
|
73
83
|
room0 = Iotas::Room.new 'room0', @spin
|
74
84
|
room1 = Iotas::Room.new 'room1', room0
|
75
85
|
door0 = Iotas::Door.new 'door0', room1
|
76
86
|
p = @spin.require_p Iotas::Particle
|
77
|
-
p.
|
78
|
-
p.
|
87
|
+
p.init! Fake.new('fake', @spin)
|
88
|
+
p.add_dst 'get', 'dom0/room0/room1/door0'
|
79
89
|
room0.send_p p
|
80
90
|
p.action.should eql 'get'
|
81
91
|
p.dst.should be door0
|
@@ -84,7 +94,7 @@ describe Iotas::Room do
|
|
84
94
|
it "route error: no source" do
|
85
95
|
room = Iotas::Room.new 'room', @spin
|
86
96
|
p = @spin.require_p Iotas::Particle
|
87
|
-
p.
|
97
|
+
p.add_dst 'get', 'room/door'
|
88
98
|
room.send_p p
|
89
99
|
p.action.should eql Iotas::ACT_ERROR
|
90
100
|
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_NS
|
@@ -94,7 +104,7 @@ describe Iotas::Room do
|
|
94
104
|
it "route error: no destination no links" do
|
95
105
|
room = Iotas::Room.new 'room', @spin
|
96
106
|
p = @spin.require_p Iotas::Particle
|
97
|
-
p.
|
107
|
+
p.init! Fake.new('fake', @spin)
|
98
108
|
room.send_p p
|
99
109
|
p.action.should eql Iotas::ACT_ERROR
|
100
110
|
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_NDNL
|
@@ -104,8 +114,8 @@ describe Iotas::Room do
|
|
104
114
|
it "route error: no rooom, wrong door -> right room wrong door" do
|
105
115
|
room0 = Iotas::Room.new 'room0', @spin
|
106
116
|
p = @spin.require_p Iotas::Particle
|
107
|
-
p.
|
108
|
-
p.
|
117
|
+
p.init! Fake.new('fake', @spin)
|
118
|
+
p.add_dst 'get', 'nodoor'
|
109
119
|
room0.send_p p
|
110
120
|
p.action.should eql Iotas::ACT_ERROR
|
111
121
|
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_RRWD
|
@@ -115,8 +125,8 @@ describe Iotas::Room do
|
|
115
125
|
it "route error: right rooom, wrong door -> right room wrong door" do
|
116
126
|
room0 = Iotas::Room.new 'room0', @spin
|
117
127
|
p = @spin.require_p Iotas::Particle
|
118
|
-
p.
|
119
|
-
p.
|
128
|
+
p.init! Fake.new('fake', @spin)
|
129
|
+
p.add_dst 'get', 'dom0/room0/nodoor'
|
120
130
|
room0.send_p p
|
121
131
|
p.action.should eql Iotas::ACT_ERROR
|
122
132
|
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_RRWD
|
@@ -127,8 +137,8 @@ describe Iotas::Room do
|
|
127
137
|
room0 = Iotas::Room.new 'room0', @spin
|
128
138
|
room1 = Iotas::Room.new 'room1', room0
|
129
139
|
p = @spin.require_p Iotas::Particle
|
130
|
-
p.
|
131
|
-
p.
|
140
|
+
p.init! Fake.new('fake', room0)
|
141
|
+
p.add_dst 'get', 'dom0/room0/nodoor'
|
132
142
|
room1.send_p p
|
133
143
|
p.action.should eql Iotas::ACT_ERROR
|
134
144
|
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_DNE
|
@@ -139,8 +149,8 @@ describe Iotas::Room do
|
|
139
149
|
room0 = Iotas::Room.new 'room0', @spin
|
140
150
|
room1 = Iotas::Room.new 'room1', room0
|
141
151
|
p = @spin.require_p Iotas::Particle
|
142
|
-
p.
|
143
|
-
p.
|
152
|
+
p.init! Fake.new('fake', @spin)
|
153
|
+
p.add_dst 'get', 'dom0/noroom/fake'
|
144
154
|
room1.send_p p
|
145
155
|
p.action.should eql Iotas::ACT_ERROR
|
146
156
|
p[Iotas::FIELD_ERROR_MSG].should eql Iotas::ERROR_ROUTE_DNE
|
@@ -151,8 +161,8 @@ describe Iotas::Room do
|
|
151
161
|
room0 = Iotas::Room.new 'room0', @spin
|
152
162
|
door0 = Iotas::Door.new 'door0', room0
|
153
163
|
p = @spin.require_p Iotas::Particle
|
154
|
-
p.
|
155
|
-
p.
|
164
|
+
p.init! door0
|
165
|
+
p.add_dst 'get'
|
156
166
|
room0.send_p p
|
157
167
|
p.action.should eql 'get'
|
158
168
|
p.dst.should be door0
|
@@ -205,11 +215,11 @@ describe Iotas::Room do
|
|
205
215
|
p0 = door1.ps[0]
|
206
216
|
p0.action.should be_nil
|
207
217
|
p0.src.should be door0
|
208
|
-
p0.dst.should
|
218
|
+
p0.dst.should be_nil
|
209
219
|
p1 = door1.ps[1]
|
210
220
|
p1.action.should be_nil
|
211
221
|
p1.src.should be door0
|
212
|
-
p1.dst.should
|
222
|
+
p1.dst.should be_nil
|
213
223
|
p1.should be p
|
214
224
|
end
|
215
225
|
#
|
@@ -224,22 +234,31 @@ describe Iotas::Room do
|
|
224
234
|
it "system routing success: action only" do
|
225
235
|
room0 = Iotas::Room.new 'room0', @spin
|
226
236
|
p = @spin.require_p Iotas::Particle
|
227
|
-
p.
|
237
|
+
p.add_dst Iotas::SYS_ACT_ADD_LINK
|
228
238
|
room0.send_sys_p p
|
229
239
|
p.action.should eql Iotas::SYS_ACT_ADD_LINK
|
230
240
|
p.dst.should be room0.spin
|
231
241
|
end
|
232
242
|
#
|
233
|
-
it "system routing success" do
|
243
|
+
it "system routing success (add_dst)" do
|
234
244
|
room0 = Iotas::Room.new 'room0', @spin
|
235
245
|
door0 = Iotas::Door.new 'door0', room0
|
236
246
|
p = @spin.require_p Iotas::Particle
|
237
|
-
p.
|
247
|
+
p.add_dst Iotas::SYS_ACT_ADD_LINK, 'dom0/room0/door0'
|
238
248
|
room0.send_sys_p p
|
239
249
|
p.action.should eql Iotas::SYS_ACT_ADD_LINK
|
240
250
|
p.dst.should be door0
|
241
251
|
end
|
242
252
|
#
|
253
|
+
it "system routing success (send_sys_p)" do
|
254
|
+
room0 = Iotas::Room.new 'room0', @spin
|
255
|
+
door0 = Iotas::Door.new 'door0', room0
|
256
|
+
p = @spin.require_p Iotas::Particle
|
257
|
+
door0.send_sys_p p, Iotas::SYS_ACT_ADD_LINK
|
258
|
+
p.action.should eql Iotas::SYS_ACT_ADD_LINK
|
259
|
+
p.dst.should be door0
|
260
|
+
end
|
261
|
+
#
|
243
262
|
it "SYS_ACT_ADD_LINK" do
|
244
263
|
room0 = Iotas::Room.new 'room0', @spin
|
245
264
|
door0 = Iotas::Door.new 'door0', room0
|
@@ -250,7 +269,7 @@ describe Iotas::Room do
|
|
250
269
|
p0.set_data Iotas::LNK_FIELDS, 'fields'
|
251
270
|
p0.set_data Iotas::LNK_CONDF, 'f0,f1'
|
252
271
|
p0.set_data Iotas::LNK_CONDV, 'v0v1'
|
253
|
-
p0.
|
272
|
+
p0.add_dst Iotas::SYS_ACT_ADD_LINK, room0.path
|
254
273
|
room0.send_sys_p p0
|
255
274
|
@spin.spin!
|
256
275
|
p = @spin.require_p Iotas::Particle
|
data/spec/spin_spec.rb
CHANGED
@@ -76,7 +76,7 @@ describe Iotas::Spin do
|
|
76
76
|
it "process_sys" do
|
77
77
|
spin = Iotas::Spin.new 'dom0'
|
78
78
|
p0 = spin.require_p Iotas::Particle
|
79
|
-
p0.
|
79
|
+
p0.add_dst 'unknown'
|
80
80
|
spin.send_sys_p p0
|
81
81
|
spin.spin!
|
82
82
|
p1 = spin.require_p Iotas::Particle
|
@@ -116,7 +116,7 @@ describe Iotas::Spin do
|
|
116
116
|
it "hibernate! resume!" do
|
117
117
|
spin = Iotas::Spin.new 'dom0'
|
118
118
|
p0 = spin.require_p Iotas::Particle
|
119
|
-
p0.
|
119
|
+
p0.add_dst Iotas::SYS_ACT_HIBERNATE
|
120
120
|
spin.send_sys_p p0
|
121
121
|
spin.spin!
|
122
122
|
dom0 = Iotas::Spin.resume! spin.hibernate_path
|
@@ -23,8 +23,8 @@ class InputDoor < Iotas::Door
|
|
23
23
|
puts " -> start #{self.class.name} (#{@path})"
|
24
24
|
# stimulate myself
|
25
25
|
p = require_p Iotas::Particle
|
26
|
-
p.
|
27
|
-
send_p p
|
26
|
+
# p.add_dst Iotas::ACT_GET, path
|
27
|
+
send_p p, Iotas::ACT_GET
|
28
28
|
end
|
29
29
|
#
|
30
30
|
def stop!
|
@@ -51,12 +51,12 @@ class InputDoor < Iotas::Door
|
|
51
51
|
p.set_data 'f0', 'v0'
|
52
52
|
p.set_data 'f1', 'v1'
|
53
53
|
p.set_data 'f2', 'v2'
|
54
|
-
send_p p
|
54
|
+
send_p p # will follow the link
|
55
55
|
@idx+=1
|
56
56
|
if @idx<@lines.length
|
57
57
|
# there is more to read, restimulate myself
|
58
58
|
p = require_p Iotas::Particle
|
59
|
-
p.
|
59
|
+
p.add_dst Iotas::ACT_GET, name
|
60
60
|
send_p p
|
61
61
|
end
|
62
62
|
else
|
@@ -68,7 +68,7 @@ class InputDoor < Iotas::Door
|
|
68
68
|
if self.class.count==3
|
69
69
|
p = require_p Iotas::Particle
|
70
70
|
p[Iotas::FIELD_HIBERNATE_PATH] = HBN_PATH
|
71
|
-
p.
|
71
|
+
p.add_dst Iotas::SYS_ACT_HIBERNATE
|
72
72
|
send_sys_p p
|
73
73
|
end
|
74
74
|
end
|
@@ -156,7 +156,7 @@ p0.set_data Iotas::LNK_DSTS, 'concat1?follow,output1'
|
|
156
156
|
p0.set_data Iotas::LNK_FIELDS, 'f0,f2'
|
157
157
|
p0.set_data Iotas::LNK_CONDF, 'f0,f1,f2'
|
158
158
|
p0.set_data Iotas::LNK_CONDV, 'v0v1v2'
|
159
|
-
p0.
|
159
|
+
p0.add_dst Iotas::SYS_ACT_ADD_LINK, room1.path
|
160
160
|
room1.send_sys_p p0 # send_sys_p -> room0 -> spin -> room1 -> input1
|
161
161
|
#
|
162
162
|
spin.spin!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iotas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -95,7 +95,7 @@ files:
|
|
95
95
|
- spec/spec_helper.rb
|
96
96
|
- spec/spin_spec.rb
|
97
97
|
- spec/spot_spec.rb
|
98
|
-
- test/
|
98
|
+
- test/test_iotas.rb
|
99
99
|
homepage: http://github.com/jeremyz/iotas
|
100
100
|
licenses: []
|
101
101
|
post_install_message:
|
@@ -129,4 +129,4 @@ test_files:
|
|
129
129
|
- spec/spec_helper.rb
|
130
130
|
- spec/spin_spec.rb
|
131
131
|
- spec/spot_spec.rb
|
132
|
-
- test/
|
132
|
+
- test/test_iotas.rb
|