cpee 2.1.135 → 2.1.139
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/cockpit/compliance-view.html +11 -19
- data/cockpit/compliance.html +11 -19
- data/cockpit/css/llm.css +3 -3
- data/cockpit/css/llmmodel.css +140 -0
- data/cockpit/css/model.css +0 -1
- data/cockpit/css/ui.css +13 -7
- data/cockpit/css/wfadaptor.css +15 -10
- data/cockpit/edit.html +11 -19
- data/cockpit/graph.html +8 -13
- data/cockpit/index.html +11 -19
- data/cockpit/js/details.js +27 -10
- data/cockpit/js/instance.js +219 -206
- data/cockpit/js/llm-ui-bubble.js +36 -0
- data/cockpit/js/llm-ui-status.js +34 -0
- data/cockpit/js/llm-ui.js +87 -0
- data/cockpit/js/llm.js +469 -121
- data/cockpit/js/parameters.js +45 -14
- data/cockpit/js/wfadaptor.js +402 -77
- data/cockpit/llm.html +16 -21
- data/cockpit/llmmodel.html +17 -23
- data/cockpit/model.html +8 -15
- data/cockpit/only_llm.html +14 -19
- data/cockpit/themes/THEMES.MD +4 -0
- data/cockpit/themes/base.js +1 -1
- data/cockpit/themes/packed/theme.js +3 -0
- data/cockpit/themes/presetlr/rngs/alternative.rng +28 -0
- data/cockpit/themes/presetlr/rngs/call.rng +249 -0
- data/cockpit/themes/presetlr/rngs/callmanipulate.rng +281 -0
- data/cockpit/themes/presetlr/rngs/choose.rng +27 -0
- data/cockpit/themes/presetlr/rngs/closed_loop.rng +62 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_cancel.rng +5 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_control.rng +31 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_measuring.rng +12 -0
- data/cockpit/themes/presetlr/rngs/critical.rng +8 -0
- data/cockpit/themes/presetlr/rngs/escape.rng +5 -0
- data/cockpit/themes/presetlr/rngs/group.rng +3 -0
- data/cockpit/themes/presetlr/rngs/loop.rng +40 -0
- data/cockpit/themes/presetlr/rngs/manipulate.rng +76 -0
- data/cockpit/themes/presetlr/rngs/otherwise.rng +25 -0
- data/cockpit/themes/presetlr/rngs/parallel.rng +24 -0
- data/cockpit/themes/presetlr/rngs/parallel_branch.rng +5 -0
- data/cockpit/themes/presetlr/rngs/scripts.rng +23 -0
- data/cockpit/themes/presetlr/rngs/start.rng +143 -0
- data/cockpit/themes/presetlr/rngs/stop.rng +5 -0
- data/cockpit/themes/presetlr/rngs/terminate.rng +8 -0
- data/cockpit/themes/presetlr/rngs/wait_for_signal.rng +8 -0
- data/cockpit/themes/presetlr/symbols/alternative.svg +19 -0
- data/cockpit/themes/presetlr/symbols/arrow.svg +1 -0
- data/cockpit/themes/presetlr/symbols/call.svg +1 -0
- data/cockpit/themes/presetlr/symbols/call_sensor.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_sensor.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_sensor_signal.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_signal.svg +1 -0
- data/cockpit/themes/presetlr/symbols/choose.svg +15 -0
- data/cockpit/themes/presetlr/symbols/choose_exclusive.svg +15 -0
- data/cockpit/themes/presetlr/symbols/choose_exclusive_finish.svg +1 -0
- data/cockpit/themes/presetlr/symbols/choose_inclusive.svg +13 -0
- data/cockpit/themes/presetlr/symbols/choose_inclusive_finish.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_cancel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_control.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_measuring.svg +1 -0
- data/cockpit/themes/presetlr/symbols/complex.svg +1 -0
- data/cockpit/themes/presetlr/symbols/critical.svg +1 -0
- data/cockpit/themes/presetlr/symbols/delete.svg +1 -0
- data/cockpit/themes/presetlr/symbols/end.svg +1 -0
- data/cockpit/themes/presetlr/symbols/escape.svg +1 -0
- data/cockpit/themes/presetlr/symbols/event_end.svg +1 -0
- data/cockpit/themes/presetlr/symbols/event_start.svg +1 -0
- data/cockpit/themes/presetlr/symbols/loop.svg +15 -0
- data/cockpit/themes/presetlr/symbols/loop_end.svg +15 -0
- data/cockpit/themes/presetlr/symbols/loop_end_pre.svg +15 -0
- data/cockpit/themes/presetlr/symbols/manipulate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/mark.svg +1 -0
- data/cockpit/themes/presetlr/symbols/otherwise.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_event.svg +14 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_event_rev.svg +11 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_normal.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel_eventbased_exclusive.svg +1 -0
- data/cockpit/themes/presetlr/symbols/parallel_eventbased_parallel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/scripts.svg +1 -0
- data/cockpit/themes/presetlr/symbols/start.svg +1 -0
- data/cockpit/themes/presetlr/symbols/start_event.svg +1 -0
- data/cockpit/themes/presetlr/symbols/stop.svg +1 -0
- data/cockpit/themes/presetlr/symbols/terminate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/wait_for_signal.svg +1 -0
- data/cockpit/themes/presetlr/theme.js +54 -0
- data/cockpit/themes/wellformed/rngs/alternative.rng +28 -0
- data/cockpit/themes/wellformed/rngs/call.rng +249 -0
- data/cockpit/themes/wellformed/rngs/callmanipulate.rng +281 -0
- data/cockpit/themes/wellformed/rngs/choose.rng +27 -0
- data/cockpit/themes/wellformed/rngs/closed_loop.rng +62 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_cancel.rng +5 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_control.rng +31 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_measuring.rng +12 -0
- data/cockpit/themes/wellformed/rngs/critical.rng +8 -0
- data/cockpit/themes/wellformed/rngs/escape.rng +5 -0
- data/cockpit/themes/wellformed/rngs/group.rng +3 -0
- data/cockpit/themes/wellformed/rngs/loop.rng +40 -0
- data/cockpit/themes/wellformed/rngs/manipulate.rng +76 -0
- data/cockpit/themes/wellformed/rngs/otherwise.rng +25 -0
- data/cockpit/themes/wellformed/rngs/parallel.rng +24 -0
- data/cockpit/themes/wellformed/rngs/parallel_branch.rng +5 -0
- data/cockpit/themes/wellformed/rngs/scripts.rng +23 -0
- data/cockpit/themes/wellformed/rngs/start.rng +143 -0
- data/cockpit/themes/wellformed/rngs/stop.rng +5 -0
- data/cockpit/themes/wellformed/rngs/terminate.rng +8 -0
- data/cockpit/themes/wellformed/rngs/wait_for_signal.rng +8 -0
- data/cockpit/themes/wellformed/symbols/alternative.svg +1 -0
- data/cockpit/themes/wellformed/symbols/arrow.svg +1 -0
- data/cockpit/themes/wellformed/symbols/call.svg +1 -0
- data/cockpit/themes/wellformed/symbols/call_sensor.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_sensor.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_sensor_signal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_signal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_exclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_exclusive_finish.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_inclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_inclusive_finish.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_cancel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_control.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_measuring.svg +1 -0
- data/cockpit/themes/wellformed/symbols/complex.svg +1 -0
- data/cockpit/themes/wellformed/symbols/critical.svg +1 -0
- data/cockpit/themes/wellformed/symbols/delete.svg +1 -0
- data/cockpit/themes/wellformed/symbols/end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/escape.svg +1 -0
- data/cockpit/themes/wellformed/symbols/event_end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/event_start.svg +6 -0
- data/cockpit/themes/wellformed/symbols/loop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/loop_end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/manipulate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/mark.svg +1 -0
- data/cockpit/themes/wellformed/symbols/otherwise.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_event.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_event_rev.svg +11 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_normal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_eventbased_exclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_eventbased_parallel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/scripts.svg +1 -0
- data/cockpit/themes/wellformed/symbols/start.svg +1 -0
- data/cockpit/themes/wellformed/symbols/start_event.svg +1 -0
- data/cockpit/themes/wellformed/symbols/stop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/terminate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/wait_for_signal.svg +1 -0
- data/cockpit/themes/wellformed/theme.js +32 -0
- data/cockpit/track.html +8 -13
- data/cpee.gemspec +3 -3
- data/lib/callbacks/callbacks.rng +4 -4
- data/lib/callbacks.xml +4 -4
- data/lib/cpee/constants.rb +4 -4
- data/lib/cpee/fail.rb +4 -4
- data/lib/cpee/implementation.rb +10 -4
- data/lib/cpee/implementation_callbacks.rb +6 -6
- data/lib/cpee/implementation_notifications.rb +8 -5
- data/lib/cpee/implementation_properties.rb +132 -12
- data/lib/cpee/json_pointer.rb +110 -0
- data/lib/cpee/message.rb +26 -6
- data/lib/cpee/persistence.rb +10 -4
- data/lib/cpee/redis.rb +12 -4
- data/lib/cpee/statemachine.rb +4 -4
- data/lib/cpee/value_helper.rb +4 -4
- data/lib/cpee.xml +4 -4
- data/lib/engine/executionhandler-list.rng +4 -4
- data/lib/engine/instance-info.rng +4 -4
- data/lib/engine/instances.rng +4 -4
- data/lib/engine.xml +4 -4
- data/lib/properties/t_dslx.rng +356 -0
- data/lib/properties/transformation.rng +14 -0
- data/lib/properties.xml +5 -4
- data/server/executionhandlers/eval/backend/opts.yaml +1 -1
- data/server/executionhandlers/eval/connection.rb +16 -7
- data/server/executionhandlers/eval/execution.rb +4 -4
- data/server/executionhandlers/ruby/backend/opts.yaml +1 -1
- data/server/executionhandlers/ruby/connection.rb +17 -9
- data/server/executionhandlers/ruby/controller.rb +21 -6
- data/server/executionhandlers/ruby/dsl_to_dslx.xsl +6 -2
- data/server/executionhandlers/ruby/execution.rb +4 -4
- data/server/resources/properties.empty +5 -4
- data/server/resources/properties.init +5 -4
- data/server/resources/topics.xml +4 -4
- data/server/routing/end.pid +1 -1
- data/server/routing/end.rb +4 -4
- data/server/routing/forward-events-00.pid +1 -1
- data/server/routing/forward-events.rb +34 -23
- data/server/routing/forward-votes.pid +1 -1
- data/server/routing/forward-votes.rb +60 -47
- data/server/routing/persist.pid +1 -1
- data/server/routing/persist.rb +53 -30
- data/tools/server/cpee +1 -1
- data/tools/server/resources/properties.init +4 -4
- metadata +142 -5
- data/cockpit/CPEE.xml +0 -8
- data/cockpit/Signavio.xml +0 -8
- data/cockpit/transformations.xml +0 -4
- /data/{COPYING → LICENSE} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# This file is part of CPEE.
|
|
2
2
|
#
|
|
3
3
|
# CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
4
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
4
|
+
# of the GNU Lesser General Public License as published by the Free Software Foundation,
|
|
5
5
|
# either version 3 of the License, or (at your option) any later version.
|
|
6
6
|
#
|
|
7
7
|
# CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
8
8
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
9
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
10
|
#
|
|
11
|
-
# You should have received a copy of the GNU General Public License along with
|
|
12
|
-
# CPEE (file
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
14
14
|
|
|
15
15
|
require 'weel'
|
|
@@ -188,12 +188,15 @@ class Controller
|
|
|
188
188
|
@votes += votes
|
|
189
189
|
psredis = @opts[:redis_dyn].call "Instance #{@id} Vote"
|
|
190
190
|
collect = []
|
|
191
|
+
changes = []
|
|
191
192
|
psredis.subscribe(votes.map{|e| ['vote-response:00:' + e.to_s] }.flatten) do |on|
|
|
192
193
|
on.message do |what, message|
|
|
193
194
|
index = message.index(' ')
|
|
194
195
|
mess = message[index+1..-1]
|
|
195
196
|
m = JSON.parse(mess)
|
|
196
|
-
|
|
197
|
+
cont, chg = vote_parse(m['content'])
|
|
198
|
+
collect << cont
|
|
199
|
+
changes << chg if chg && chg.any?
|
|
197
200
|
@votes.delete m['name']
|
|
198
201
|
cancel_callback m['name']
|
|
199
202
|
if collect.length >= votes.length
|
|
@@ -201,12 +204,24 @@ class Controller
|
|
|
201
204
|
end
|
|
202
205
|
end
|
|
203
206
|
end
|
|
204
|
-
!collect.include?(false)
|
|
207
|
+
ret = !collect.include?(false)
|
|
208
|
+
changes.each { |chg| yield chg } if ret && block_given?
|
|
209
|
+
ret
|
|
205
210
|
else
|
|
206
211
|
true
|
|
207
212
|
end
|
|
208
213
|
end
|
|
209
214
|
|
|
215
|
+
# single value: true / 'true' continues; hash: { 'continue' => true, '/json/pointer' => value, ... }
|
|
216
|
+
def vote_parse(content)
|
|
217
|
+
val = content.is_a?(String) ? (JSON::parse(content) rescue content) : content
|
|
218
|
+
if val.is_a?(Hash)
|
|
219
|
+
[val['continue'] == true || val['continue'] == 'true', val.select { |k,_| k.to_s.start_with?('/') }]
|
|
220
|
+
else
|
|
221
|
+
[val == true || val == 'true', nil]
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
210
225
|
def callback(hw,key,content)
|
|
211
226
|
CPEE::Message::send(:callback,'activity/content',base,@id,uuid,info,content.merge(:key => key),@redis)
|
|
212
227
|
@callback_keys[key] = hw
|
|
@@ -306,7 +306,7 @@
|
|
|
306
306
|
</xsl:call-template>
|
|
307
307
|
<xsl:text>closed_loop</xsl:text>
|
|
308
308
|
<xsl:if test="@overrun">
|
|
309
|
-
<xsl:text> :overrun =>
|
|
309
|
+
<xsl:text> :overrun => :</xsl:text>
|
|
310
310
|
<xsl:value-of select="@overrun"/>
|
|
311
311
|
<xsl:if test="@execution">
|
|
312
312
|
<xsl:text>, :execution => :</xsl:text>
|
|
@@ -342,6 +342,10 @@
|
|
|
342
342
|
<xsl:text>, :ctime => </xsl:text>
|
|
343
343
|
<xsl:value-of select="@ctime"/>
|
|
344
344
|
</xsl:if>
|
|
345
|
+
<xsl:if test="@frequency">
|
|
346
|
+
<xsl:text>, :frequency => </xsl:text>
|
|
347
|
+
<xsl:value-of select="@frequency"/>
|
|
348
|
+
</xsl:if>
|
|
345
349
|
<xsl:text> do</xsl:text>
|
|
346
350
|
<xsl:call-template name="print-newline"/>
|
|
347
351
|
<xsl:apply-templates>
|
|
@@ -811,7 +815,7 @@
|
|
|
811
815
|
<xsl:choose>
|
|
812
816
|
<xsl:when test="substring(text(),1,1) = '!'">
|
|
813
817
|
<xsl:text>🠊("</xsl:text>
|
|
814
|
-
<xsl:value-of select="str:replace(str:replace(substring(text(),2),'\','\\'),'"','\"')"/>
|
|
818
|
+
<xsl:value-of select="str:replace(str:replace(str:replace(substring(text(),2),'\','\\'),'"','\"'),'#','\#')"/>
|
|
815
819
|
<xsl:text>")</xsl:text>
|
|
816
820
|
</xsl:when>
|
|
817
821
|
<xsl:otherwise>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# This file is part of CPEE.
|
|
2
2
|
#
|
|
3
3
|
# CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
4
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
4
|
+
# of the GNU Lesser General Public License as published by the Free Software Foundation,
|
|
5
5
|
# either version 3 of the License, or (at your option) any later version.
|
|
6
6
|
#
|
|
7
7
|
# CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
8
8
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
9
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
9
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
10
10
|
#
|
|
11
|
-
# You should have received a copy of the GNU General Public License along with
|
|
12
|
-
# CPEE (file
|
|
11
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
12
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
13
13
|
# <http://www.gnu.org/licenses/>.
|
|
14
14
|
|
|
15
15
|
require 'net/ssh'
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
This file is part of CPEE.
|
|
4
4
|
|
|
5
5
|
CPEE is free software: you can redistribute it and/or modify it under the
|
|
6
|
-
terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
terms of the GNU Lesser General Public License as published by the Free Software
|
|
7
7
|
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
8
|
version.
|
|
9
9
|
|
|
10
10
|
CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
11
11
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
12
|
-
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
12
|
+
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
13
13
|
|
|
14
|
-
You should have received a copy of the GNU General Public License along with
|
|
15
|
-
CPEE (file
|
|
14
|
+
You should have received a copy of the GNU Lesser General Public License along with
|
|
15
|
+
CPEE (file LICENSE in the main directory). If not, see
|
|
16
16
|
<http://www.gnu.org/licenses/>.
|
|
17
17
|
-->
|
|
18
18
|
|
|
@@ -35,5 +35,6 @@
|
|
|
35
35
|
<description type='copy'/>
|
|
36
36
|
<dataelements type='none'/>
|
|
37
37
|
<endpoints type='none'/>
|
|
38
|
+
<dslx type='copy'/>
|
|
38
39
|
</transformation>
|
|
39
40
|
</properties>
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
This file is part of CPEE.
|
|
4
4
|
|
|
5
5
|
CPEE is free software: you can redistribute it and/or modify it under the
|
|
6
|
-
terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
terms of the GNU Lesser General Public License as published by the Free Software
|
|
7
7
|
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
8
|
version.
|
|
9
9
|
|
|
10
10
|
CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
11
11
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
12
|
-
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
12
|
+
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
13
13
|
|
|
14
|
-
You should have received a copy of the GNU General Public License along with
|
|
15
|
-
CPEE (file
|
|
14
|
+
You should have received a copy of the GNU Lesser General Public License along with
|
|
15
|
+
CPEE (file LICENSE in the main directory). If not, see
|
|
16
16
|
<http://www.gnu.org/licenses/>.
|
|
17
17
|
-->
|
|
18
18
|
|
|
@@ -50,5 +50,6 @@
|
|
|
50
50
|
<description type='copy'/>
|
|
51
51
|
<dataelements type='none'/>
|
|
52
52
|
<endpoints type='none'/>
|
|
53
|
+
<dslx type='copy'/>
|
|
53
54
|
</transformation>
|
|
54
55
|
</properties>
|
data/server/resources/topics.xml
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
This file is part of CPEE.
|
|
3
3
|
|
|
4
4
|
CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
5
|
-
of the GNU General Public License as published by the Free Software Foundation,
|
|
5
|
+
of the GNU Lesser General Public License as published by the Free Software Foundation,
|
|
6
6
|
either version 3 of the License, or (at your option) any later version.
|
|
7
7
|
|
|
8
8
|
CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
9
9
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
10
|
-
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
10
|
+
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
11
11
|
|
|
12
|
-
You should have received a copy of the GNU General Public License along with
|
|
13
|
-
CPEE (file
|
|
12
|
+
You should have received a copy of the GNU Lesser General Public License along with
|
|
13
|
+
CPEE (file LICENSE in the main directory). If not, see
|
|
14
14
|
<http://www.gnu.org/licenses/>.
|
|
15
15
|
-->
|
|
16
16
|
|
data/server/routing/end.pid
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3635871
|
data/server/routing/end.rb
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
# This file is part of CPEE.
|
|
4
4
|
#
|
|
5
5
|
# CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
6
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
6
|
+
# of the GNU Lesser General Public License as published by the Free Software Foundation,
|
|
7
7
|
# either version 3 of the License, or (at your option) any later version.
|
|
8
8
|
#
|
|
9
9
|
# CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
10
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
11
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
11
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
12
12
|
#
|
|
13
|
-
# You should have received a copy of the GNU General Public License along with
|
|
14
|
-
# CPEE (file
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
14
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
15
15
|
# <http://www.gnu.org/licenses/>.
|
|
16
16
|
|
|
17
17
|
require 'json'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3635891
|
|
@@ -3,25 +3,41 @@
|
|
|
3
3
|
# This file is part of CPEE.
|
|
4
4
|
#
|
|
5
5
|
# CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
6
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
6
|
+
# of the GNU Lesser General Public License as published by the Free Software Foundation,
|
|
7
7
|
# either version 3 of the License, or (at your option) any later version.
|
|
8
8
|
#
|
|
9
9
|
# CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
10
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
11
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
11
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
12
12
|
#
|
|
13
|
-
# You should have received a copy of the GNU General Public License along with
|
|
14
|
-
# CPEE (file
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
14
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
15
15
|
# <http://www.gnu.org/licenses/>.
|
|
16
16
|
|
|
17
17
|
require 'redis'
|
|
18
18
|
require 'daemonite'
|
|
19
19
|
require 'concurrent-ruby'
|
|
20
20
|
require 'riddl/client'
|
|
21
|
+
require 'digest/sha1'
|
|
21
22
|
require_relative '../../lib/cpee/redis'
|
|
22
23
|
|
|
23
24
|
HTTP_POOL = Concurrent::FixedThreadPool.new(32)
|
|
24
25
|
|
|
26
|
+
# one round trip per event: KEYS[1] is the reverse index (subscription keys for exactly
|
|
27
|
+
# this topic/type/name), ARGV[1] the instance prefix. Returns key, url, sseq per match.
|
|
28
|
+
# GET needs the or '', a nil (false) would truncate the returned array.
|
|
29
|
+
MATCH = <<~LUA.freeze
|
|
30
|
+
local res = {}
|
|
31
|
+
for _, k in ipairs(redis.call('SMEMBERS', KEYS[1])) do
|
|
32
|
+
local b = ARGV[1] .. '/handlers/' .. k
|
|
33
|
+
res[#res+1] = k
|
|
34
|
+
res[#res+1] = redis.call('GET', b .. '/url') or ''
|
|
35
|
+
res[#res+1] = redis.call('INCR', b .. '/seq')
|
|
36
|
+
end
|
|
37
|
+
return res
|
|
38
|
+
LUA
|
|
39
|
+
MATCH_SHA = Digest::SHA1.hexdigest(MATCH).freeze
|
|
40
|
+
|
|
25
41
|
Daemonite.new do |opts|
|
|
26
42
|
opts[:runtime_opts] += [
|
|
27
43
|
["--url=URL", "-uURL", "Specify redis url", ->(p){ opts[:redis_url] = p }],
|
|
@@ -46,26 +62,27 @@ Daemonite.new do |opts|
|
|
|
46
62
|
on.pmessage do |pat, what, message|
|
|
47
63
|
index = message.index(' ')
|
|
48
64
|
mess = message[index+1..-1]
|
|
49
|
-
instance, uuid = message[0...index].split(',')
|
|
65
|
+
instance, uuid, seq = message[0...index].split(',')
|
|
50
66
|
type, worker, event = what.split(':',3)
|
|
51
67
|
topic = ::File::dirname(event)
|
|
52
68
|
name = ::File::basename(event)
|
|
53
69
|
long = File.join(topic,type,name)
|
|
54
70
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
matched.zip(urls).each do |key, url|
|
|
71
|
+
# per subscription sequence (sseq): gapless per subscription, so subscribers can detect missing messages; seq gives the order
|
|
72
|
+
res = CPEE::redis_script(opts[:redis], MATCH_SHA, MATCH, ["instance:#{instance}/handlers/#{long}"], ["instance:#{instance}"])
|
|
73
|
+
forwards = []
|
|
74
|
+
res.each_slice(3) do |key, url, sseq|
|
|
60
75
|
if url.nil? || url == ""
|
|
61
|
-
|
|
76
|
+
forwards << ["forward:#{instance}/#{key}","#{seq},#{sseq} #{mess}"]
|
|
62
77
|
else
|
|
63
78
|
# Ractor.new(url,type,topic,name,mess) do |url,type,topic,name,mess|
|
|
64
79
|
# sadly typhoes does not support ractors
|
|
65
80
|
HTTP_POOL.post do
|
|
66
|
-
Riddl::Client.new(url).post [
|
|
81
|
+
Riddl::Client.new(url, nil, ignore_response: true).post [
|
|
67
82
|
Riddl::Header.new("CPEE-INSTANCE",instance),
|
|
68
83
|
Riddl::Header.new("CPEE-INSTANCE-UUID",uuid),
|
|
84
|
+
Riddl::Header.new("CPEE-SEQ",seq),
|
|
85
|
+
Riddl::Header.new("CPEE-SSEQ",sseq),
|
|
69
86
|
Riddl::Parameter::Simple::new('type',type),
|
|
70
87
|
Riddl::Parameter::Simple::new('topic',topic),
|
|
71
88
|
Riddl::Parameter::Simple::new('event',name),
|
|
@@ -74,17 +91,11 @@ Daemonite.new do |opts|
|
|
|
74
91
|
end
|
|
75
92
|
end
|
|
76
93
|
end
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
opts[:redis].del(*empt) unless empt.empty?
|
|
83
|
-
end
|
|
84
|
-
rescue => e
|
|
85
|
-
puts e.message
|
|
86
|
-
puts e.backtrace
|
|
87
|
-
p '-----------------'
|
|
94
|
+
# all sse subscribers in one round trip
|
|
95
|
+
opts[:redis].pipelined { |p| forwards.each { |c,m| p.publish(c,m) } } unless forwards.empty?
|
|
96
|
+
rescue
|
|
97
|
+
# deliberately silent: an exception must not end the psubscribe loop (and the
|
|
98
|
+
# worker), and subscribers detect missing messages through gaps in sseq
|
|
88
99
|
end
|
|
89
100
|
end
|
|
90
101
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3635884
|
|
@@ -3,32 +3,44 @@
|
|
|
3
3
|
# This file is part of CPEE.
|
|
4
4
|
#
|
|
5
5
|
# CPEE is free software: you can redistribute it and/or modify it under the terms
|
|
6
|
-
# of the GNU General Public License as published by the Free Software Foundation,
|
|
6
|
+
# of the GNU Lesser General Public License as published by the Free Software Foundation,
|
|
7
7
|
# either version 3 of the License, or (at your option) any later version.
|
|
8
8
|
#
|
|
9
9
|
# CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
10
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
11
|
-
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
11
|
+
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
12
12
|
#
|
|
13
|
-
# You should have received a copy of the GNU General Public License along with
|
|
14
|
-
# CPEE (file
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License along with
|
|
14
|
+
# CPEE (file LICENSE in the main directory). If not, see
|
|
15
15
|
# <http://www.gnu.org/licenses/>.
|
|
16
16
|
|
|
17
17
|
require 'redis'
|
|
18
18
|
require 'daemonite'
|
|
19
19
|
require 'riddl/client'
|
|
20
20
|
require 'json'
|
|
21
|
+
require 'digest/sha1'
|
|
21
22
|
require_relative '../../lib/cpee/message'
|
|
22
23
|
require_relative '../../lib/cpee/redis'
|
|
23
24
|
|
|
25
|
+
# one round trip per vote: the controller sends one vote message per subscriber
|
|
26
|
+
# (content.subscription), so only check if that subscriber is still subscribed to
|
|
27
|
+
# exactly this topic/type/name (KEYS[1] is the reverse index). Returns url, sseq
|
|
28
|
+
# or {} if gone. GET needs the or '', a nil (false) would truncate the array.
|
|
29
|
+
MATCH = <<~LUA.freeze
|
|
30
|
+
if redis.call('SISMEMBER', KEYS[1], ARGV[2]) == 0 then return {} end
|
|
31
|
+
local b = ARGV[1] .. '/handlers/' .. ARGV[2]
|
|
32
|
+
return { redis.call('GET', b .. '/url') or '', redis.call('INCR', b .. '/seq') }
|
|
33
|
+
LUA
|
|
34
|
+
MATCH_SHA = Digest::SHA1.hexdigest(MATCH).freeze
|
|
35
|
+
|
|
24
36
|
def persist_handler(instance,key,mess,redis) #{{{
|
|
25
37
|
redis.multi do |multi|
|
|
26
38
|
multi.sadd("instance:#{instance}/callbacks",key)
|
|
27
|
-
multi.set("instance:#{instance}/callbacks/#{key}/subscription",mess.dig('content','subscription'))
|
|
28
|
-
multi.set("instance:#{instance}/callbacks/#{key}/uuid",mess.dig('content','activity-uuid'))
|
|
29
|
-
multi.set("instance:#{instance}/callbacks/#{key}/label",mess.dig('content','label'))
|
|
30
|
-
multi.set("instance:#{instance}/callbacks/#{key}/position",mess.dig('content','activity'))
|
|
31
|
-
multi.set("instance:#{instance}/callbacks/#{key}/type",'vote')
|
|
39
|
+
multi.set("instance:#{instance}/callbacks/#{key}/subscription",mess.dig('content','subscription'),keepttl: true)
|
|
40
|
+
multi.set("instance:#{instance}/callbacks/#{key}/uuid",mess.dig('content','activity-uuid'),keepttl: true)
|
|
41
|
+
multi.set("instance:#{instance}/callbacks/#{key}/label",mess.dig('content','label'),keepttl: true)
|
|
42
|
+
multi.set("instance:#{instance}/callbacks/#{key}/position",mess.dig('content','activity'),keepttl: true)
|
|
43
|
+
multi.set("instance:#{instance}/callbacks/#{key}/type",'vote',keepttl: true)
|
|
32
44
|
end
|
|
33
45
|
end #}}}
|
|
34
46
|
|
|
@@ -64,7 +76,7 @@ Daemonite.new do |opts|
|
|
|
64
76
|
opts[:pubsubredis].psubscribe('vote:*') do |on|
|
|
65
77
|
on.pmessage do |pat, what, message|
|
|
66
78
|
index = message.index(' ')
|
|
67
|
-
instance, uuid = message[0...index].split(',')
|
|
79
|
+
instance, uuid, seq = message[0...index].split(',')
|
|
68
80
|
mess = message[index+1..-1]
|
|
69
81
|
|
|
70
82
|
type, worker, event = what.split(':',3)
|
|
@@ -72,46 +84,47 @@ Daemonite.new do |opts|
|
|
|
72
84
|
name = ::File::basename(event)
|
|
73
85
|
long = File.join(topic,type,name)
|
|
74
86
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
url = opts[:redis].get("instance:#{instance}/handlers/#{subscription_key}/url")
|
|
87
|
+
m = JSON.parse(mess)
|
|
88
|
+
callback_key = m.dig('content','key')
|
|
89
|
+
subscription_key = m.dig('content','subscription')
|
|
90
|
+
url, sseq = CPEE::redis_script(opts[:redis], MATCH_SHA, MATCH, ["instance:#{instance}/handlers/#{long}"], ["instance:#{instance}", subscription_key.to_s])
|
|
80
91
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
if url.nil? # unsubscribed in the meantime, nobody would ever answer, so let the instance continue
|
|
93
|
+
send_response instance, callback_key, m['cpee'], true, opts[:redis]
|
|
94
|
+
elsif url == ""
|
|
95
|
+
persist_handler instance, callback_key, m, opts[:redis]
|
|
96
|
+
opts[:redis].publish("forward:#{instance}/#{subscription_key}","#{seq},#{sseq} #{mess}")
|
|
97
|
+
else
|
|
98
|
+
client = Riddl::Client.new(url)
|
|
99
|
+
callback = File.join(m['instance-url'],'/callbacks/',callback_key,'/')
|
|
100
|
+
status, result, headers = (client.post [
|
|
101
|
+
Riddl::Header.new("CPEE-BASE",File.join(m['cpee'],'/')),
|
|
102
|
+
Riddl::Header.new("CPEE-INSTANCE",m['instance']),
|
|
103
|
+
Riddl::Header.new("CPEE-INSTANCE-URL",File.join(m['instance-url'],'/')),
|
|
104
|
+
Riddl::Header.new("CPEE-INSTANCE-UUID",m['instance-uuid']),
|
|
105
|
+
Riddl::Header.new("CPEE-CALLBACK",callback),
|
|
106
|
+
Riddl::Header.new("CPEE-CALLBACK-ID",callback_key),
|
|
107
|
+
Riddl::Header.new("CPEE-SEQ",seq),
|
|
108
|
+
Riddl::Header.new("CPEE-SSEQ",sseq),
|
|
109
|
+
Riddl::Parameter::Simple::new('type',type),
|
|
110
|
+
Riddl::Parameter::Simple::new('topic',topic),
|
|
111
|
+
Riddl::Parameter::Simple::new('vote',name),
|
|
112
|
+
Riddl::Parameter::Simple::new('callback',callback),
|
|
113
|
+
Riddl::Parameter::Complex::new('notification','application/json',mess)
|
|
114
|
+
] rescue [ 0, [], []])
|
|
115
|
+
if status >= 200 && status < 300
|
|
116
|
+
val = if result[0].class == Riddl::Parameter::Simple
|
|
117
|
+
result[0].value
|
|
84
118
|
else
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Riddl::Header.new("CPEE-INSTANCE-UUID",m['instance-uuid']),
|
|
92
|
-
Riddl::Header.new("CPEE-CALLBACK",callback),
|
|
93
|
-
Riddl::Header.new("CPEE-CALLBACK-ID",subscription_key),
|
|
94
|
-
Riddl::Parameter::Simple::new('type',type),
|
|
95
|
-
Riddl::Parameter::Simple::new('topic',topic),
|
|
96
|
-
Riddl::Parameter::Simple::new('vote',name),
|
|
97
|
-
Riddl::Parameter::Simple::new('callback',callback),
|
|
98
|
-
Riddl::Parameter::Complex::new('notification','application/json',mess)
|
|
99
|
-
] rescue [ 0, [], []])
|
|
100
|
-
if status >= 200 && status < 300
|
|
101
|
-
val = if result[0].class == Riddl::Parameter::Simple
|
|
102
|
-
result[0].value
|
|
103
|
-
else
|
|
104
|
-
result[0].value.read
|
|
105
|
-
end
|
|
106
|
-
if (headers["CPEE_CALLBACK"] && headers["CPEE_CALLBACK"] == 'true') || val == 'callback'
|
|
107
|
-
persist_handler instance, callback_key, m, opts[:redis]
|
|
108
|
-
else # they may send true or false
|
|
109
|
-
send_response instance, callback_key, m['cpee'], val, opts[:redis]
|
|
110
|
-
end
|
|
111
|
-
else
|
|
112
|
-
send_response instance, callback_key, m['cpee'], true, opts[:redis]
|
|
113
|
-
end
|
|
119
|
+
result[0].value.read
|
|
120
|
+
end
|
|
121
|
+
if (headers["CPEE_CALLBACK"] && headers["CPEE_CALLBACK"] == 'true') || val == 'callback'
|
|
122
|
+
persist_handler instance, callback_key, m, opts[:redis]
|
|
123
|
+
else # they may send true or false
|
|
124
|
+
send_response instance, callback_key, m['cpee'], val, opts[:redis]
|
|
114
125
|
end
|
|
126
|
+
else
|
|
127
|
+
send_response instance, callback_key, m['cpee'], true, opts[:redis]
|
|
115
128
|
end
|
|
116
129
|
end
|
|
117
130
|
rescue => e
|
data/server/routing/persist.pid
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3635877
|