summaryrefslogtreecommitdiff
path: root/jni/ruby/sample/drb/ring_inspect.rb
blob: c096cd7034932b70bc7a760eb341cc7ede43465b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'rinda/ring'
require 'drb/drb'

class Inspector
  def initialize
  end

  def primary
    Rinda::RingFinger.primary
  end

  def list_place
    Rinda::RingFinger.to_a
  end

  def list(idx = -1)
    if idx < 0
      ts = primary
    else
      ts = list_place[idx]
      raise "RingNotFound" unless ts
    end
    ts.read_all([:name, nil, nil, nil])
  end
end

def main
  DRb.start_service
  r = Inspector.new
end