Class: Carnivore::Supervisor
- Inherits:
-
Celluloid::SupervisionGroup
- Object
- Celluloid::SupervisionGroup
- Carnivore::Supervisor
- Defined in:
- lib/carnivore/supervisor.rb
Instance Attribute Summary (collapse)
- - (Celluloid::Registry) registry readonly
Class Method Summary (collapse)
-
+ (Carinvore::Supervisor) build!
Build a new supervisor.
-
+ (Array<[Celluloid::Registry, Carnivore::Supervisor]>) create!
Create a new supervisor.
-
+ (Celluloid::Registry, NilClass) registry
Get the registry of the default supervisor.
-
+ (Carnivore::Supervisor) supervisor(sup = nil)
Get/set the default supervisor.
-
+ (TrueClass) terminate!
Destroy the registered default supervisor.
Instance Method Summary (collapse)
-
- (Celluloid::Actor, NilClass) [](k)
Fetch actor from registry.
Instance Attribute Details
- (Celluloid::Registry) registry (readonly)
64 65 66 |
# File 'lib/carnivore/supervisor.rb', line 64 def registry @registry end |
Class Method Details
+ (Carinvore::Supervisor) build!
Build a new supervisor
12 13 14 15 |
# File 'lib/carnivore/supervisor.rb', line 12 def build! _, s = create! supervisor(s) end |
+ (Array<[Celluloid::Registry, Carnivore::Supervisor]>) create!
Create a new supervisor
20 21 22 23 |
# File 'lib/carnivore/supervisor.rb', line 20 def create! registry = Celluloid::Registry.new [registry, run!(registry)] end |
+ (Celluloid::Registry, NilClass) registry
Get the registry of the default supervisor
39 40 41 42 43 |
# File 'lib/carnivore/supervisor.rb', line 39 def registry if(supervisor) supervisor.registry end end |
+ (Carnivore::Supervisor) supervisor(sup = nil)
Get/set the default supervisor
29 30 31 32 33 34 |
# File 'lib/carnivore/supervisor.rb', line 29 def supervisor(sup=nil) if(sup) Celluloid::Actor[:carnivore_supervisor] = sup end Celluloid::Actor[:carnivore_supervisor] end |
+ (TrueClass) terminate!
Destroy the registered default supervisor
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/carnivore/supervisor.rb', line 48 def terminate! if(supervisor) begin supervisor.terminate rescue Celluloid::DeadActorError => e Celluloid::Logger.warn "Default supervisor is already in dead state (#{e.class}: #{e})" end @supervisor = nil @registry = nil end true end |
Instance Method Details
- (Celluloid::Actor, NilClass) [](k)
Fetch actor from registry
70 71 72 |
# File 'lib/carnivore/supervisor.rb', line 70 def [](k) registry[k] end |