weel 1.99.121 → 1.99.123

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/weel.rb +117 -194
  3. data/weel.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3dc94f3d9dc7b182dc017f529211878cdbffa2504d1f863220d0820b786e28b
4
- data.tar.gz: 816645f85946983a86ba373e4e5e660b2688fc32c57e0f72e44a4d71a774b9b0
3
+ metadata.gz: f3b3b0d940b57bff46c012f46466be8cbd1188de768e10cc8815f597d0ec2045
4
+ data.tar.gz: 7cceda505453b4610f79c01d3b38a55d99cf861119d00059b744f2e53ce6be6b
5
5
  SHA512:
6
- metadata.gz: a22047ce8e533de6326a7cccbdb25a7dfabc5b137880b111ff2032cdb1d32bd45f0f3fccb421e72f4d823a8d84a6fd3ec67d81ee3e1bef0b61c755621e28bee2
7
- data.tar.gz: 5ebc7c1d4a819a23ee2399be8818f80b7de71fb6753351750d3dbabe2ad122f6be6fe783f30d3d5acd00e1ff927c57f90b0c5052b8195d889420b217625cf37d
6
+ metadata.gz: d9691c2f36e38b8552f6c22cd774c7d7920adb9511f5fd9e9838ba9b5f03f00624dfc461d97a2551a76ea3f5c4732e7d70ae6c7ef84a8b9c0ce95992c617f153
7
+ data.tar.gz: 0565f1fd91b28309fe38343332a423aff7d6f123387f671616fc320cb6dae9edd91051a43bbaf0241e791ef3efd6ae2377c254d2fa1ff40069327bd3f517ec4c
data/lib/weel.rb CHANGED
@@ -38,6 +38,7 @@ class WEEL
38
38
  class Proceed < Exception; end
39
39
  class NoLongerNecessary < Exception; end
40
40
  class Again < Exception; end
41
+ class UpdateAgain < Exception; end
41
42
  class Error < Exception; end
42
43
  class Salvage < Exception; end
43
44
  end # }}}
@@ -104,8 +105,9 @@ class WEEL
104
105
  ReadHash.new(@__weel_endpoints)
105
106
  end
106
107
  def local
107
- @__weel_local.first
108
+ @__weel_local&.first
108
109
  end
110
+ attr_reader :additional
109
111
  end # }}}
110
112
  class ManipulateStructure # {{{
111
113
  def initialize(data,endpoints,status,local,additional)
@@ -194,11 +196,12 @@ class WEEL
194
196
  ManipulateHash.new(@__weel_endpoints,@touched_endpoints,@changed_endpoints)
195
197
  end
196
198
  def local
197
- @__weel_local.first
199
+ @__weel_local&.first
198
200
  end
199
201
  def status
200
202
  @__weel_status
201
203
  end
204
+ attr_reader :additional
202
205
  end # }}}
203
206
  class ManipulateHash # {{{
204
207
  attr_reader :__weel_touched, :__weel_changed
@@ -269,9 +272,8 @@ class WEEL
269
272
  end #}}}
270
273
 
271
274
  class ReadHash # {{{
272
- def initialize(values,sim=false)
275
+ def initialize(values)
273
276
  @__weel_values = values
274
- @__weel_sim = sim
275
277
  end
276
278
 
277
279
  def to_json(*args)
@@ -279,29 +281,25 @@ class WEEL
279
281
  end
280
282
 
281
283
  def method_missing(name,*args)
282
- if @__weel_sim
283
- "➤#{name}"
284
+ if args.empty? && @__weel_values.key?(name)
285
+ @__weel_values[name]
286
+ elsif args.empty? && @__weel_values.key?(name.to_s)
287
+ @__weel_values[name.to_s]
288
+ elsif name.to_s[-1..-1] == "=" && args.length == 1
289
+ temp = name.to_s[0..-2]
290
+ @__weel_values[temp.to_sym] = args[0]
291
+ elsif name.to_s == "[]=" && args.length == 2
292
+ @__weel_values[args[0]] = args[1]
293
+ elsif name.to_s == "[]" && args.length == 1
294
+ @__weel_values[args[0]]
284
295
  else
285
- if args.empty? && @__weel_values.key?(name)
286
- @__weel_values[name]
287
- elsif args.empty? && @__weel_values.key?(name.to_s)
288
- @__weel_values[name.to_s]
289
- elsif name.to_s[-1..-1] == "=" && args.length == 1
290
- temp = name.to_s[0..-2]
291
- @__weel_values[temp.to_sym] = args[0]
292
- elsif name.to_s == "[]=" && args.length == 2
293
- @__weel_values[args[0]] = args[1]
294
- elsif name.to_s == "[]" && args.length == 1
295
- @__weel_values[args[0]]
296
- else
297
- nil
298
- end
296
+ nil
299
297
  end
300
298
  end
301
299
  end # }}}
302
300
 
303
301
  class ReadOnlyHash # {{{
304
- def initialize(values,sim=false)
302
+ def initialize(values)
305
303
  @__weel_values = values.transform_values do |v|
306
304
  if Object.const_defined?(:XML) && XML.const_defined?(:Smart) && v.is_a?(XML::Smart::Dom)
307
305
  v.root.to_doc
@@ -313,7 +311,6 @@ class WEEL
313
311
  end
314
312
  end
315
313
  end
316
- @__weel_sim = sim
317
314
  end
318
315
 
319
316
  def to_json(*args)
@@ -321,27 +318,30 @@ class WEEL
321
318
  end
322
319
 
323
320
  def method_missing(name,*args)
324
- if @__weel_sim
325
- "➤#{name}"
321
+ if args.empty? && @__weel_values.key?(name)
322
+ @__weel_values[name]
323
+ elsif args.empty? && @__weel_values.key?(name.to_s)
324
+ @__weel_values[name.to_s]
325
+ elsif name.to_s[-1..-1] == "=" && args.length == 1
326
+ temp = name.to_s[0..-2]
327
+ @__weel_values[temp.to_sym] = args[0]
328
+ elsif name.to_s == "[]=" && args.length == 2
329
+ @__weel_values[args[0]] = args[1]
330
+ elsif name.to_s == "[]" && args.length == 1
331
+ @__weel_values[args[0]]
326
332
  else
327
- if args.empty? && @__weel_values.key?(name)
328
- @__weel_values[name]
329
- elsif args.empty? && @__weel_values.key?(name.to_s)
330
- @__weel_values[name.to_s]
331
- elsif name.to_s[-1..-1] == "=" && args.length == 1
332
- temp = name.to_s[0..-2]
333
- @__weel_values[temp.to_sym] = args[0]
334
- elsif name.to_s == "[]=" && args.length == 2
335
- @__weel_values[args[0]] = args[1]
336
- elsif name.to_s == "[]" && args.length == 1
337
- @__weel_values[args[0]]
338
- else
339
- nil
340
- end
333
+ nil
341
334
  end
342
335
  end
343
336
  end # }}}
344
337
 
338
+ class ProcString #{{{
339
+ attr_reader :code
340
+ def initialize(code)
341
+ @code = code
342
+ end
343
+ end #}}}
344
+
345
345
  class ConnectionWrapperBase # {{{
346
346
  def self::loop_guard(arguments,lid,count); false; end
347
347
  def self::inform_state_change(arguments,newstate); end
@@ -351,7 +351,6 @@ class WEEL
351
351
 
352
352
  def initialize(arguments,position=nil,continue=nil); end
353
353
 
354
- def prepare(readonly, endpoints, parameters); parameters; end
355
354
  def additional; {}; end
356
355
 
357
356
  def activity_handle(passthrough, parameters); end
@@ -374,17 +373,11 @@ class WEEL
374
373
  def vote_sync_before(parameters=nil); true; end
375
374
  def vote_sync_after; true; end
376
375
 
377
- # type => activity, loop, parallel, choice
378
- # nesting => none, start, end
379
- # eid => id's also for control structures
380
- # parameters => stuff given to the control structure
381
- def simulate(type,nesting,sequence,parent,parameters={}); end
382
-
383
376
  def callback(result=nil,options={}); end
384
377
  def mem_guard; end
385
378
 
379
+ def prepare(readonly, endpoints, parameters); parameters; end
386
380
  def test_condition(dataelements,endpoints,local,additional,code,args={}); ReadStructure.new(dataelements,endpoints,local,additional).instance_eval(code); end
387
- def eval_expression(dataelements,endpoints,local,additional,code); ReadStructure.new(dataelements,endpoints,local,additional).instance_eval(code); end
388
381
  def manipulate(readonly,lock,dataelements,endpoints,status,local,additional,code,where,result=nil,options=nil)
389
382
  lock.synchronize do
390
383
  if readonly
@@ -396,6 +389,7 @@ class WEEL
396
389
  end
397
390
 
398
391
  def join_branches(branches); end
392
+ def split_branches(branches); end
399
393
  end # }}}
400
394
 
401
395
  class Position # {{{
@@ -499,14 +493,14 @@ class WEEL
499
493
  @__weel_connectionwrapper_args = []
500
494
  @__weel_state = :ready
501
495
  @__weel_status = Status.new(0,"undefined")
502
- @__weel_sim = -1
496
+ @__weel_sim = false
503
497
  @__weel_lock = Mutex.new
504
498
  end #}}}
505
499
  attr_accessor :__weel_search_positions, :__weel_positions, :__weel_main, :__weel_data, :__weel_endpoints, :__weel_connectionwrapper, :__weel_connectionwrapper_args
506
500
  attr_reader :__weel_state, :__weel_status, :__weel_status
507
501
 
508
502
  # DSL-Construct for translating expressions into static parameters
509
- def 🠊(code); __weel_eval_expression(code); end
503
+ def 🠊(code); ProcString.new(code); end
510
504
 
511
505
  # DSL-Constructs for atomic calls to external services (calls) and pure context manipulations (manipulate).
512
506
  # Calls can also manipulate context (after the invoking the external services)
@@ -538,8 +532,6 @@ class WEEL
538
532
  Thread.current[:branch_event] = Continue.new
539
533
  Thread.current[:mutex] = Mutex.new
540
534
 
541
- hw, pos = __weel_sim_start(:parallel) if __weel_sim
542
-
543
535
  __weel_protect_yield(&block)
544
536
 
545
537
  Thread.current[:branch_wait_count] = (type.is_a?(Hash) && type[:wait] != nil && (type[:wait].is_a?(Integer) && type[:wait] > 0) ? type[:wait] : Thread.current[:branches].size)
@@ -549,6 +541,9 @@ class WEEL
549
541
  Thread.current[:branch_event].wait
550
542
  end
551
543
 
544
+ cw = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
545
+ cw.split_branches(Thread.current[:branch_traces])
546
+
552
547
  Thread.current[:branches].each do |thread|
553
548
  # decide after executing block in parallel cause for coopis
554
549
  # it goes out of search mode while dynamically counting branches
@@ -560,10 +555,6 @@ class WEEL
560
555
 
561
556
  Thread.current[:branch_event].wait unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:branches].length == 0
562
557
 
563
- __weel_sim_stop(:parallel,hw,pos) if __weel_sim
564
-
565
- cw = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
566
-
567
558
  cw.join_branches(Thread.current[:branch_traces])
568
559
 
569
560
  unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
@@ -584,11 +575,6 @@ class WEEL
584
575
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
585
576
  branch_parent = Thread.current
586
577
 
587
- if __weel_sim
588
- # catch the potential execution in loops inside a parallel
589
- current_branch_sim_pos = branch_parent[:branch_sim_pos]
590
- end
591
-
592
578
  branch_parent[:branches] << Thread.new(*vars) do |*local|
593
579
  Thread.current.abort_on_exception = true
594
580
  Thread.current[:branch_search] = @__weel_search_positions.any?
@@ -601,10 +587,6 @@ class WEEL
601
587
  branch_parent[:branch_traces_ids] += 1
602
588
  end
603
589
 
604
- if __weel_sim
605
- Thread.current[:branch_sim_pos] = @__weel_sim += 1
606
- end
607
-
608
590
  # parallel_branch could be possibly around an alternative. Thus thread has to inherit the alternative_executed
609
591
  # after branching, update it in the parent (TODO)
610
592
  if branch_parent[:alternative_executed] && branch_parent[:alternative_executed].length > 0
@@ -614,17 +596,10 @@ class WEEL
614
596
  branch_parent[:branch_event].continue
615
597
  Thread.current[:start_event].wait unless self.__weel_state == :stopping || self.__weel_state == :stopped || self.__weel_state == :finishing
616
598
 
617
- if __weel_sim
618
- connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
619
- connectionwrapper.simulate(:parallel_branch,:start,Thread.current[:branch_sim_pos],current_branch_sim_pos)
620
- end
621
-
622
599
  unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
623
600
  __weel_protect_yield(*local, &block)
624
601
  end
625
602
 
626
- __weel_sim_stop(:parallel_branch,connectionwrapper,current_branch_sim_pos) if __weel_sim
627
-
628
603
  branch_parent[:mutex].synchronize do
629
604
  branch_parent[:branch_finished_count] += 1
630
605
 
@@ -666,9 +641,11 @@ class WEEL
666
641
  Thread.current[:alternative_mode] ||= []
667
642
  Thread.current[:alternative_executed] << false
668
643
  Thread.current[:alternative_mode] << mode
669
- hw, pos = __weel_sim_start(:choose,:mode => Thread.current[:alternative_mode].last) if __weel_sim
644
+
645
+ cw = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
646
+ cw.split_branches(Thread.current[:branch_traces])
647
+
670
648
  __weel_protect_yield(&block)
671
- __weel_sim_stop(:choose,hw,pos,:mode => Thread.current[:alternative_mode].last) if __weel_sim
672
649
  Thread.current[:alternative_executed].pop
673
650
  Thread.current[:alternative_mode].pop
674
651
  nil
@@ -679,25 +656,21 @@ class WEEL
679
656
  # searchmode is active (to find the starting position)
680
657
  def alternative(condition,args={},&block)# {{{
681
658
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
682
- hw, pos = __weel_sim_start(:alternative,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => (condition.is_a?(String) ? condition : nil))) if __weel_sim
683
659
  Thread.current[:mutex] ||= Mutex.new
684
660
  Thread.current[:mutex].synchronize do
685
661
  return if Thread.current[:alternative_mode][-1] == :exclusive && Thread.current[:alternative_executed][-1] == true
686
- if condition.is_a?(String) && !__weel_sim
662
+ if condition.is_a?(String)
687
663
  condition = __weel_eval_condition(condition, args)
688
664
  end
689
665
  Thread.current[:alternative_executed][-1] = true if condition
690
666
  end
691
667
  searchmode = __weel_is_in_search_mode
692
- __weel_protect_yield(&block) if searchmode || __weel_sim || condition
668
+ __weel_protect_yield(&block) if searchmode || condition
693
669
  Thread.current[:alternative_executed][-1] = true if __weel_is_in_search_mode != searchmode # we swiched from searchmode true to false, thus branch has been executed which is as good as evaling the condition to true
694
- __weel_sim_stop(:alternative,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => (condition.is_a?(String) ? condition : nil))) if __weel_sim
695
670
  end # }}}
696
671
  def otherwise(args={},&block) # {{{
697
672
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
698
- hw, pos = __weel_sim_start(:otherwise,args.merge(:mode => Thread.current[:alternative_mode].last)) if __weel_sim
699
- __weel_protect_yield(&block) if __weel_is_in_search_mode || __weel_sim || !Thread.current[:alternative_executed].last
700
- __weel_sim_stop(:otherwise,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last)) if __weel_sim
673
+ __weel_protect_yield(&block) if __weel_is_in_search_mode || !Thread.current[:alternative_executed].last
701
674
  end # }}}
702
675
 
703
676
  # Defines a critical block (=Mutex)
@@ -733,15 +706,6 @@ class WEEL
733
706
  condition[1] = :pre_test
734
707
  end
735
708
  end
736
- if __weel_sim
737
- cond = condition[0]
738
- hw, pos = __weel_sim_start(:loop,args.merge(:testing=>condition[1],:condition=>cond))
739
- catch :escape do
740
- __weel_protect_yield(&block)
741
- end
742
- __weel_sim_stop(:loop,hw,pos,args.merge(:testing=>condition[1],:condition=>cond))
743
- return
744
- end
745
709
  loop_guard = 0
746
710
  loop_id = SecureRandom.uuid
747
711
  catch :escape do
@@ -802,7 +766,7 @@ class WEEL
802
766
  @__weel_status
803
767
  end # }}}
804
768
  def data # {{{
805
- ReadOnlyHash.new(@__weel_data,__weel_sim)
769
+ ReadOnlyHash.new(@__weel_data)
806
770
  end # }}}
807
771
  def endpoints # {{{
808
772
  ReadHash.new(@__weel_endpoints)
@@ -839,22 +803,6 @@ class WEEL
839
803
  end
840
804
  end #}}}
841
805
 
842
- def __weel_eval_expression(expression) #{{{
843
- begin
844
- connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
845
- connectionwrapper.eval_expression(@__weel_data,@__weel_endpoints,Thread.current[:local],connectionwrapper.additional,expression)
846
- rescue NameError => err # don't look into it, or it will explode
847
- # if you access $! here, BOOOM
848
- self.__weel_state = :stopping
849
- @__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,Exception.new("eval_expression: `#{err.name}` is not a thing that can be used. Maybe it is meant to be a string and you forgot quotes?"),nil)
850
- nil
851
- rescue => err
852
- self.__weel_state = :stopping
853
- @__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,Exception.new(err.message),nil)
854
- nil
855
- end
856
- end #}}}
857
-
858
806
  def __weel_progress(position, uuid, skip=false) #{{{
859
807
  ipc = {}
860
808
  branch = Thread.current
@@ -902,11 +850,6 @@ class WEEL
902
850
  Thread.current[:continue] = Continue.new
903
851
  connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args, position, Thread.current[:continue]
904
852
 
905
- if __weel_sim
906
- connectionwrapper.simulate(:activity,:none,@__weel_sim += 1,Thread.current[:branch_sim_pos],:position => position,:parameters => parameters,:endpoint => endpoint,:type => type,:finalize => finalize.is_a?(String) ? finalize : nil)
907
- return
908
- end
909
-
910
853
  # gather traces in threads to point to join
911
854
  if Thread.current[:branch_parent] && Thread.current[:branch_traces_id]
912
855
  Thread.current[:branch_parent][:branch_traces][Thread.current[:branch_traces_id]] ||= []
@@ -936,81 +879,78 @@ class WEEL
936
879
  @__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, :after => [wp]
937
880
  end
938
881
  when :call
939
- begin
940
- again = catch Signal::Again do
941
- connectionwrapper.mem_guard
942
- struct = if prepare
943
- connectionwrapper.manipulate(true,@__weel_lock,@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional,prepare,'Activity ' + position.to_s)
944
- else
945
- # just the read structure, no code exec necessary
946
- ReadStructure.new(@__weel_data,@__weel_endpoints,Thread.current[:local],connectionwrapper.additional)
947
- end
948
- params = connectionwrapper.prepare(struct,endpoint,parameters)
949
- raise Signal::Stop unless connectionwrapper.vote_sync_before(params)
950
- raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
951
-
952
- connectionwrapper.activity_handle wp.passthrough, params
953
- wp.passthrough = connectionwrapper.activity_passthrough_value
954
- unless wp.passthrough.nil?
955
- @__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, :wait => [wp]
956
- end
957
- begin
958
- # cleanup after callback updates
959
- connectionwrapper.mem_guard
882
+ again = catch Signal::Again do
883
+ connectionwrapper.mem_guard
884
+ struct = if prepare
885
+ connectionwrapper.manipulate(true,@__weel_lock,@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional,prepare,'Activity ' + position.to_s)
886
+ else
887
+ # just the read structure, no code exec necessary
888
+ ReadStructure.new(@__weel_data,@__weel_endpoints,Thread.current[:local],connectionwrapper.additional)
889
+ end
890
+ params = connectionwrapper.prepare(struct,endpoint,parameters)
960
891
 
961
- # with loop if catching Signal::Again
962
- # handshake call and wait until it finished
963
- waitingresult = nil
964
- waitingresult = Thread.current[:continue].wait unless Thread.current[:nolongernecessary] || self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
892
+ raise Signal::Stop unless connectionwrapper.vote_sync_before(params)
893
+ raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
965
894
 
966
- raise waitingresult[1] if !waitingresult.nil? && waitingresult.is_a?(Array) && waitingresult.length == 2 && waitingresult[0] == WEEL::Signal::Error
895
+ connectionwrapper.activity_handle wp.passthrough, params
896
+ wp.passthrough = connectionwrapper.activity_passthrough_value
897
+ unless wp.passthrough.nil?
898
+ @__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, :wait => [wp]
899
+ end
900
+ begin
901
+ # cleanup after callback updates
902
+ connectionwrapper.mem_guard
967
903
 
968
- if Thread.current[:nolongernecessary]
969
- connectionwrapper.activity_no_longer_necessary
970
- raise Signal::NoLongerNecessary
971
- end
972
- if self.__weel_state == :stopping || self.__weel_state == :finishing
973
- connectionwrapper.activity_stop
974
- wp.passthrough = connectionwrapper.activity_passthrough_value
975
- raise Signal::Proceed if wp.passthrough # if stop, but no passthrough, let manipulate happen and then stop
976
- end
904
+ # with loop if catching Signal::Again
905
+ # handshake call and wait until it finished
906
+ waitingresult = nil
907
+ waitingresult = Thread.current[:continue].wait unless Thread.current[:nolongernecessary] || self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
908
+
909
+ if Thread.current[:nolongernecessary]
910
+ connectionwrapper.activity_no_longer_necessary
911
+ raise Signal::NoLongerNecessary
912
+ end
913
+ if self.__weel_state == :stopping || self.__weel_state == :finishing
914
+ connectionwrapper.activity_stop
915
+ wp.passthrough = connectionwrapper.activity_passthrough_value
916
+ raise Signal::Proceed if wp.passthrough # if stop, but no passthrough, let manipulate happen and then stop
917
+ end
977
918
 
978
- next if waitingresult == WEEL::Signal::Again && connectionwrapper.activity_result_value&.length == 0
919
+ next if waitingresult == WEEL::Signal::UpdateAgain && connectionwrapper.activity_result_value&.length == 0
979
920
 
980
- code = if waitingresult == WEEL::Signal::Again
981
- update
982
- elsif waitingresult == WEEL::Signal::Salvage
983
- salvage || raise('HTTP Error. The service return status was not between 200 and 300.')
984
- else
985
- finalize
986
- end
987
- if code.is_a?(String)
988
- connectionwrapper.inform_activity_manipulate
989
- struct = nil
990
-
991
- # when you throw without parameters, ma contains nil, so we return Signal::Proceed to give ma a meaningful value in other cases
992
- ma = catch Signal::Again do
993
- struct = connectionwrapper.manipulate(false,@__weel_lock,@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional,code,'Activity ' + position.to_s,connectionwrapper.activity_result_value,connectionwrapper.activity_result_options)
994
- Signal::Proceed
995
- end
996
- connectionwrapper.inform_manipulate_change(
997
- ((struct && struct.changed_status) ? @__weel_status : nil),
998
- ((struct && struct.changed_data.any?) ? struct.changed_data.uniq : nil),
999
- ((struct && struct.changed_endpoints.any?) ? struct.changed_endpoints.uniq : nil),
1000
- @__weel_data,
1001
- @__weel_endpoints
1002
- )
1003
- throw(Signal::Again, Signal::Again) if ma.nil?
921
+ code = if waitingresult == WEEL::Signal::UpdateAgain
922
+ update
923
+ elsif waitingresult == WEEL::Signal::Salvage
924
+ salvage || raise('HTTP Error. The service return status was not between 200 and 300.')
925
+ else
926
+ finalize
927
+ end
928
+ if code.is_a?(String)
929
+ connectionwrapper.inform_activity_manipulate
930
+ struct = nil
931
+
932
+ # when you throw without parameters, ma contains nil, so we return Signal::Proceed to give ma a meaningful value in other cases
933
+ ma = catch Signal::Again do
934
+ struct = connectionwrapper.manipulate(false,@__weel_lock,@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional,code,'Activity ' + position.to_s,connectionwrapper.activity_result_value,connectionwrapper.activity_result_options)
935
+ Signal::Proceed
1004
936
  end
1005
- end while waitingresult == Signal::Again
1006
- if connectionwrapper.activity_passthrough_value.nil?
1007
- connectionwrapper.inform_activity_done
1008
- wp.passthrough = nil
1009
- wp.detail = :after
1010
- @__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, :after => [wp]
937
+ connectionwrapper.inform_manipulate_change(
938
+ ((struct && struct.changed_status) ? @__weel_status : nil),
939
+ ((struct && struct.changed_data.any?) ? struct.changed_data.uniq : nil),
940
+ ((struct && struct.changed_endpoints.any?) ? struct.changed_endpoints.uniq : nil),
941
+ @__weel_data,
942
+ @__weel_endpoints
943
+ )
944
+ throw(Signal::Again, Signal::Again) if ma.nil? || ma == Signal::Again # this signal again loops "there is a catch" because rescue signal throw that throughly restarts the task
1011
945
  end
946
+ end while waitingresult == Signal::UpdateAgain # this signal again loops because async update, proposal: rename to UpdateAgain
947
+ if connectionwrapper.activity_passthrough_value.nil?
948
+ connectionwrapper.inform_activity_done
949
+ wp.passthrough = nil
950
+ wp.detail = :after
951
+ @__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, :after => [wp]
1012
952
  end
1013
- end while again == Signal::Again
953
+ end # there is a catch
1014
954
  end
1015
955
  raise Signal::Proceed
1016
956
  rescue Signal::SkipManipulate, Signal::Proceed
@@ -1122,23 +1062,6 @@ class WEEL
1122
1062
  end
1123
1063
  end # }}}
1124
1064
 
1125
- def __weel_sim #{{{
1126
- @__weel_state == :simulating
1127
- end #}}}
1128
-
1129
- def __weel_sim_start(what,options={}) #{{{
1130
- current_branch_sim_pos = Thread.current[:branch_sim_pos]
1131
- Thread.current[:branch_sim_pos] = @__weel_sim += 1
1132
- connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
1133
- connectionwrapper.simulate(what,:start,Thread.current[:branch_sim_pos],current_branch_sim_pos,options)
1134
- [connectionwrapper, current_branch_sim_pos]
1135
- end #}}}
1136
-
1137
- def __weel_sim_stop(what,connectionwrapper,current_branch_sim_pos,options={}) #{{{
1138
- connectionwrapper.simulate(what,:end,Thread.current[:branch_sim_pos],current_branch_sim_pos,options)
1139
- Thread.current[:branch_sim_pos] = current_branch_sim_pos
1140
- end #}}}
1141
-
1142
1065
  public
1143
1066
  def __weel_finalize #{{{
1144
1067
  __weel_recursive_join(@__weel_main)
data/weel.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "weel"
3
- s.version = "1.99.121"
3
+ s.version = "1.99.123"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0-or-later"
6
6
  s.summary = "Workflow Execution Engine Library (WEEL)"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.99.121
4
+ version: 1.99.123
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-09-13 00:00:00.000000000 Z
12
+ date: 2024-09-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit