* lib/rinda/tuplespace.rb (TupleSpace#create_entry, TupleBag#push,

delete): extract method, and rename parameter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
seki 2007-04-29 16:21:31 +00:00
parent dda4527478
commit 858e38c902
2 changed files with 18 additions and 9 deletions

View file

@ -1,3 +1,8 @@
Mon Apr 30 01:17:51 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/rinda/tuplespace.rb (TupleSpace#create_entry, TupleBag#push,
delete): extract method, and rename parameter.
Fri Apr 27 02:00:17 2007 Ryan Davis <ryand-ruby@zenspider.com> Fri Apr 27 02:00:17 2007 Ryan Davis <ryand-ruby@zenspider.com>
* signal.c: Fixed backwards compatibility for 'raise Interrupt'. * signal.c: Fixed backwards compatibility for 'raise Interrupt'.

View file

@ -304,20 +304,20 @@ module Rinda
end end
## ##
# Add +ary+ to the TupleBag. # Add +tuple+ to the TupleBag.
def push(ary) def push(tuple)
size = ary.size size = tuple.size
@hash[size] ||= [] @hash[size] ||= []
@hash[size].push(ary) @hash[size].push(tuple)
end end
## ##
# Removes +ary+ from the TupleBag. # Removes +tuple+ from the TupleBag.
def delete(ary) def delete(tuple)
size = ary.size size = tuple.size
@hash.fetch(size, []).delete(ary) @hash.fetch(size, []).delete(tuple)
end end
## ##
@ -403,7 +403,7 @@ module Rinda
# Adds +tuple+ # Adds +tuple+
def write(tuple, sec=nil) def write(tuple, sec=nil)
entry = TupleEntry.new(tuple, sec) entry = create_entry(tuple, sec)
start_keeper start_keeper
synchronize do synchronize do
if entry.expired? if entry.expired?
@ -529,6 +529,10 @@ module Rinda
private private
def create_entry(tuple, sec)
TupleEntry.new(tuple, sec)
end
## ##
# Removes dead tuples. # Removes dead tuples.