Class: Rinda::TupleSpaceProxy

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

Overview

TupleSpaceProxy allows a remote Tuplespace to appear as local.

Defined Under Namespace

Classes: Port

Instance Method Summary collapse

Constructor Details

#initialize(ts) ⇒ TupleSpaceProxy

Creates a new TupleSpaceProxy to wrap ts.



259
260
261
# File 'lib/rinda/rinda.rb', line 259

def initialize(ts)
  @ts = ts
end

Instance Method Details

#notify(ev, tuple, sec = nil) ⇒ Object

Registers for notifications of event ev on the proxied TupleSpace. See TupleSpace#notify



298
299
300
# File 'lib/rinda/rinda.rb', line 298

def notify(ev, tuple, sec=nil)
  @ts.notify(ev, tuple, sec)
end

#read(tuple, sec = nil, &block) ⇒ Object

Reads tuple from the proxied TupleSpace. See TupleSpace#read.



282
283
284
# File 'lib/rinda/rinda.rb', line 282

def read(tuple, sec=nil, &block)
  @ts.read(tuple, sec, &block)
end

#read_all(tuple) ⇒ Object

Reads all tuples matching tuple from the proxied TupleSpace. See TupleSpace#read_all.



290
291
292
# File 'lib/rinda/rinda.rb', line 290

def read_all(tuple)
  @ts.read_all(tuple)
end

#take(tuple, sec = nil, &block) ⇒ Object

Takes tuple from the proxied TupleSpace. See TupleSpace#take.



273
274
275
276
277
# File 'lib/rinda/rinda.rb', line 273

def take(tuple, sec=nil, &block)
  Port.deliver do |port|
    @ts.move(DRbObject.new(port), tuple, sec, &block)
  end
end

#write(tuple, sec = nil) ⇒ Object

Adds tuple to the proxied TupleSpace. See TupleSpace#write.



266
267
268
# File 'lib/rinda/rinda.rb', line 266

def write(tuple, sec=nil)
  @ts.write(tuple, sec)
end