Module: Mack::Distributed::Utils::Rinda
- Defined in:
- lib/mack-distributed/utils/rinda.rb
Class Method Summary collapse
- .read(options = {}) ⇒ Object
- .register(options = {}) ⇒ Object
- .register_or_renew(options = {}) ⇒ Object
- .ring_server ⇒ Object
Class Method Details
.read(options = {}) ⇒ Object
35 36 37 38 |
# File 'lib/mack-distributed/utils/rinda.rb', line 35 def self.read( = {}) = () ring_server.read([[:space], [:klass_def], nil, [:description]], [:timeout])[2] end |
.register(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/mack-distributed/utils/rinda.rb', line 16 def self.register( = {}) = () ring_server.write([[:space], [:klass_def], [:object], [:description]], ::Rinda::SimpleRenewer.new) end |
.register_or_renew(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/mack-distributed/utils/rinda.rb', line 6 def self.register_or_renew( = {}) = () begin ring_server.take([[:space], [:klass_def], nil, nil], [:timeout]) rescue Exception => e # Mack.logger.error(e) end register() end |
.ring_server ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/mack-distributed/utils/rinda.rb', line 25 def self.ring_server if configatron.mack.distributed.retrieve(:acl, nil) acl = ACL.new(configatron.mack.distributed.acl) DRb.install_acl(acl) end ::DRb.start_service rs = ::Rinda::RingFinger.primary rs end |