123456789_123456789_123456789_123456789_123456789_

Class: Rinda::TupleSpaceProxy::Port

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: lib/rinda/rinda.rb

Overview

A Port ensures that a moved tuple arrives properly at its destination and does not get lost.

See bugs.ruby-lang.org/issues/8125

Class Method Summary

Instance Attribute Summary

Instance Method Summary

  • #close

    Don't let the DRb thread push to it when remote sends tuple.

  • #push(value)

    Stores #value and ensure it does not get marshaled multiple times.

Constructor Details

.newPort

[ GitHub ]

  
# File 'lib/rinda/rinda.rb', line 230

def initialize
  @open = true
  @value = nil
end

Class Method Details

.deliver

[ GitHub ]

  
# File 'lib/rinda/rinda.rb', line 218

def self.deliver
  port = new

  begin
    yield(port)
  ensure
    port.close
  end

  port.value
end

Instance Attribute Details

#value (readonly)

[ GitHub ]

  
# File 'lib/rinda/rinda.rb', line 216

attr_reader :value

Instance Method Details

#close

Don't let the DRb thread push to it when remote sends tuple

[ GitHub ]

  
# File 'lib/rinda/rinda.rb', line 238

def close
  @open = false
end

#push(value)

Stores #value and ensure it does not get marshaled multiple times.

[ GitHub ]

  
# File 'lib/rinda/rinda.rb', line 245

def push value
  raise 'port closed' unless @open

  @value = value

  nil # avoid Marshal
end