Class: Legion::Gaia::Registry
- Inherits:
-
Object
- Object
- Legion::Gaia::Registry
- Includes:
- 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.
12 13 14 |
# File 'lib/legion/gaia/registry.rb', line 12 def initialize reset! end |
Instance Attribute Details
#discovery ⇒ Object (readonly)
Returns the value of attribute discovery.
10 11 12 |
# File 'lib/legion/gaia/registry.rb', line 10 def discovery @discovery end |
#phase_handlers ⇒ Object (readonly)
Returns the value of attribute phase_handlers.
10 11 12 |
# File 'lib/legion/gaia/registry.rb', line 10 def phase_handlers @phase_handlers end |
#runner_instances ⇒ Object (readonly)
Returns the value of attribute runner_instances.
10 11 12 |
# File 'lib/legion/gaia/registry.rb', line 10 def runner_instances @runner_instances end |
Instance Method Details
#discover ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/legion/gaia/registry.rb', line 23 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
43 44 45 |
# File 'lib/legion/gaia/registry.rb', line 43 def ensure_wired discover unless @discovered end |
#loaded_count ⇒ Object
51 52 53 |
# File 'lib/legion/gaia/registry.rb', line 51 def loaded_count @discovery.count { |_, v| v[:loaded] } end |
#phase_list ⇒ Object
63 64 65 |
# File 'lib/legion/gaia/registry.rb', line 63 def phase_list @phase_handlers.keys end |
#rediscover ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/legion/gaia/registry.rb', line 33 def rediscover @runner_instances = {} @phase_handlers = {} @discovery = {} @discovered = false discover { rediscovered: true, wired_phases: wired_count, phase_list: phase_list } end |
#reset! ⇒ Object
16 17 18 19 20 21 |
# File 'lib/legion/gaia/registry.rb', line 16 def reset! @runner_instances = {} @phase_handlers = {} @discovery = {} @discovered = false end |
#tick_host ⇒ Object
47 48 49 |
# File 'lib/legion/gaia/registry.rb', line 47 def tick_host @runner_instances[:Tick_Orchestrator] end |
#total_count ⇒ Object
55 56 57 |
# File 'lib/legion/gaia/registry.rb', line 55 def total_count @discovery.size end |
#wired_count ⇒ Object
59 60 61 |
# File 'lib/legion/gaia/registry.rb', line 59 def wired_count @phase_handlers.size end |