* lib/rinda/ring.rb: split executable code into sample directory.

* sample/rinda-ring.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2014-08-21 04:23:56 +00:00
Родитель bff692b94d
Коммит 59ca946543
3 изменённых файлов: 27 добавлений и 24 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu Aug 21 13:23:34 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* lib/rinda/ring.rb: split executable code into sample directory.
* sample/rinda-ring.rb: ditto.
Thu Aug 21 13:21:45 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* lib/drb/acl.rb: split executable code into sample directory.

Просмотреть файл

@ -478,27 +478,3 @@ module Rinda
end
end
if __FILE__ == $0
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
end

22
sample/rinda-ring.rb Normal file
Просмотреть файл

@ -0,0 +1,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