1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
parent bff692b94d
commit 59ca946543
3 changed files with 27 additions and 24 deletions

View file

@ -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.

View file

@ -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
View 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