flor 0.18.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +3 -0
- data/CREDITS.md +1 -0
- data/LICENSE.txt +1 -1
- data/Makefile +1 -1
- data/README.md +15 -1
- data/flor.gemspec +1 -2
- data/lib/flor.rb +2 -2
- data/lib/flor/colours.rb +5 -3
- data/lib/flor/conf.rb +1 -0
- data/lib/flor/core.rb +9 -8
- data/lib/flor/core/executor.rb +20 -16
- data/lib/flor/core/node.rb +1 -13
- data/lib/flor/core/procedure.rb +10 -1
- data/lib/flor/core/texecutor.rb +9 -2
- data/lib/flor/djan.rb +1 -0
- data/lib/flor/errors.rb +1 -0
- data/lib/flor/flor.rb +144 -15
- data/lib/flor/id.rb +1 -0
- data/lib/flor/log.rb +2 -1
- data/lib/flor/migrations/0001_tables.rb +1 -0
- data/lib/flor/migrations/0002_cunit_and_munit.rb +1 -0
- data/lib/flor/migrations/0003_timer_onid_bnid.rb +1 -0
- data/lib/flor/migrations/0004_trap_bnid.rb +1 -0
- data/lib/flor/migrations/0005_pointer_content.rb +1 -0
- data/lib/flor/parser.rb +19 -11
- data/lib/flor/pcore/_apply.rb +1 -0
- data/lib/flor/pcore/_arr.rb +1 -0
- data/lib/flor/pcore/_atom.rb +1 -0
- data/lib/flor/pcore/_att.rb +1 -0
- data/lib/flor/pcore/_coll.rb +1 -0
- data/lib/flor/pcore/_dmute.rb +1 -0
- data/lib/flor/pcore/_dol.rb +1 -0
- data/lib/flor/pcore/_dqs.rb +1 -0
- data/lib/flor/pcore/_dump.rb +1 -0
- data/lib/flor/pcore/_err.rb +1 -0
- data/lib/flor/pcore/_head.rb +1 -0
- data/lib/flor/pcore/_obj.rb +1 -0
- data/lib/flor/pcore/_pat_.rb +1 -0
- data/lib/flor/pcore/_pat_arr.rb +1 -0
- data/lib/flor/pcore/_pat_guard.rb +1 -0
- data/lib/flor/pcore/_pat_obj.rb +1 -0
- data/lib/flor/pcore/_pat_or.rb +1 -0
- data/lib/flor/pcore/_pat_regex.rb +1 -0
- data/lib/flor/pcore/_ref.rb +1 -0
- data/lib/flor/pcore/_rxs.rb +1 -0
- data/lib/flor/pcore/_skip.rb +1 -0
- data/lib/flor/pcore/_val.rb +1 -0
- data/lib/flor/pcore/all.rb +1 -0
- data/lib/flor/pcore/andor.rb +1 -0
- data/lib/flor/pcore/any.rb +1 -0
- data/lib/flor/pcore/apply.rb +1 -0
- data/lib/flor/pcore/arith.rb +1 -0
- data/lib/flor/pcore/array_qmark.rb +1 -0
- data/lib/flor/pcore/break.rb +1 -0
- data/lib/flor/pcore/case.rb +1 -0
- data/lib/flor/pcore/cmp.rb +1 -0
- data/lib/flor/pcore/collect.rb +2 -1
- data/lib/flor/pcore/cond.rb +1 -0
- data/lib/flor/pcore/cursor.rb +45 -3
- data/lib/flor/pcore/define.rb +1 -0
- data/lib/flor/pcore/detect.rb +1 -0
- data/lib/flor/pcore/do_return.rb +1 -0
- data/lib/flor/pcore/each.rb +1 -0
- data/lib/flor/pcore/echo.rb +1 -0
- data/lib/flor/pcore/empty.rb +1 -0
- data/lib/flor/pcore/fail.rb +1 -0
- data/lib/flor/pcore/filter.rb +1 -0
- data/lib/flor/pcore/find.rb +1 -0
- data/lib/flor/pcore/flatten.rb +1 -0
- data/lib/flor/pcore/for_each.rb +1 -0
- data/lib/flor/pcore/if.rb +1 -0
- data/lib/flor/pcore/includes.rb +1 -0
- data/lib/flor/pcore/inject.rb +1 -0
- data/lib/flor/pcore/iterator.rb +1 -0
- data/lib/flor/pcore/keys.rb +1 -0
- data/lib/flor/pcore/length.rb +1 -0
- data/lib/flor/pcore/loop.rb +1 -0
- data/lib/flor/pcore/map.rb +1 -0
- data/lib/flor/pcore/match.rb +1 -0
- data/lib/flor/pcore/matchr.rb +1 -0
- data/lib/flor/pcore/max.rb +1 -0
- data/lib/flor/pcore/merge.rb +1 -0
- data/lib/flor/pcore/move.rb +1 -0
- data/lib/flor/pcore/noeval.rb +1 -0
- data/lib/flor/pcore/noret.rb +1 -0
- data/lib/flor/pcore/not.rb +1 -0
- data/lib/flor/pcore/on.rb +4 -3
- data/lib/flor/pcore/on_cancel.rb +1 -0
- data/lib/flor/pcore/on_error.rb +1 -0
- data/lib/flor/pcore/push.rb +1 -0
- data/lib/flor/pcore/rand.rb +1 -0
- data/lib/flor/pcore/range.rb +1 -0
- data/lib/flor/pcore/reduce.rb +1 -0
- data/lib/flor/pcore/return.rb +1 -0
- data/lib/flor/pcore/reverse.rb +1 -0
- data/lib/flor/pcore/select.rb +1 -0
- data/lib/flor/pcore/sequence.rb +1 -0
- data/lib/flor/pcore/set.rb +1 -0
- data/lib/flor/pcore/shuffle.rb +1 -0
- data/lib/flor/pcore/slice.rb +1 -0
- data/lib/flor/pcore/sort.rb +1 -0
- data/lib/flor/pcore/sort_by.rb +1 -0
- data/lib/flor/pcore/split.rb +1 -0
- data/lib/flor/pcore/stall.rb +1 -0
- data/lib/flor/pcore/strings.rb +1 -0
- data/lib/flor/pcore/timestamp.rb +1 -0
- data/lib/flor/pcore/to_array.rb +1 -0
- data/lib/flor/pcore/twig.rb +1 -0
- data/lib/flor/pcore/type_of.rb +1 -0
- data/lib/flor/pcore/until.rb +1 -0
- data/lib/flor/punit/abort.rb +50 -0
- data/lib/flor/punit/c_collect.rb +1 -0
- data/lib/flor/punit/c_each.rb +19 -0
- data/lib/flor/punit/c_for_each.rb +2 -1
- data/lib/flor/punit/c_iterator.rb +1 -0
- data/lib/flor/punit/c_map.rb +1 -0
- data/lib/flor/punit/cancel.rb +1 -0
- data/lib/flor/punit/concurrence.rb +1 -0
- data/lib/flor/punit/cron.rb +1 -0
- data/lib/flor/punit/do_trap.rb +1 -0
- data/lib/flor/punit/every.rb +1 -0
- data/lib/flor/punit/graft.rb +1 -0
- data/lib/flor/punit/m_ram.rb +1 -0
- data/lib/flor/punit/on_timeout.rb +1 -0
- data/lib/flor/punit/part.rb +1 -0
- data/lib/flor/punit/schedule.rb +1 -0
- data/lib/flor/punit/signal.rb +1 -0
- data/lib/flor/punit/sleep.rb +1 -0
- data/lib/flor/punit/task.rb +1 -0
- data/lib/flor/punit/trace.rb +1 -0
- data/lib/flor/punit/trap.rb +10 -1
- data/lib/flor/to_string.rb +1 -0
- data/lib/flor/tools/env.rb +1 -0
- data/lib/flor/tools/shell.rb +1 -0
- data/lib/flor/tools/shell_out.rb +1 -0
- data/lib/flor/tt.rb +98 -0
- data/lib/flor/unit.rb +2 -0
- data/lib/flor/unit/caller.rb +152 -19
- data/lib/flor/unit/caller_jruby.rb +132 -0
- data/lib/flor/unit/dump.rb +36 -0
- data/lib/flor/unit/executor.rb +1 -0
- data/lib/flor/unit/ganger.rb +6 -12
- data/lib/flor/unit/hloader.rb +34 -7
- data/lib/flor/unit/hook.rb +3 -0
- data/lib/flor/unit/hooker.rb +32 -15
- data/lib/flor/unit/journal.rb +23 -0
- data/lib/flor/unit/loader.rb +102 -7
- data/lib/flor/unit/logger.rb +24 -5
- data/lib/flor/unit/models.rb +8 -1
- data/lib/flor/unit/models/execution.rb +51 -0
- data/lib/flor/unit/models/message.rb +1 -0
- data/lib/flor/unit/models/pointer.rb +1 -0
- data/lib/flor/unit/models/timer.rb +1 -0
- data/lib/flor/unit/models/trace.rb +1 -0
- data/lib/flor/unit/models/trap.rb +3 -2
- data/lib/flor/unit/scheduler.rb +35 -28
- data/lib/flor/unit/spooler.rb +1 -0
- data/lib/flor/unit/storage.rb +68 -44
- data/lib/flor/unit/taskers.rb +2 -1
- data/lib/flor/unit/waiter.rb +2 -1
- data/lib/flor/unit/wlist.rb +10 -8
- metadata +13 -10
data/lib/flor/unit/spooler.rb
CHANGED
data/lib/flor/unit/storage.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require 'zlib'
|
3
4
|
|
@@ -30,9 +31,11 @@ module Flor
|
|
30
31
|
#p [ :disconnected, @db.object_id ]
|
31
32
|
end
|
32
33
|
|
33
|
-
def db_version
|
34
|
+
def db_version(opts={})
|
34
35
|
|
35
|
-
|
36
|
+
table, column = migration_table_and_column(opts)
|
37
|
+
|
38
|
+
(@db[table].first rescue {})[column]
|
36
39
|
end
|
37
40
|
|
38
41
|
def migration_version
|
@@ -79,34 +82,27 @@ module Flor
|
|
79
82
|
opts[:target] ||= to if to.is_a?(Integer)
|
80
83
|
opts[:current] ||= from if from.is_a?(Integer)
|
81
84
|
|
82
|
-
opts[:table] = (
|
83
|
-
|
84
|
-
|
85
|
-
:schema_info
|
86
|
-
|
87
|
-
@unit.conf['db_migration_column'] ||
|
88
|
-
@unit.conf['sto_migration_column'] ||
|
89
|
-
:version).to_sym
|
90
|
-
#
|
91
|
-
# defaults for the migration version table:
|
92
|
-
# { table: :schema_info,
|
93
|
-
# column: :version }
|
85
|
+
opts[:table], opts[:column] = migration_table_and_column(opts)
|
86
|
+
#
|
87
|
+
# defaults for the migration version table:
|
88
|
+
# { table: :schema_info,
|
89
|
+
# column: :version }
|
94
90
|
|
95
91
|
skip =
|
92
|
+
opts[:sparse_migrations] ||
|
96
93
|
@unit.conf['db_sparse_migrations'] ||
|
97
|
-
@unit.conf['sto_sparse_migrations']
|
98
|
-
opts[:sparse_migrations]
|
94
|
+
@unit.conf['sto_sparse_migrations']
|
99
95
|
if skip && ! opts.has_key?(:allow_missing_migration_files)
|
100
96
|
opts[:allow_missing_migration_files] = true
|
101
97
|
end
|
102
98
|
|
103
99
|
dir =
|
100
|
+
opts[:migrations] ||
|
101
|
+
opts[:migration_dir] ||
|
104
102
|
@unit.conf['db_migrations'] ||
|
105
103
|
@unit.conf['db_migration_dir'] ||
|
106
104
|
@unit.conf['sto_migrations'] ||
|
107
105
|
@unit.conf['sto_migration_dir'] ||
|
108
|
-
opts[:migrations] ||
|
109
|
-
opts[:migration_dir] ||
|
110
106
|
Flor.migration_dir
|
111
107
|
|
112
108
|
synchronize do
|
@@ -336,35 +332,40 @@ module Flor
|
|
336
332
|
n = Flor.tstamp
|
337
333
|
u = @unit.identifier
|
338
334
|
|
339
|
-
|
335
|
+
id =
|
336
|
+
synchronize(syn) do
|
340
337
|
|
341
|
-
|
338
|
+
stored, unstored = ms.partition { |m| m['mid'] }
|
342
339
|
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
340
|
+
#
|
341
|
+
# de-reserve any previously stored message, might happen
|
342
|
+
# for "terminated" messages that got queued back to let
|
343
|
+
# other messages get processed
|
347
344
|
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
345
|
+
@db[:flor_messages]
|
346
|
+
.where(id: stored.collect { |m| m['mid'] })
|
347
|
+
.update(status: 'created', mtime: n, munit: u) \
|
348
|
+
if stored.any?
|
352
349
|
|
353
|
-
|
354
|
-
|
350
|
+
#
|
351
|
+
# store new messages
|
355
352
|
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
353
|
+
@db[:flor_messages]
|
354
|
+
.import(
|
355
|
+
[ :domain, :exid, :point, :content,
|
356
|
+
:status, :ctime, :mtime, :cunit, :munit ],
|
357
|
+
unstored.map { |m|
|
358
|
+
[ Flor.domain(m['exid']), m['exid'], m['point'], to_blob(m),
|
359
|
+
'created', n, n, u, u ] }) \
|
360
|
+
if unstored.any?
|
361
|
+
|
362
|
+
@db[:flor_messages].max(:id)
|
363
|
+
end
|
365
364
|
|
366
365
|
@unit.wake_up
|
367
366
|
|
367
|
+
id
|
368
|
+
|
368
369
|
rescue => err
|
369
370
|
|
370
371
|
Thread.current[:sto_errored_items] = ms
|
@@ -557,6 +558,18 @@ module Flor
|
|
557
558
|
|
558
559
|
protected
|
559
560
|
|
561
|
+
def migration_table_and_column(opts={})
|
562
|
+
|
563
|
+
[ (opts[:migration_table] ||
|
564
|
+
@unit.conf['db_migration_table'] ||
|
565
|
+
@unit.conf['sto_migration_table'] ||
|
566
|
+
:schema_info).to_sym,
|
567
|
+
(opts[:migration_column] ||
|
568
|
+
@unit.conf['db_migration_column'] ||
|
569
|
+
@unit.conf['sto_migration_column'] ||
|
570
|
+
:version).to_sym ]
|
571
|
+
end
|
572
|
+
|
560
573
|
def _commaify(o)
|
561
574
|
|
562
575
|
if Flor.is_regex_tree?(o)
|
@@ -798,15 +811,26 @@ module Flor
|
|
798
811
|
def error(msg); @unit.logger.db_log(:error, msg); end
|
799
812
|
end
|
800
813
|
|
801
|
-
def
|
814
|
+
def derive_db
|
815
|
+
|
816
|
+
db = @unit.conf['sto_db']
|
817
|
+
|
818
|
+
return db if db
|
802
819
|
|
803
820
|
uri = @unit.conf['sto_uri']
|
804
821
|
|
805
|
-
|
806
|
-
|
807
|
-
|
822
|
+
fail ArgumentError.new("no 'sto_uri' conf, cannot connect to db") \
|
823
|
+
unless uri
|
824
|
+
|
825
|
+
#uri = uri.to_s
|
826
|
+
#return Kernel.const_get(uri) if uri.match(/\A[A-Z]+\z/)
|
827
|
+
|
828
|
+
Sequel.connect(uri)
|
829
|
+
end
|
830
|
+
|
831
|
+
def connect
|
808
832
|
|
809
|
-
@db =
|
833
|
+
@db = derive_db
|
810
834
|
|
811
835
|
class << @db; attr_accessor :flor_unit; end
|
812
836
|
@db.flor_unit = @unit
|
data/lib/flor/unit/taskers.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
module Flor
|
3
4
|
|
@@ -88,7 +89,7 @@ module Flor
|
|
88
89
|
return m if Flor.is_exid?(exid) && Flor.is_nid?(nid) && pl.is_a?(Hash)
|
89
90
|
|
90
91
|
m = Flor.to_string_keyed_hash(m)
|
91
|
-
h = Flor.
|
92
|
+
h = Flor.dup_message(@message)
|
92
93
|
ks = m.keys
|
93
94
|
|
94
95
|
if ks == [ 'payload' ]
|
data/lib/flor/unit/waiter.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
module Flor
|
3
4
|
|
@@ -209,7 +210,7 @@ module Flor
|
|
209
210
|
(name == nil || ptr.name == name) &&
|
210
211
|
(value == nil || ptr.value == value.to_s) }
|
211
212
|
end
|
212
|
-
alias row_match_variable?
|
213
|
+
alias row_match_variable? row_match_var?
|
213
214
|
|
214
215
|
def row_match_tasker?(unit, rs, nid, (name, value))
|
215
216
|
|
data/lib/flor/unit/wlist.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
module Flor
|
3
4
|
|
@@ -42,18 +43,19 @@ module Flor
|
|
42
43
|
|
43
44
|
def notify(executor, message)
|
44
45
|
|
45
|
-
|
46
|
+
return [] unless message['consumed']
|
47
|
+
return [] if @msg_waiters.empty?
|
46
48
|
|
47
|
-
|
49
|
+
@mutex.synchronize do
|
48
50
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
to_remove =
|
52
|
+
@msg_waiters.each_with_object([]) do |w, a|
|
53
|
+
remove = w.notify(executor, message)
|
54
|
+
a << w if remove
|
55
|
+
end
|
53
56
|
|
54
57
|
@msg_waiters -= to_remove
|
55
|
-
|
56
|
-
end if message['consumed']
|
58
|
+
end
|
57
59
|
|
58
60
|
[] # no new messages
|
59
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: munemo
|
@@ -225,6 +225,7 @@ files:
|
|
225
225
|
- lib/flor/pcore/twig.rb
|
226
226
|
- lib/flor/pcore/type_of.rb
|
227
227
|
- lib/flor/pcore/until.rb
|
228
|
+
- lib/flor/punit/abort.rb
|
228
229
|
- lib/flor/punit/c_collect.rb
|
229
230
|
- lib/flor/punit/c_each.rb
|
230
231
|
- lib/flor/punit/c_for_each.rb
|
@@ -249,8 +250,11 @@ files:
|
|
249
250
|
- lib/flor/tools/env.rb
|
250
251
|
- lib/flor/tools/shell.rb
|
251
252
|
- lib/flor/tools/shell_out.rb
|
253
|
+
- lib/flor/tt.rb
|
252
254
|
- lib/flor/unit.rb
|
253
255
|
- lib/flor/unit/caller.rb
|
256
|
+
- lib/flor/unit/caller_jruby.rb
|
257
|
+
- lib/flor/unit/dump.rb
|
254
258
|
- lib/flor/unit/executor.rb
|
255
259
|
- lib/flor/unit/ganger.rb
|
256
260
|
- lib/flor/unit/hloader.rb
|
@@ -272,16 +276,16 @@ files:
|
|
272
276
|
- lib/flor/unit/taskers.rb
|
273
277
|
- lib/flor/unit/waiter.rb
|
274
278
|
- lib/flor/unit/wlist.rb
|
275
|
-
homepage:
|
279
|
+
homepage: https://github.com/floraison
|
276
280
|
licenses:
|
277
281
|
- MIT
|
278
282
|
metadata:
|
279
|
-
changelog_uri:
|
280
|
-
documentation_uri:
|
281
|
-
bug_tracker_uri:
|
283
|
+
changelog_uri: https://github.com/floraison/flor/blob/master/CHANGELOG.md
|
284
|
+
documentation_uri: https://github.com/floraison/flor/tree/master/doc
|
285
|
+
bug_tracker_uri: https://github.com/floraison/flor/issues
|
282
286
|
mailing_list_uri: https://groups.google.com/forum/#!forum/floraison
|
283
|
-
homepage_uri:
|
284
|
-
source_code_uri:
|
287
|
+
homepage_uri: https://github.com/floraison/flor
|
288
|
+
source_code_uri: https://github.com/floraison/flor
|
285
289
|
post_install_message:
|
286
290
|
rdoc_options: []
|
287
291
|
require_paths:
|
@@ -297,8 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
301
|
- !ruby/object:Gem::Version
|
298
302
|
version: '0'
|
299
303
|
requirements: []
|
300
|
-
|
301
|
-
rubygems_version: 2.6.14.1
|
304
|
+
rubygems_version: 3.0.3
|
302
305
|
signing_key:
|
303
306
|
specification_version: 4
|
304
307
|
summary: A Ruby workflow engine
|