summaryrefslogtreecommitdiff
path: root/sample/rinda-ring.rb
blob: f9bd9340294495f5c8cc865b39cd14122af80296 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'rinda/ring'

DRb.start_service
case ARGV.shift
when 's'
  require 'rinda/tuplespace'
  ts = Rinda::TupleSpace.new
  Rinda::RingServer.new(ts)
  $stdin.gets
when 'w'
  finger = Rinda::RingFinger.new(nil)
  finger.lookup_ring do |ts2|
    p ts2
    ts2.write([:hello, :world])
  end
when 'r'
  finger = Rinda::RingFinger.new(nil)
  finger.lookup_ring do |ts2|
    p ts2
    p ts2.take([nil, nil])
  end
end