Class: DHT::Service
- Inherits:
-
Object
- Object
- DHT::Service
- Defined in:
- lib/dht/service.rb
Instance Method Summary collapse
- #create_explorer ⇒ Object
- #create_manager ⇒ Object
- #create_storage ⇒ Object
-
#initialize(options = {}) ⇒ Service
constructor
A new instance of Service.
- #run ⇒ Object
- #run_services ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Service
Returns a new instance of Service.
3 4 5 6 |
# File 'lib/dht/service.rb', line 3 def initialize( = {}) @explorer = .delete(:explorer) @key = .delete(:key) end |
Instance Method Details
#create_explorer ⇒ Object
18 19 20 |
# File 'lib/dht/service.rb', line 18 def create_explorer DCell::Explorer.new("127.0.0.1", 8000) end |
#create_manager ⇒ Object
26 27 28 |
# File 'lib/dht/service.rb', line 26 def create_manager DHT::Manager.supervise_as :manager end |
#create_storage ⇒ Object
22 23 24 |
# File 'lib/dht/service.rb', line 22 def create_storage DHT::Storage.supervise_as :storage, @key end |
#run ⇒ Object
8 9 10 |
# File 'lib/dht/service.rb', line 8 def run run_services end |
#run_services ⇒ Object
12 13 14 15 16 |
# File 'lib/dht/service.rb', line 12 def run_services create_explorer if enable_explorer? create_storage create_manager end |