Class: Rinda::RingProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/rinda2/ring.rb

Overview

RingProvider uses a RingServer advertised TupleSpace as a name service. TupleSpace clients can register themselves with the remote TupleSpace and look up other provided services via the remote TupleSpace.

Services are registered with a tuple of the format [:name, klass, DRbObject, description].

Instance Method Summary collapse

Constructor Details

#initialize(klass, front, desc, renewer = nil) ⇒ RingProvider

Creates a RingProvider that will provide a klass service running on front, with a description. renewer is optional.



34
35
36
37
# File 'lib/rinda2/ring.rb', line 34

def initialize(klass, front, desc, renewer = nil)
  @tuple = [:name, klass, front, desc]
  @renewer = renewer || Rinda::SimpleRenewer.new
end

Instance Method Details

#provide(addresses) ⇒ Object

Advertises this service on the primary remote TupleSpace.



42
43
44
45
# File 'lib/rinda2/ring.rb', line 42

def provide (addresses)
  ts = Rinda::RingFinger.new(addresses).each.first
  ts.write(@tuple, @renewer)
end