evt-component_host 1.0.0.0 → 1.0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/component_host/controls.rb +5 -5
- data/lib/component_host/controls/{start_component.rb → component_initiator.rb} +3 -5
- data/lib/component_host/controls/{start_component → component_initiator}/actor_crashes.rb +1 -1
- data/lib/component_host/controls/{start_component → component_initiator}/raises_error.rb +1 -1
- data/lib/component_host/controls/{start_component → component_initiator}/runs_continuously.rb +1 -1
- data/lib/component_host/controls/{start_component → component_initiator}/stops_immediately.rb +1 -1
- data/lib/component_host/host.rb +21 -17
- data/lib/component_host/signal.rb +9 -11
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3383c3150e82b26d4bb0dc4b846203e5f8da3fc404b59d88fa79139cbed3afb3
|
4
|
+
data.tar.gz: c78b257d270dee532423d6e644755ce989ea1d0abf02b972a9dc8db2891c6dfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11fe81aa32920e04a008ebd1a71e2c02f1d44a7693f4787a67f0c7daacb3f02d568189eb6ae8790e2d765a0e74faf3007b2fa780a7f3239f58f002097ec0c444
|
7
|
+
data.tar.gz: 99850e528373263d14773d9574dd3fa98b77c2a01e37f7592bf3bd4e34436f636576d2ea633c74d7a78be62f989514bf07e0deead94076f5b807debb8ce35276
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'component_host/controls/error'
|
2
2
|
require 'component_host/controls/name'
|
3
|
-
require 'component_host/controls/
|
4
|
-
require 'component_host/controls/
|
5
|
-
require 'component_host/controls/
|
6
|
-
require 'component_host/controls/
|
7
|
-
require 'component_host/controls/
|
3
|
+
require 'component_host/controls/component_initiator'
|
4
|
+
require 'component_host/controls/component_initiator/actor_crashes'
|
5
|
+
require 'component_host/controls/component_initiator/raises_error'
|
6
|
+
require 'component_host/controls/component_initiator/runs_continuously'
|
7
|
+
require 'component_host/controls/component_initiator/stops_immediately'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module ComponentHost
|
2
2
|
module Controls
|
3
|
-
module
|
3
|
+
module ComponentInitiator
|
4
4
|
def self.example
|
5
5
|
Example.new
|
6
6
|
end
|
@@ -12,10 +12,8 @@ module ComponentHost
|
|
12
12
|
self.executed = true
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
executed ? true : false
|
18
|
-
end
|
15
|
+
def executed?
|
16
|
+
executed ? true : false
|
19
17
|
end
|
20
18
|
end
|
21
19
|
end
|
data/lib/component_host/host.rb
CHANGED
@@ -13,16 +13,16 @@ module ComponentHost
|
|
13
13
|
instance
|
14
14
|
end
|
15
15
|
|
16
|
-
def register(
|
17
|
-
|
16
|
+
def register(initiator, name=nil, &block)
|
17
|
+
initiator ||= proc { yield }
|
18
18
|
|
19
|
-
logger.trace { "Registering component (Component Initiator: #{
|
19
|
+
logger.trace { "Registering component (Component Initiator: #{initiator}, Name: #{name || '(none)'})" }
|
20
20
|
|
21
|
-
component = Component.new
|
21
|
+
component = Component.new initiator, name
|
22
22
|
|
23
23
|
components << component
|
24
24
|
|
25
|
-
logger.
|
25
|
+
logger.debug { "Registered component (Component Initiator: #{initiator}, Name: #{name || '(none)'})" }
|
26
26
|
|
27
27
|
component
|
28
28
|
end
|
@@ -31,7 +31,7 @@ module ComponentHost
|
|
31
31
|
record_errors_observer.record_error_proc = block
|
32
32
|
end
|
33
33
|
|
34
|
-
def start(&
|
34
|
+
def start(&probe)
|
35
35
|
started_components = []
|
36
36
|
|
37
37
|
Actor::Supervisor.start do |supervisor|
|
@@ -75,7 +75,7 @@ module ComponentHost
|
|
75
75
|
started_components << component
|
76
76
|
end
|
77
77
|
|
78
|
-
|
78
|
+
probe.(supervisor) if probe
|
79
79
|
end
|
80
80
|
|
81
81
|
started_components
|
@@ -83,7 +83,9 @@ module ComponentHost
|
|
83
83
|
|
84
84
|
def start_components(&block)
|
85
85
|
components.each do |component|
|
86
|
+
logger.info(tag: :*) { "Starting Component: #{component.initiator} (Name: #{component.name || '(none)'})" }
|
86
87
|
component.start
|
88
|
+
logger.info(tag: :*) { "Started Component: #{component.initiator} (Name: #{component.name || '(none)'})" }
|
87
89
|
|
88
90
|
block.(component) if block
|
89
91
|
end
|
@@ -106,19 +108,21 @@ module ComponentHost
|
|
106
108
|
@components ||= []
|
107
109
|
end
|
108
110
|
|
109
|
-
|
110
|
-
|
111
|
-
component_initiator.()
|
112
|
-
end
|
111
|
+
def abort
|
112
|
+
raise StopIteration
|
113
113
|
end
|
114
114
|
|
115
|
-
|
116
|
-
|
117
|
-
block ||= proc { true }
|
115
|
+
def registered?(&block)
|
116
|
+
block ||= proc { true }
|
118
117
|
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
components.any? do |component|
|
119
|
+
block.(component.initiator, component.name)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
Component = Struct.new :initiator, :name do
|
124
|
+
def start
|
125
|
+
initiator.()
|
122
126
|
end
|
123
127
|
end
|
124
128
|
end
|
@@ -16,7 +16,15 @@ module ComponentHost
|
|
16
16
|
handlers[signal] = handler
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def trapped?(signal=nil)
|
20
|
+
if signal.nil?
|
21
|
+
records.any?
|
22
|
+
else
|
23
|
+
records.any? { |record| record.signal == signal }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def send(signal)
|
20
28
|
handler = handlers[signal]
|
21
29
|
|
22
30
|
return if handler.nil?
|
@@ -37,16 +45,6 @@ module ComponentHost
|
|
37
45
|
end
|
38
46
|
|
39
47
|
Record = Struct.new :signal
|
40
|
-
|
41
|
-
module Assertions
|
42
|
-
def trapped?(signal=nil)
|
43
|
-
if signal.nil?
|
44
|
-
records.any?
|
45
|
-
else
|
46
|
-
records.any? { |record| record.signal == signal }
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
48
|
end
|
51
49
|
end
|
52
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-component_host
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Eventide Project
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ntl-actor
|
@@ -103,13 +103,13 @@ files:
|
|
103
103
|
- lib/component_host.rb
|
104
104
|
- lib/component_host/component_host.rb
|
105
105
|
- lib/component_host/controls.rb
|
106
|
+
- lib/component_host/controls/component_initiator.rb
|
107
|
+
- lib/component_host/controls/component_initiator/actor_crashes.rb
|
108
|
+
- lib/component_host/controls/component_initiator/raises_error.rb
|
109
|
+
- lib/component_host/controls/component_initiator/runs_continuously.rb
|
110
|
+
- lib/component_host/controls/component_initiator/stops_immediately.rb
|
106
111
|
- lib/component_host/controls/error.rb
|
107
112
|
- lib/component_host/controls/name.rb
|
108
|
-
- lib/component_host/controls/start_component.rb
|
109
|
-
- lib/component_host/controls/start_component/actor_crashes.rb
|
110
|
-
- lib/component_host/controls/start_component/raises_error.rb
|
111
|
-
- lib/component_host/controls/start_component/runs_continuously.rb
|
112
|
-
- lib/component_host/controls/start_component/stops_immediately.rb
|
113
113
|
- lib/component_host/host.rb
|
114
114
|
- lib/component_host/log.rb
|
115
115
|
- lib/component_host/signal.rb
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.7.
|
138
|
+
rubygems_version: 2.7.3
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Host components inside a single physical process
|