Class: OFlow::Actor
- Inherits:
-
Object
- Object
- OFlow::Actor
- Defined in:
- lib/oflow/actor.rb
Overview
Actors provide the custom functionality for Tasks. Each Task creates an instance of some Actor. Actors are not shared between Tasks and each can be assure that the data they operate on is their own.
Direct Known Subclasses
OFlow::Actors::Balancer, OFlow::Actors::ErrorHandler, OFlow::Actors::Ignore, OFlow::Actors::Log, OFlow::Actors::Merger, OFlow::Actors::Persister, OFlow::Actors::Recorder, OFlow::Actors::Relay, OFlow::Actors::ShellOne, OFlow::Actors::ShellRepeat, OFlow::Actors::Timer, OFlow::Actors::Trigger
Defined Under Namespace
Classes: Spec
Instance Attribute Summary collapse
-
#task ⇒ Object
readonly
The enclosing task.
Instance Method Summary collapse
- #busy? ⇒ Boolean
-
#initialize(task, options) ⇒ Actor
constructor
Creates a new instance.
-
#inputs ⇒ Array
Return array of Specs.
-
#options ⇒ Hash
Return any options that should be displayed as part of a Task.describe().
-
#outputs ⇒ Array
Return array of Specs.
-
#perform(op, box) ⇒ Object
Perform the primary functions for the Actor.
- #set_option(key, value) ⇒ Object
-
#with_own_thread ⇒ true|false
Returns whether the Actor should have it’s own thread or not.
Constructor Details
#initialize(task, options) ⇒ Actor
Creates a new instance.
15 16 17 |
# File 'lib/oflow/actor.rb', line 15 def initialize(task, ) @task = task end |
Instance Attribute Details
#task ⇒ Object (readonly)
The enclosing task.
10 11 12 |
# File 'lib/oflow/actor.rb', line 10 def task @task end |
Instance Method Details
#busy? ⇒ Boolean
55 56 57 |
# File 'lib/oflow/actor.rb', line 55 def busy?() false end |
#inputs ⇒ Array
Return array of Specs.
35 36 37 |
# File 'lib/oflow/actor.rb', line 35 def inputs() nil end |
#options ⇒ Hash
Return any options that should be displayed as part of a Task.describe().
51 52 53 |
# File 'lib/oflow/actor.rb', line 51 def () {} end |
#outputs ⇒ Array
Return array of Specs.
41 42 43 |
# File 'lib/oflow/actor.rb', line 41 def outputs() nil end |
#perform(op, box) ⇒ Object
Perform the primary functions for the Actor.
22 23 |
# File 'lib/oflow/actor.rb', line 22 def perform(op, box) end |
#set_option(key, value) ⇒ Object
45 46 47 |
# File 'lib/oflow/actor.rb', line 45 def set_option(key, value) ({ key.to_sym => value }) end |
#with_own_thread ⇒ true|false
Returns whether the Actor should have it’s own thread or not. In almost all cases the Actor should have it’s own thread. The exception is when the action is trivial such as a relay.
29 30 31 |
# File 'lib/oflow/actor.rb', line 29 def with_own_thread() true end |