Module: RRRSpec::ActiveTaskset
- Defined in:
- lib/rrrspec/redis_models.rb
Constant Summary collapse
- ACTIVE_TASKSET_KEY =
'rrrspec:active_taskset'
Class Method Summary collapse
-
.add(taskset) ⇒ Object
Public: Add the taskset to the active tasksets.
-
.all_tasksets_of(rsync_name) ⇒ Object
Public: Returns an array of the active tasksets whose rsync name is specified one.
-
.list ⇒ Object
Public: Returns an array of the active tasksets.
-
.remove(taskset) ⇒ Object
Public: Remove the taskset from the active tasksets.
Class Method Details
.add(taskset) ⇒ Object
Public: Add the taskset to the active tasksets
150 151 152 |
# File 'lib/rrrspec/redis_models.rb', line 150 def self.add(taskset) RRRSpec.redis.rpush(ACTIVE_TASKSET_KEY, taskset.key) end |
.all_tasksets_of(rsync_name) ⇒ Object
Public: Returns an array of the active tasksets whose rsync name is specified one.
168 169 170 |
# File 'lib/rrrspec/redis_models.rb', line 168 def self.all_tasksets_of(rsync_name) list.select { |taskset| taskset.rsync_name == rsync_name } end |
.list ⇒ Object
Public: Returns an array of the active tasksets.
160 161 162 163 164 |
# File 'lib/rrrspec/redis_models.rb', line 160 def self.list RRRSpec.redis.lrange(ACTIVE_TASKSET_KEY, 0, -1).map do |key| Taskset.new(key) end end |
.remove(taskset) ⇒ Object
Public: Remove the taskset from the active tasksets
155 156 157 |
# File 'lib/rrrspec/redis_models.rb', line 155 def self.remove(taskset) RRRSpec.redis.lrem(ACTIVE_TASKSET_KEY, 0, taskset.key) end |