Sha256: e657feeaa71459142a575030b382efc3b50ddd6b02e20ee51cf27a3539c006f2
Contents?: true
Size: 904 Bytes
Versions: 15
Compression:
Stored size: 904 Bytes
Contents
module Concurrent module Actor module Behaviour # Links the actor to other actors and sends events to them, # like: `:terminated`, `:paused`, errors, etc class Linking < Abstract def initialize(core, subsequent) super core, subsequent @linked = Set.new end def on_envelope(envelope) case envelope.message when :link link envelope.sender when :unlink unlink envelope.sender else pass envelope end end def link(ref) @linked.add(ref) true end def unlink(ref) @linked.delete(ref) true end def on_event(event) @linked.each { |a| a << event } @linked.clear if event == :terminated super event end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems