Class: Legion::Gaia::Registry
- Inherits:
-
Object
- Object
- Legion::Gaia::Registry
- Includes:
- Logging::Helper, Singleton
- 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
- #reset! ⇒ Object
- #tick_host ⇒ Object
- #total_count ⇒ Object
- #wired_count ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
14 15 16 |
# File 'lib/legion/gaia/registry.rb', line 14 def initialize reset! end |
Instance Attribute Details
#discovery ⇒ Object (readonly)
Returns the value of attribute discovery.
12 13 14 |
# File 'lib/legion/gaia/registry.rb', line 12 def discovery @discovery end |
#phase_handlers ⇒ Object (readonly)
Returns the value of attribute phase_handlers.
12 13 14 |
# File 'lib/legion/gaia/registry.rb', line 12 def phase_handlers @phase_handlers end |
#runner_instances ⇒ Object (readonly)
Returns the value of attribute runner_instances.
12 13 14 |
# File 'lib/legion/gaia/registry.rb', line 12 def runner_instances @runner_instances end |
Instance Method Details
#discover ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/legion/gaia/registry.rb', line 25 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
45 46 47 |
# File 'lib/legion/gaia/registry.rb', line 45 def ensure_wired discover unless @discovered end |
#loaded_count ⇒ Object
53 54 55 |
# File 'lib/legion/gaia/registry.rb', line 53 def loaded_count @discovery.count { |_, v| v[:loaded] } end |
#phase_list ⇒ Object
65 66 67 |
# File 'lib/legion/gaia/registry.rb', line 65 def phase_list @phase_handlers.keys end |
#rediscover ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/legion/gaia/registry.rb', line 35 def rediscover @runner_instances = {} @phase_handlers = {} @discovery = {} @discovered = false discover { rediscovered: true, wired_phases: wired_count, phase_list: phase_list } end |
#reset! ⇒ Object
18 19 20 21 22 23 |
# File 'lib/legion/gaia/registry.rb', line 18 def reset! @runner_instances = {} @phase_handlers = {} @discovery = {} @discovered = false end |
#tick_host ⇒ Object
49 50 51 |
# File 'lib/legion/gaia/registry.rb', line 49 def tick_host @runner_instances[:Tick_Orchestrator] end |
#total_count ⇒ Object
57 58 59 |
# File 'lib/legion/gaia/registry.rb', line 57 def total_count @discovery.size end |
#wired_count ⇒ Object
61 62 63 |
# File 'lib/legion/gaia/registry.rb', line 61 def wired_count @phase_handlers.size end |