W3cubDocs

/Ruby 2.4

class Rinda::RingProvider

Parent:
Object

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].

Public Class Methods

new(klass, front, desc, renewer = nil) Show source

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

# File lib/rinda/ring.rb, line 465
def initialize(klass, front, desc, renewer = nil)
  @tuple = [:name, klass, front, desc]
  @renewer = renewer || Rinda::SimpleRenewer.new
end

Public Instance Methods

provide() Show source

Advertises this service on the primary remote TupleSpace.

# File lib/rinda/ring.rb, line 473
def provide
  ts = Rinda::RingFinger.primary
  ts.write(@tuple, @renewer)
end

Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.