Module: Mack::Distributed
- Defined in:
- lib/mack-distributed/distributed.rb,
lib/mack-distributed/views/view.rb,
lib/mack-distributed/routes/urls.rb,
lib/mack-distributed/utils/rinda.rb,
lib/mack-distributed/errors/errors.rb,
lib/mack-distributed/views/view_cache.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Errors, Routes, Utils Classes: View, ViewCache
Class Method Summary collapse
-
.const_missing(const) ⇒ Object
Looks up and tries to find the missing constant using the ring server.
-
.lookup(address) ⇒ Object
Allows for the specific lookup of services on the ring server.
Class Method Details
.const_missing(const) ⇒ Object
Looks up and tries to find the missing constant using the ring server.
5 6 7 |
# File 'lib/mack-distributed/distributed.rb', line 5 def self.const_missing(const) Mack::Distributed::Utils::Rinda.read(:klass_def => "#{const}".to_sym) end |
.lookup(address) ⇒ Object
Allows for the specific lookup of services on the ring server
Examples:
Mack::Distributed::Utils::Rinda.register_or_renew(:space => :app_1, :klass_def => :Test, :object => "Hello World!")
Mack::Distributed::Utils::Rinda.register_or_renew(:space => :app_2, :klass_def => :Test, :object => "Hello WORLD!")
Mack::Distributed.lookup("distributed://app_1/Test") # => "Hello World!"
Mack::Distributed.lookup("distributed://app_2/Test") # => "Hello WORLD!"
16 17 18 19 20 21 |
# File 'lib/mack-distributed/distributed.rb', line 16 def self.lookup(address) uri = Addressable::URI.parse(address) path = uri.path[1..uri.path.size] # remove the first slash host = uri.host Mack::Distributed::Utils::Rinda.read(:klass_def => path.to_sym, :space => host.to_sym) end |