Class: Geary::Manager
- Inherits:
-
Object
- Object
- Geary::Manager
- Includes:
- Celluloid
- Defined in:
- lib/geary/manager.rb
Constant Summary collapse
- UnexpectedRestart =
Class.new(Error)
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#performers ⇒ Object
readonly
Returns the value of attribute performers.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Manager
constructor
A new instance of Manager.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Manager
Returns a new instance of Manager.
15 16 17 18 19 20 21 |
# File 'lib/geary/manager.rb', line 15 def initialize( = {}) @configuration = .fetch(:configuration) @performer_type = .fetch(:performer_type, Performer) @performers = [] @crashes = [] @server_addresses_by_performer = {} end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
11 12 13 |
# File 'lib/geary/manager.rb', line 11 def configuration @configuration end |
#performers ⇒ Object (readonly)
Returns the value of attribute performers.
11 12 13 |
# File 'lib/geary/manager.rb', line 11 def performers @performers end |
Instance Method Details
#start ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/geary/manager.rb', line 23 def start async.monitor_crashes configuration.server_addresses.each do |server_address| configuration.concurrency.times do start_performer(server_address) end end end |
#stop ⇒ Object
33 34 35 36 37 |
# File 'lib/geary/manager.rb', line 33 def stop @performers.select(&:alive?).each(&:terminate) after(0) { signal(:done) } end |