Class: Roby::Distributed::Transaction::DRoby
- Inherits:
-
BasicObject::DRoby
- Object
- BasicObject::DRoby
- Roby::Distributed::Transaction::DRoby
- Defined in:
- lib/roby/distributed/transaction.rb
Overview
Intermediate representation of a Roby::Distributed::Transaction object, suitable for representing that transaction in the dRoby protocol.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#plan ⇒ Object
readonly
Returns the value of attribute plan.
Attributes inherited from BasicObject::DRoby
Instance Method Summary collapse
-
#created_sibling(peer, trsc) ⇒ Object
Called when a new sibling has been created locally for a distributed transaction present on
peer. -
#initialize(remote_siblings, owners, plan, options) ⇒ DRoby
constructor
A new instance of DRoby.
-
#proxy(peer) ⇒ Object
Returns the local representation of this transaction, or raises InvalidRemoteOperation if none exists.
-
#sibling(peer) ⇒ Object
Create a local representation for this transaction.
-
#to_s ⇒ Object
:nodoc:.
Methods inherited from BasicObject::DRoby
#owners_to_s, #remote_siblings_to_s, #sibling_on, #update
Constructor Details
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
325 326 327 |
# File 'lib/roby/distributed/transaction.rb', line 325 def @options end |
Instance Method Details
#created_sibling(peer, trsc) ⇒ Object
Called when a new sibling has been created locally for a distributed transaction present on peer. trsc is the local representation of this transaction.
In practice, it announces the new transaction by calling the block stored in Distributed.transaction_handler (if there is one).
See PeerServer#created_sibling
357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/roby/distributed/transaction.rb', line 357 def created_sibling(peer, trsc) Thread.new do Thread.current.priority = 0 begin Distributed.transaction_handler[trsc] if Distributed.transaction_handler rescue Roby.warn "transaction handler for #{trsc} failed" Roby.warn $!. trsc.invalidate("failed transaction handler") end end end |
#proxy(peer) ⇒ Object
Returns the local representation of this transaction, or raises InvalidRemoteOperation if none exists.
333 334 335 |
# File 'lib/roby/distributed/transaction.rb', line 333 def proxy(peer) raise InvalidRemoteOperation, "the transaction #{self} does not exist on #{peer.connection_space.name}" end |
#sibling(peer) ⇒ Object
Create a local representation for this transaction.
338 339 340 341 342 343 344 345 346 |
# File 'lib/roby/distributed/transaction.rb', line 338 def sibling(peer) plan = peer.local_object(self.plan) trsc = Roby::Distributed::Transaction.new(plan, peer.local_object()) update(peer, trsc) trsc.instance_eval do @editor = false end trsc end |