lib/dcell.rb in dcell-0.7.1 vs lib/dcell.rb in dcell-0.8.0
- old
+ new
@@ -8,20 +8,21 @@
require 'dcell/messages'
require 'dcell/node'
require 'dcell/global'
require 'dcell/responses'
require 'dcell/router'
+require 'dcell/rpc'
require 'dcell/server'
require 'dcell/registries/redis_adapter'
-require 'dcell/application'
require 'dcell/celluloid_ext'
# Distributed Celluloid
module DCell
DEFAULT_PORT = 7777 # Default DCell port
ZMQ_POOL_SIZE = 1 # DCell uses a fixed-size 0MQ thread pool
+
@zmq_context = Celluloid::ZMQ.context = ::ZMQ::Context.new(ZMQ_POOL_SIZE)
@config_lock = Mutex.new
class << self
attr_reader :me, :registry, :zmq_context
@@ -76,20 +77,25 @@
`hostname`.strip # Super creative I know
end
# Run the DCell application
def run
- DCell::Application.run
+ DCell::Group.run
end
# Run the DCell application in the background
def run!
- DCell::Application.run!
+ DCell::Group.run!
end
# Start combines setup and run! into a single step
def start(options = {})
setup options
run!
end
+ end
+
+ # DCell's actor dependencies
+ class Group < Celluloid::Group
+ supervise Server, :as => :dcell_server
end
end