Class: Spinoza::Link
Overview
Models a comm link between nodes, including the latency between sender and receiver. The class is stateless: the state of the channnel (messages and their scheduled arrivals) is part of the global timeline.
Instance Attribute Summary collapse
-
#dst ⇒ Object
readonly
Source and destination nodes.
-
#latency ⇒ Object
readonly
Delay between send by source and receive by destination.
-
#src ⇒ Object
readonly
Source and destination nodes.
Attributes inherited from Model
Instance Method Summary collapse
-
#initialize(src: raise, dst: raise, latency: 0.100, **rest) ⇒ Link
constructor
A new instance of Link.
- #inspect ⇒ Object
-
#send_message(msg) ⇒ Object
The src node calls this to send a message.
Methods inherited from Model
Constructor Details
#initialize(src: raise, dst: raise, latency: 0.100, **rest) ⇒ Link
Returns a new instance of Link.
14 15 16 17 |
# File 'lib/spinoza/system/link.rb', line 14 def initialize src: raise, dst: raise, latency: 0.100, **rest super **rest @src, @dst, @latency = src, dst, latency end |
Instance Attribute Details
#dst ⇒ Object (readonly)
Source and destination nodes.
9 10 11 |
# File 'lib/spinoza/system/link.rb', line 9 def dst @dst end |
#latency ⇒ Object (readonly)
Delay between send by source and receive by destination.
12 13 14 |
# File 'lib/spinoza/system/link.rb', line 12 def latency @latency end |
#src ⇒ Object (readonly)
Source and destination nodes.
9 10 11 |
# File 'lib/spinoza/system/link.rb', line 9 def src @src end |
Instance Method Details
#inspect ⇒ Object
23 24 25 |
# File 'lib/spinoza/system/link.rb', line 23 def inspect "<#{self.class}: #{src} -> #{dst}>" end |