Class: Roby::Transaction::Proxy::DRoby

Inherits:
BasicObject::DRoby show all
Includes:
LoggedTask
Defined in:
lib/roby/distributed/transaction.rb,
lib/roby/log/relations.rb

Overview

A representation of a distributed transaction proxy suitable for communication with the remote plan managers.

Instance Attribute Summary collapse

Attributes included from LoggedPlanObject

#dot_id

Attributes inherited from BasicObject::DRoby

#owners, #remote_siblings

Instance Method Summary collapse

Methods included from LoggedTask

#display_time_end, #display_time_start, #dot_label, #layout_events

Methods included from LoggedPlanObject

#apply_layout, #dot_label, #to_dot

Methods inherited from BasicObject::DRoby

#owners_to_s, #remote_siblings_to_s, #sibling_on, #update

Constructor Details

#initialize(remote_siblings, owners, real_object, transaction) ⇒ DRoby

Create a new dRoby representation for a transaction proxy. The proxy currently has the given set of remote siblings and owners, is a view on the given real object and is stored in the given transaction. All objects must already be formatted for marshalling using Distributed.format.



406
407
408
409
# File 'lib/roby/distributed/transaction.rb', line 406

def initialize(remote_siblings, owners, real_object, transaction)
    super(remote_siblings, owners)
    @real_object, @transaction = real_object, transaction 
end

Instance Attribute Details

#real_objectObject

The DRoby version of the underlying object



398
399
400
# File 'lib/roby/distributed/transaction.rb', line 398

def real_object
  @real_object
end

#transactionObject (readonly)

The DRoby representation of the transaction



400
401
402
# File 'lib/roby/distributed/transaction.rb', line 400

def transaction
  @transaction
end

Instance Method Details

#display(display, graphics_item) ⇒ Object



228
229
230
231
# File 'lib/roby/log/relations.rb', line 228

def display(display, graphics_item)
    graphics_item.text.plain_text = display_name(display).to_s
    layout_events(display)
end

#display_create(display) ⇒ Object



219
220
221
222
223
224
225
226
227
# File 'lib/roby/log/relations.rb', line 219

def display_create(display)
    scene = display.scene
    item = super

    brush = item.brush
    brush.style = Qt::BDiagPattern
    item.brush = brush
    item
end

#display_name(display) ⇒ Object



218
# File 'lib/roby/log/relations.rb', line 218

def display_name(display); real_object.display_name(display) end

#display_parentObject



217
# File 'lib/roby/log/relations.rb', line 217

def display_parent; end

#flagsObject



215
# File 'lib/roby/log/relations.rb', line 215

def flags; real_object.flags end

#proxy(peer) ⇒ Object

Returns the local object matching this dRoby-formatted representation of a remote transaction proxy present on peer.



414
415
416
417
418
419
420
421
422
# File 'lib/roby/distributed/transaction.rb', line 414

def proxy(peer)
    local_real = peer.local_object(real_object)
    local_object = nil
    local_transaction = peer.local_object(transaction)
    Distributed.update(local_transaction) do
	local_object = local_transaction[local_real]
    end
    local_object
end

#to_sObject

:nodoc:



424
425
426
# File 'lib/roby/distributed/transaction.rb', line 424

def to_s # :nodoc:
    "#<dRoby:mTrscProxy#{remote_siblings} transaction=#{transaction} real_object=#{real_object}>"
end