Class: Farce::Transaction::RactorTVar
- Inherits:
-
Object
- Object
- Farce::Transaction::RactorTVar
- Defined in:
- lib/farce/integrations/ractor_sharing.rb
Overview
A Ractor::TVar staged alongside ordinary Farce participants.
Only the commit step enters Ractor.atomically. Conflicts retry the Farce attempt. Values are made shareable when assigned, matching TVar's setter. Mutating a contained object directly is a side effect of the attempt.
Run the Farce transaction outside an enclosing Ractor.atomically block. Writable Concurrent::TVar participants cannot join this commit step.
ractor-sharing Integration collapse
-
#value ⇒ Object
The value staged in this attempt.
-
#value=(value) ⇒ Object
Stage a shareable replacement.
Methods included from Unshareable
#initialize, #ractor_shareable?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Farce::Transaction::Wrapper
Instance Method Details
#value ⇒ Object
Returns the value staged in this attempt.
91 |
# File 'lib/farce/integrations/ractor_sharing.rb', line 91 def value = access { @working.value } |
#value=(value) ⇒ Object
Stage a shareable replacement.
96 97 98 99 100 101 102 |
# File 'lib/farce/integrations/ractor_sharing.rb', line 96 def value=(value) # Can't use #write, as a TVar's Ruby facade is always frozen access do @entry.write! @working.value = ::Ractor.make_shareable(value) end end |