class Ractor::Wrapper::Message

The class of all messages passed between a client Ractor and a wrapper. This helps the wrapper distinguish these messages from any other messages that might be received by a client Ractor.

Any Ractor that calls a wrapper may receive messages of this type when the call is in progress. If a Ractor interacts with its incoming message queue concurrently while a wrapped call is in progress, it must ignore these messages (i.e. by by using `receive_if`) in order not to interfere with the wrapper. (Similarly, the wrapper will use `receive_if` to receive only messages of this type, so it does not interfere with your Ractor's functionality.)

Attributes

data[R]

@private

sender[R]

@private

transaction[R]

@private

type[R]

@private

Public Class Methods

new(type, data: nil, transaction: nil) click to toggle source

@private

# File lib/ractor/wrapper.rb, line 410
def initialize(type, data: nil, transaction: nil)
  @sender = ::Ractor.current
  @type = type
  @data = data
  @transaction = transaction || new_transaction
  freeze
end

Private Instance Methods

new_transaction() click to toggle source
# File lib/ractor/wrapper.rb, line 432
def new_transaction
  ::Random.rand(7958661109946400884391936).to_s(36).freeze
end