/usr/lib/ruby/vendor_ruby/concurrent/actor/behaviour.rb is in ruby-concurrent 1.0.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | module Concurrent
module Actor
# Actors have modular architecture, which is achieved by combining a light core with chain of
# behaviours. Each message or internal event propagates through the chain allowing the
# behaviours react based on their responsibility.
#
# - {Behaviour::Linking}:
#
# > {include:Actor::Behaviour::Linking}
#
# - {Behaviour::Awaits}:
#
# > {include:Actor::Behaviour::Awaits}
#
# - {Behaviour::Pausing}:
#
# > {include:Actor::Behaviour::Pausing}
#
# - {Behaviour::Supervising}:
#
# > {include:Actor::Behaviour::Supervising}
#
# - {Behaviour::Supervising}:
#
# > {include:Actor::Behaviour::Supervising}
#
# - {Behaviour::ExecutesContext}:
#
# > {include:Actor::Behaviour::ExecutesContext}
#
# - {Behaviour::ErrorsOnUnknownMessage}:
#
# > {include:Actor::Behaviour::ErrorsOnUnknownMessage}
#
# - {Behaviour::Termination}:
#
# > {include:Actor::Behaviour::Termination}
#
# - {Behaviour::RemovesChild}:
#
# > {include:Actor::Behaviour::RemovesChild}
#
# If needed new behaviours can be added, or old one removed to get required behaviour.
#
# - {Context} uses
# {include:Actor::Behaviour.basic_behaviour_definition}
#
# - {RestartingContext} uses
# {include:Actor::Behaviour.restarting_behaviour_definition}
module Behaviour
MESSAGE_PROCESSED = Object.new
require 'concurrent/actor/behaviour/abstract'
require 'concurrent/actor/behaviour/awaits'
require 'concurrent/actor/behaviour/buffer'
require 'concurrent/actor/behaviour/errors_on_unknown_message'
require 'concurrent/actor/behaviour/executes_context'
require 'concurrent/actor/behaviour/linking'
require 'concurrent/actor/behaviour/pausing'
require 'concurrent/actor/behaviour/removes_child'
require 'concurrent/actor/behaviour/sets_results'
require 'concurrent/actor/behaviour/supervising'
require 'concurrent/actor/behaviour/termination'
# Array of behaviours and their construction parameters.
#
# [[Behaviour::SetResults, :terminate!],
# [Behaviour::RemovesChild],
# [Behaviour::Termination],
# [Behaviour::Linking],
# [Behaviour::Awaits],
# [Behaviour::ExecutesContext],
# [Behaviour::ErrorsOnUnknownMessage]]
#
# @see '' its source code
def self.basic_behaviour_definition
[*base(:terminate!),
*linking,
*user_messages]
end
# Array of behaviours and their construction parameters.
#
# [[Behaviour::SetResults, :pause!],
# [Behaviour::RemovesChild],
# [Behaviour::Termination],
# [Behaviour::Linking],
# [Behaviour::Pausing],
# [Behaviour::Supervising, :reset!, :one_for_one],
# [Behaviour::Awaits],
# [Behaviour::ExecutesContext],
# [Behaviour::ErrorsOnUnknownMessage]]
#
# @see '' its source code
def self.restarting_behaviour_definition(handle = :reset!, strategy = :one_for_one)
[*base(:pause!),
*linking,
*supervised,
*supervising(handle, strategy),
*user_messages]
end
# @see '' its source code
def self.base(on_error)
[[SetResults, on_error],
# has to be before Termination to be able to remove children from terminated actor
RemovesChild,
Termination]
end
# @see '' its source code
def self.linking
[Linking]
end
# @see '' its source code
def self.supervised
[Pausing]
end
# @see '' its source code
def self.supervising(handle = :reset!, strategy = :one_for_one)
[[Behaviour::Supervising, handle, strategy]]
end
# @see '' its source code
def self.user_messages
[Awaits,
ExecutesContext,
ErrorsOnUnknownMessage]
end
end
end
end
|