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
118 119 120 |
# File 'lib/rrrspec/redis_models.rb', line 118 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.
136 137 138 |
# File 'lib/rrrspec/redis_models.rb', line 136 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.
128 129 130 131 132 |
# File 'lib/rrrspec/redis_models.rb', line 128 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
123 124 125 |
# File 'lib/rrrspec/redis_models.rb', line 123 def self.remove(taskset) RRRSpec.redis.lrem(ACTIVE_TASKSET_KEY, 0, taskset.key) end |