Class: Omnizip::Parallel::JobQueue::Job
- Inherits:
-
Struct
- Object
- Struct
- Omnizip::Parallel::JobQueue::Job
- Defined in:
- lib/omnizip/parallel/job_queue.rb
Overview
Job structure for queue items
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#file ⇒ Object
Returns the value of attribute file.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data
19 20 21 |
# File 'lib/omnizip/parallel/job_queue.rb', line 19 def data @data end |
#file ⇒ Object
Returns the value of attribute file
19 20 21 |
# File 'lib/omnizip/parallel/job_queue.rb', line 19 def file @file end |
#metadata ⇒ Object
Returns the value of attribute metadata
19 20 21 |
# File 'lib/omnizip/parallel/job_queue.rb', line 19 def @metadata end |
#priority ⇒ Object
Returns the value of attribute priority
19 20 21 |
# File 'lib/omnizip/parallel/job_queue.rb', line 19 def priority @priority end |
#size ⇒ Object
Returns the value of attribute size
19 20 21 |
# File 'lib/omnizip/parallel/job_queue.rb', line 19 def size @size end |
Instance Method Details
#<=>(other) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/omnizip/parallel/job_queue.rb', line 21 def <=>(other) # Higher priority first, then larger files first priority_order = { high: 0, normal: 1, low: 2 } priority_cmp = (priority_order[priority] || 1) <=> (priority_order[other.priority] || 1) return priority_cmp unless priority_cmp.zero? # If same priority, larger files first -(size <=> other.size) end |