Class: BlueGreenProcess::WorkerProcess
- Inherits:
 - 
      Object
      
        
- Object
 - BlueGreenProcess::WorkerProcess
 
 
- Defined in:
 - lib/blue_green_process/worker_process.rb
 
Instance Attribute Summary collapse
- 
  
    
      #label  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute label.
 - 
  
    
      #pid  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute pid.
 - 
  
    
      #rpipe  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute rpipe.
 - 
  
    
      #status  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute status.
 - 
  
    
      #wpipe  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute wpipe.
 
Instance Method Summary collapse
- #be_active ⇒ Object
 - #be_inactive ⇒ Object
 - 
  
    
      #initialize(pid, label, rpipe, wpipe)  ⇒ WorkerProcess 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of WorkerProcess.
 - #shutdown ⇒ Object
 - #work ⇒ Object
 
Constructor Details
#initialize(pid, label, rpipe, wpipe) ⇒ WorkerProcess
Returns a new instance of WorkerProcess.
      7 8 9 10 11 12 13  | 
    
      # File 'lib/blue_green_process/worker_process.rb', line 7 def initialize(pid, label, rpipe, wpipe) self.pid = pid self.label = label self.rpipe = rpipe self.wpipe = wpipe self.status = BlueGreenProcess::PROCESS_STATUS_INACTIVE end  | 
  
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
      5 6 7  | 
    
      # File 'lib/blue_green_process/worker_process.rb', line 5 def label @label end  | 
  
#pid ⇒ Object
Returns the value of attribute pid.
      5 6 7  | 
    
      # File 'lib/blue_green_process/worker_process.rb', line 5 def pid @pid end  | 
  
#rpipe ⇒ Object
Returns the value of attribute rpipe.
      5 6 7  | 
    
      # File 'lib/blue_green_process/worker_process.rb', line 5 def rpipe @rpipe end  | 
  
#status ⇒ Object
Returns the value of attribute status.
      5 6 7  | 
    
      # File 'lib/blue_green_process/worker_process.rb', line 5 def status @status end  | 
  
#wpipe ⇒ Object
Returns the value of attribute wpipe.
      5 6 7  | 
    
      # File 'lib/blue_green_process/worker_process.rb', line 5 def wpipe @wpipe end  | 
  
Instance Method Details
#be_active ⇒ Object
      15 16 17 18 19 20 21 22  | 
    
      # File 'lib/blue_green_process/worker_process.rb', line 15 def be_active return self if status == BlueGreenProcess::PROCESS_STATUS_ACTIVE write_and_await_until_read(BlueGreenProcess::PROCESS_COMMAND_BE_ACTIVE, { data: BlueGreenProcess::SharedVariable.data }) self.status = BlueGreenProcess::PROCESS_STATUS_ACTIVE self end  | 
  
#be_inactive ⇒ Object
      24 25 26 27 28 29 30  | 
    
      # File 'lib/blue_green_process/worker_process.rb', line 24 def be_inactive return self if status == BlueGreenProcess::PROCESS_STATUS_INACTIVE write_and_await_until_read(BlueGreenProcess::PROCESS_COMMAND_BE_INACTIVE) self.status = BlueGreenProcess::PROCESS_STATUS_INACTIVE self end  | 
  
#shutdown ⇒ Object
      38 39 40  | 
    
      # File 'lib/blue_green_process/worker_process.rb', line 38 def shutdown write(BlueGreenProcess::PROCESS_COMMAND_DIE) end  | 
  
#work ⇒ Object
      32 33 34 35 36  | 
    
      # File 'lib/blue_green_process/worker_process.rb', line 32 def work enforce_to_be_active write_and_await_until_read(BlueGreenProcess::PROCESS_COMMAND_WORK) end  |