Class: Rinda::TupleSpaceProxy
- Inherits:
-
Object
- Object
- Rinda::TupleSpaceProxy
- Defined in:
- lib/rinda/rinda.rb
Overview
TupleSpaceProxy allows a remote Tuplespace to appear as local.
Instance Method Summary collapse
-
#initialize(ts) ⇒ TupleSpaceProxy
constructor
Creates a new TupleSpaceProxy to wrap
ts
. -
#notify(ev, tuple, sec = nil) ⇒ Object
Registers for notifications of event
ev
on the proxied TupleSpace. -
#read(tuple, sec = nil, &block) ⇒ Object
Reads
tuple
from the proxied TupleSpace. -
#read_all(tuple) ⇒ Object
Reads all tuples matching
tuple
from the proxied TupleSpace. -
#take(tuple, sec = nil, &block) ⇒ Object
Takes
tuple
from the proxied TupleSpace. -
#write(tuple, sec = nil) ⇒ Object
Adds
tuple
to the proxied TupleSpace.
Constructor Details
#initialize(ts) ⇒ TupleSpaceProxy
Creates a new TupleSpaceProxy to wrap ts
.
213 214 215 |
# File 'lib/rinda/rinda.rb', line 213 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
252 253 254 |
# File 'lib/rinda/rinda.rb', line 252 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.
236 237 238 |
# File 'lib/rinda/rinda.rb', line 236 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.
244 245 246 |
# File 'lib/rinda/rinda.rb', line 244 def read_all(tuple) @ts.read_all(tuple) end |
#take(tuple, sec = nil, &block) ⇒ Object
Takes tuple
from the proxied TupleSpace. See TupleSpace#take.
227 228 229 230 231 |
# File 'lib/rinda/rinda.rb', line 227 def take(tuple, sec=nil, &block) port = [] @ts.move(DRbObject.new(port), tuple, sec, &block) port[0] end |
#write(tuple, sec = nil) ⇒ Object
Adds tuple
to the proxied TupleSpace. See TupleSpace#write.
220 221 222 |
# File 'lib/rinda/rinda.rb', line 220 def write(tuple, sec=nil) @ts.write(tuple, sec) end |