flor 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a1f76874a9957b7c15c59baf997e0e60ff4872b9109a7cd741692735a94565c
4
- data.tar.gz: 7fd1552910609023dd8bce0de0d5b5fc1ebc5ae1674fc27f0d0cb932c4bab2a7
3
+ metadata.gz: 1e6d591b2767c85e10b697b1839fb9142b52d0409bca73da41baa571f4e3aa8b
4
+ data.tar.gz: 6e9b4d916ccf37ee6189aed18a9365b98e79f8b6329cce4f1b4ed89f0acd4230
5
5
  SHA512:
6
- metadata.gz: cbca621e72efc0bdf1df26a4554590032f7a42d76ca19b361305f519071f1f026678c55c2980e74661ebcd5ac018d9e3e892376ee69a07c91ebb1d2d809cbb75
7
- data.tar.gz: b2c7cbe0a13c12f0e9b935c3d675f583d93a4f78f921982e75eb9050c84d97914c63cf9280667b5be977280cda9de27a57972f3f0d72b097710a6b3b1e45d67b
6
+ metadata.gz: 1572f392ea4e391674b79b02d09992a3c27c64485c64132ac84c3d37a031436fec5090cf2e2932996c8ee7e2879ce5f502a7c037324d48cba505b15d3924a0bf
7
+ data.tar.gz: a8f1272f9b4a992fac31530d9e53b6e8c91fbd8032891087dd546c677fb1c9f8218a051eac9fe54c23c8bb8cdb6b3b727f269768f92fb62d8fb6cb1bdf1318f0
@@ -2,7 +2,14 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
- ## flor 0.19.0 not yet released
5
+ ## flor 1.0.1 released 2020-11-23
6
+
7
+ * Accept sto_uri strings pointing to constant like 'DB'
8
+
9
+
10
+ ## flor 1.0.0 released 2020-11-22
11
+
12
+ * Lots of incremental improvements
6
13
 
7
14
 
8
15
  ## flor 0.18.0 released 2019-05-05
@@ -15,7 +15,7 @@ require 'dense'
15
15
 
16
16
  module Flor
17
17
 
18
- VERSION = '1.0.0'
18
+ VERSION = '1.0.1'
19
19
  end
20
20
 
21
21
  require 'flor/colours'
@@ -3,12 +3,11 @@
3
3
  module Flor
4
4
 
5
5
  NAME_REX = '[a-zA-Z0-9_]+'
6
- UNIT_NAME_REX = /\A#{NAME_REX}\z/
7
- DOMAIN_NAME_REX = /\A#{NAME_REX}(\.#{NAME_REX})*\z/
8
- FLOW_NAME_REX = /\A(#{NAME_REX}(?:\.#{NAME_REX})*)\.([a-zA-Z0-9_-]+)\z/
6
+ UNIT_NAME_REX = /\A#{NAME_REX}\z/.freeze
7
+ DOMAIN_NAME_REX = /\A#{NAME_REX}(\.#{NAME_REX})*\z/.freeze
8
+ FLOW_NAME_REX = /\A(#{NAME_REX}(?:\.#{NAME_REX})*)\.([a-zA-Z0-9_-]+)\z/.freeze
9
9
 
10
- #DOMAIN_UNIT_REX = /\A(#{NAME_REX}(?:\.#{NAME_REX})*)-(#{NAME_REX})[-\z]/
11
- DOMAIN_UNIT_REX = /\A(#{NAME_REX}(?:\.#{NAME_REX})*)-(#{NAME_REX})[-$]/
10
+ DOMAIN_UNIT_REX = /\A(#{NAME_REX}(?:\.#{NAME_REX})*)-(#{NAME_REX})[-$]/.freeze
12
11
 
13
12
  SPLAT_REGEX = /\A(.*)__(_|\d+)\z/.freeze
14
13
 
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Flor
4
4
 
5
+ NID_REX = /\A[0-9]+(?:_[0-9]+)*(?:-[0-9]+)?\z/.freeze
6
+ START_NID_REX = /\A[0-9]+(?:_[0-9]+)*(?:-[0-9]+)?/.freeze
7
+
5
8
  class << self
6
9
 
7
10
  #
@@ -99,7 +102,7 @@ module Flor
99
102
 
100
103
  def is_nid?(s)
101
104
 
102
- !! (s.is_a?(String) && s.match(/\A[0-9]+(?:_[0-9]+)*(?:-[0-9]+)?\z/))
105
+ !! (s.is_a?(String) && s.match(NID_REX))
103
106
  end
104
107
 
105
108
  def split_exid(s)
@@ -179,15 +179,15 @@ module Flor::Pro::ReceiveAndMerge
179
179
  # * ignore
180
180
  # * stack
181
181
 
182
- STACK_REX = /\Astack(?::([-_a-zA-Z0-9]+))?\z/
182
+ STACK_REX = /\Astack(?::([-_a-zA-Z0-9]+))?\z/.freeze
183
183
 
184
- TRANSLATORS = { STACK_REX => 'k', /\Atail\z/ => 'a' }
184
+ TRANSLATORS = { STACK_REX => 'k', /\Atail\z/ => 'a' }.freeze
185
185
 
186
186
  MORDERS = {
187
- 'f' => :first, 'l' => :last, /[tnh]/ => :north, /[bsa]/ => :south }
187
+ 'f' => :first, 'l' => :last, /[tnh]/ => :north, /[bsa]/ => :south }.freeze
188
188
  MMERGERS = {
189
189
  'd' => :deep, /[mp]/ => :mix, 'o' => :override, 'i' => :ignore,
190
- 'k' => :stack }
190
+ 'k' => :stack }.freeze
191
191
 
192
192
  def default_merger
193
193
 
@@ -227,6 +227,9 @@ module Flor
227
227
  @last_queued_message_id =
228
228
  @storage.put_message(message)
229
229
 
230
+ # Nota bene:
231
+ # the #wait method is added to the Scheduler by Flor::WaitList
232
+
230
233
  if opts[:wait]
231
234
  wait(message['exid'], opts)
232
235
  else
@@ -822,8 +822,9 @@ module Flor
822
822
  fail ArgumentError.new("no 'sto_uri' conf, cannot connect to db") \
823
823
  unless uri
824
824
 
825
- #uri = uri.to_s
826
- #return Kernel.const_get(uri) if uri.match(/\A[A-Z]+\z/)
825
+ return Kernel.const_get(uri) \
826
+ if uri.is_a?(String) && uri.match(/\A[A-Z]+\z/)
827
+ # for cases where uri == 'DB'
827
828
 
828
829
  Sequel.connect(uri)
829
830
  end
@@ -23,7 +23,7 @@ module Flor
23
23
  @executor = nil
24
24
  end
25
25
 
26
- ROW_PSEUDO_POINTS = %w[ status tag tasker var variable ]
26
+ ROW_PSEUDO_POINTS = %w[ status tag tasker var variable ].freeze
27
27
  # "tasker", not "task", since "task" is already a message point
28
28
 
29
29
  def row_waiter?
@@ -247,15 +247,7 @@ module Flor
247
247
  end
248
248
  end
249
249
 
250
- WAIT_REX =
251
- %r{
252
- \A
253
- ([0-9_\-]+)?[ ]*
254
- (
255
- [a-z]+(?::[^:|;,\s]+){0,2}
256
- (?:[|, ][a-z]+(:[^:|;,\s]+){0,2})*
257
- )\z
258
- }x
250
+ PT_REX = /[a-z]+(?::[^:|,\s]+){0,2}/.freeze
259
251
 
260
252
  def parse_serie(s)
261
253
 
@@ -263,11 +255,23 @@ module Flor
263
255
 
264
256
  (s.is_a?(String) ? s.split(';') : s)
265
257
  .collect { |ss|
266
- m = ss.strip.match(WAIT_REX)
258
+
259
+ k = StringScanner.new(ss.strip)
260
+
261
+ ni = k.scan(Flor::START_NID_REX)
262
+
263
+ k.scan(/\s*/)
264
+
265
+ pts = []; loop do
266
+ pt = k.scan(PT_REX); break unless pt
267
+ pts << pt
268
+ k.scan(/\s*[|,]\s*/)
269
+ end
270
+
267
271
  fail ArgumentError.new(
268
- "cannot parse #{ss.strip.inspect} wait directive") unless m
269
- ni, pt = m[1, 2]
270
- [ ni, pt.split(/[|,]/).collect(&:strip) ] }
272
+ "cannot parse #{ss.strip.inspect} wait directive") unless k.eos?
273
+
274
+ [ ni, pts ] }
271
275
  end
272
276
  end
273
277
  end
@@ -12,6 +12,15 @@ module Flor
12
12
  # `wtl_row_frequency`:
13
13
  # sleep time between row waiter checks, defaults to 1
14
14
 
15
+ # Regular waiters are message waiters, they wait for a message
16
+ # that matches a pattern
17
+ #
18
+ # Row waiters are waiting for the pattern to realize in the database
19
+ # a better name would probably have been "query waiter".
20
+ # Row waiters need their own thread for checking at interval.
21
+ # Row waiters can live in a different Ruby process from the Ruby process
22
+ # performing the executions.
23
+
15
24
  DEFAULT_TIMEOUT = Flor.env_i('FLOR_DEFAULT_TIMEOUT')
16
25
 
17
26
  def initialize(unit)
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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-22 00:00:00.000000000 Z
11
+ date: 2020-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: munemo