Class: Legion::Gaia::Registry
- Inherits:
-
Object
- Object
- Legion::Gaia::Registry
- Defined in:
- lib/legion/gaia/registry.rb
Instance Attribute Summary collapse
-
#discovery ⇒ Object
readonly
Returns the value of attribute discovery.
-
#phase_handlers ⇒ Object
readonly
Returns the value of attribute phase_handlers.
-
#runner_instances ⇒ Object
readonly
Returns the value of attribute runner_instances.
Instance Method Summary collapse
- #discover ⇒ Object
- #ensure_wired ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #loaded_count ⇒ Object
- #phase_list ⇒ Object
- #rediscover ⇒ Object
- #tick_host ⇒ Object
- #total_count ⇒ Object
- #wired_count ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
8 9 10 11 12 13 |
# File 'lib/legion/gaia/registry.rb', line 8 def initialize @runner_instances = {} @phase_handlers = {} @discovery = {} @discovered = false end |
Instance Attribute Details
#discovery ⇒ Object (readonly)
Returns the value of attribute discovery.
6 7 8 |
# File 'lib/legion/gaia/registry.rb', line 6 def discovery @discovery end |
#phase_handlers ⇒ Object (readonly)
Returns the value of attribute phase_handlers.
6 7 8 |
# File 'lib/legion/gaia/registry.rb', line 6 def phase_handlers @phase_handlers end |
#runner_instances ⇒ Object (readonly)
Returns the value of attribute runner_instances.
6 7 8 |
# File 'lib/legion/gaia/registry.rb', line 6 def runner_instances @runner_instances end |
Instance Method Details
#discover ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/legion/gaia/registry.rb', line 15 def discover @runner_instances = build_runner_instances @phase_handlers = PhaseWiring.build_phase_handlers(@runner_instances) @discovery = PhaseWiring.discover_available_extensions @discovered = true log_info "[gaia:registry] discovered: #{loaded_count}/#{total_count} extensions, " \ "#{wired_count} phases wired" end |
#ensure_wired ⇒ Object
35 36 37 |
# File 'lib/legion/gaia/registry.rb', line 35 def ensure_wired discover unless @discovered end |
#loaded_count ⇒ Object
43 44 45 |
# File 'lib/legion/gaia/registry.rb', line 43 def loaded_count @discovery.count { |_, v| v[:loaded] } end |
#phase_list ⇒ Object
55 56 57 |
# File 'lib/legion/gaia/registry.rb', line 55 def phase_list @phase_handlers.keys end |
#rediscover ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/legion/gaia/registry.rb', line 25 def rediscover @runner_instances = {} @phase_handlers = {} @discovery = {} @discovered = false discover { rediscovered: true, wired_phases: wired_count, phase_list: phase_list } end |
#tick_host ⇒ Object
39 40 41 |
# File 'lib/legion/gaia/registry.rb', line 39 def tick_host @runner_instances[:Tick_Orchestrator] end |
#total_count ⇒ Object
47 48 49 |
# File 'lib/legion/gaia/registry.rb', line 47 def total_count @discovery.size end |
#wired_count ⇒ Object
51 52 53 |
# File 'lib/legion/gaia/registry.rb', line 51 def wired_count @phase_handlers.size end |