lib/redis_ring/application.rb in redis_ring-0.0.1 vs lib/redis_ring/application.rb in redis_ring-0.0.2
- old
+ new
@@ -1,13 +1,14 @@
module RedisRing
class Application
- attr_reader :shards, :configuration
+ attr_reader :shards, :configuration, :process_manager
def initialize(configuration)
@configuration = configuration
+ @process_manager = ProcessManager.new
@shards = {}
end
def start
self.stop
@@ -16,17 +17,22 @@
shard_conf = ShardConfig.new(shard_number, configuration)
@shards[shard_number] = Shard.new(shard_conf)
end
@shards.each do |shard_no, shard|
- shard.start
+ @process_manager.start_shard(shard)
end
+
+ @process_manager.run
end
def stop
+ @process_manager.halt
+
@shards.each do |shard_no, shard|
- shard.stop
+ @process_manager.stop_shard(shard)
end
+
@shards = {}
end
def shards_hash
shards_hash = {}