Class: Processors
- Inherits:
-
Object
- Object
- Processors
- Defined in:
- lib/processor/processor.rb
Overview
Processors is the list of Processors from which
a process can choose from.
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
Class Method Summary collapse
-
.get_random_processor(bucket) ⇒ Object
returns a random processor from the pool of processors.
-
.registered(bucket) ⇒ Object
returns an array of the available active processors.
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
11 12 13 |
# File 'lib/processor/processor.rb', line 11 def bucket @bucket end |
Class Method Details
.get_random_processor(bucket) ⇒ Object
returns a random processor from the pool of processors
25 26 27 28 29 |
# File 'lib/processor/processor.rb', line 25 def self.get_random_processor(bucket) processors = self.registered(bucket) return nil if processors.empty? processors[rand(processors.size)] end |
.registered(bucket) ⇒ Object
returns an array of the available active processors
14 15 16 17 18 19 20 21 22 |
# File 'lib/processor/processor.rb', line 14 def self.registered(bucket) @bucket = bucket processors = [] # get the list of servers that have registered themselves AWS::S3::Bucket.objects(@bucket).each {|o| processors << Processor.new(@bucket, o.key) } processors end |