123456789_123456789_123456789_123456789_123456789_

Class: Rinda::WaitTemplateEntry

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
self, TemplateEntry, TupleEntry, DRbUndumped
Inherits: Rinda::TemplateEntry
Defined in: lib/rinda/tuplespace.rb

Overview

Documentation?

Class Method Summary

TupleEntry - Inherited

.new

Creates a TupleEntry based on ary with an optional renewer or expiry time sec.

Instance Attribute Summary

TupleEntry - Inherited

#expires,
#alive?

A TupleEntry is dead when it is canceled or expired.

#canceled?

Returns the canceled status.

#expired?

Has this tuple expired? (true/false).

Instance Method Summary

TemplateEntry - Inherited

#===
#match

Matches this TemplateEntry against tuple.

TupleEntry - Inherited

#[]

Retrieves key from the tuple.

#cancel

Marks this TupleEntry as canceled.

#fetch

Fetches key from the tuple.

#make_expires
Returns an expiry Time based on sec which can be one of: Numeric
sec seconds into the future true
the expiry time is the start of 1970 (i.e. expired) nil

it is Tue Jan 19 03:14:07 GMT Standard Time 2038 (i.e. when.

#make_tuple

Creates a Tuple for ary.

#renew

Reset the expiry time according to sec_or_renewer.

#size

The size of the tuple.

#value

Return the object which makes up the tuple itself: the Array or Hash.

#get_renewer

Returns a valid argument to make_expires and the renewer or nil.

Constructor Details

.new(place, ary, expires = nil) ⇒ WaitTemplateEntry

[ GitHub ]

  
# File 'lib/rinda/tuplespace.rb', line 187

def initialize(place, ary, expires=nil)
  super(ary, expires)
  @place = place
  @cond = place.new_cond
  @found = nil
end

Instance Attribute Details

#found (readonly)

[ GitHub ]

  
# File 'lib/rinda/tuplespace.rb', line 185

attr_reader :found

Instance Method Details

#cancel

[ GitHub ]

  
# File 'lib/rinda/tuplespace.rb', line 194

def cancel
  super
  signal
end

#read(tuple)

[ GitHub ]

  
# File 'lib/rinda/tuplespace.rb', line 203

def read(tuple)
  @found = tuple
  signal
end

#signal

[ GitHub ]

  
# File 'lib/rinda/tuplespace.rb', line 208

def signal
  @place.synchronize do
    @cond.signal
  end
end

#wait

[ GitHub ]

  
# File 'lib/rinda/tuplespace.rb', line 199

def wait
  @cond.wait
end