Class: OMQ::Ractor::MarshalConnection
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- OMQ::Ractor::MarshalConnection
- Includes:
- TransparentDelegator
- Defined in:
- lib/omq/ractor.rb
Overview
Wraps a tcp/ipc Connection with transparent Marshal serialization. Serializes/deserializes the entire parts array.
Instance Method Summary collapse
-
#initialize(conn, cache) ⇒ MarshalConnection
constructor
A new instance of MarshalConnection.
-
#receive_message ⇒ Object
Deserialized message.
- #send_message(parts) ⇒ void
- #write_message(parts) ⇒ void
- #write_messages(batch) ⇒ void
Methods included from TransparentDelegator
Constructor Details
#initialize(conn, cache) ⇒ MarshalConnection
Returns a new instance of MarshalConnection.
90 91 92 93 |
# File 'lib/omq/ractor.rb', line 90 def initialize(conn, cache) super(conn) @cache = cache end |
Instance Method Details
#receive_message ⇒ Object
Returns deserialized message.
118 119 120 |
# File 'lib/omq/ractor.rb', line 118 def Marshal.load(super.first) end |
#send_message(parts) ⇒ void
This method returns an undefined value.
98 99 100 |
# File 'lib/omq/ractor.rb', line 98 def (parts) super([@cache.marshal(parts)]) end |
#write_message(parts) ⇒ void
This method returns an undefined value.
105 106 107 |
# File 'lib/omq/ractor.rb', line 105 def (parts) super([@cache.marshal(parts)]) end |
#write_messages(batch) ⇒ void
This method returns an undefined value.
112 113 114 |
# File 'lib/omq/ractor.rb', line 112 def (batch) super(batch.map { |parts| [@cache.marshal(parts)] }) end |