Class: Farce::Transaction::RactorTMVar
- Inherits:
-
Ractor::TMVar
- Object
- Ractor::TMVar
- Farce::Transaction::RactorTMVar
- Defined in:
- lib/farce/integrations/ractor_tmvar.rb
Overview
A Ractor::TMVar staged alongside TVars and Farce participants.
Take, put, and swap operate on the value staged in this attempt. An empty read, take, or swap, or a put into a full TMVar fails the attempt. Farce.transaction retries these conditions within its retry limit. The try_* methods return nil or false without failing the attempt. Assigned values are made shareable, matching Ractor::TVar's setter.
Run outside Ractor.atomically, as required by RactorTVar. Calls from other Ractors require Ractor-safe TVar methods from ractor-sharing.
ractor-tmvar Integration collapse
-
#initialize(transaction, object) ⇒ RactorTMVar
constructor
Bind the TMVar's underlying TVar to this attempt's shared snapshot.
Methods included from Unshareable
Constructor Details
#initialize(transaction, object) ⇒ RactorTMVar
Bind the TMVar's underlying TVar to this attempt's shared snapshot.
34 35 36 37 38 39 |
# File 'lib/farce/integrations/ractor_tmvar.rb', line 34 def initialize(transaction, object) super # TMVar exposes no accessor for its storage. Reuse the TVar wrapper # so explicit enrollment of that same TVar shares all staged changes. compose(tvar: object.instance_variable_get(:@tvar)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Farce::Transaction::Wrapper