Class | Ruote::Exp::FlowExpression |
In: |
lib/ruote/exp/flow_expression.rb
lib/ruote/exp/ro_persist.rb lib/ruote/exp/ro_attributes.rb lib/ruote/exp/ro_filters.rb lib/ruote/exp/ro_on_x.rb lib/ruote/exp/ro_variables.rb lib/ruote/exp/ro_timers.rb |
Parent: | Object |
‘re-opening’ the FlowExpression class to add timers related methods.
COMMON_ATT_KEYS | = | %w[ if unless forget lose flank timeout timers on_error on_cancel on_timeout ] | ||
VV | = | %w[ val value ] | Val and Value (Sense and Sensibility ?) | |
VAR_PREFIX_REGEX | = | /^(\/{0,2})\/*(.+)$/ | ||
PREFIX_REGEX | = | /^([^:]+):(.+)$/ | ||
F_PREFIX_REGEX | = | /^f/ |
context | [R] | |
error | [RW] |
Mostly used when the expression is returned via Ruote::Engine#ps(wfid) or
Ruote::Engine#processes(). If an error occurred for this flow expression,
ps will set this error field so that it yields the ProcessError.
So, for short, usually, this attribute yields nil. |
h | [R] |
Returns the value for attribute ‘key’, this value should be present in the array list ‘values’. If not, the default value is returned. By default, the default value is the first element of ‘values’.
Equivalent to attribute_text, but will return nil if there is no attribute whose values is nil.
Given something like
sequence do participant 'alpha' end
in the context of the participant expression
attribute_text()
will yield ‘alpha’.
Note : an empty text returns ’’, not the nil value.
Returns the attributes of this expression (like { ‘ref’ => ‘toto’ } or { ‘timeout’ => ‘2d’ }.
Returns the list of child_ids (last part of the fei.expid) for the currently registered (active) children.
Returns a Hash containing all attributes set for an expression with their values resolved.
Returns a fresh hash of all the variables visible from this expression.
This is used mainly when forgetting an expression.
Wraps a call to "apply", "reply", etc… Makes sure to set @msg with a deep copy of the msg before.
Called by the worker when it has just created this FlowExpression and wants to apply it.
The raw handling of messages passed to expressions (the fine handling is done in the cancel method).
Expression received a "pause" message. Will put the expression in the "paused" state and then pass the message to the children.
If the expression is in a non-nil state (failed, timed_out, …), the message will be ignored.
Will "unpause" the expression (if it was paused), and trigger any ‘paused_replies’ (replies that came while the expression was paused).
Persists and fetches the _rev identifier from the storage.
Only used by the worker when creating the expression.
Concurrent expressions (expressions that apply more than one child at a time) are supposed to return true here.
prefix = ‘on’ => will lookup on, on_val, on_value, on_v, on_var, on_variable, on_f, on_fld, on_field…
Called by do_apply when msg[‘state’] == ‘paused’. Covers the "apply/launch it but it‘s immediately paused" case. Freezes the apply message in h.paused_apply and saves the expression.
FlowExpression call this method when they‘re done and they want their parent expression to take over (it will end up calling the reply of the parent expression).
Expression implementations are free to override this method. The common behaviour is in do_reply_to_parent.
An expensive method, looks up all the expressions with the same wfid in the storage (for some storages this is not expensive at all), and determine the root of this expression. It does this by recursively going from an expression to its parent, starting with this expression. The root is when the parent can‘t be reached.
By default, this method will always return an expression, but if stubborn is set to true and the top expression points to a gone parent then nil will be returned. The default (stubborn=true) is probably what you want anyway.
Returns the fei of the root expression of this expression. The result is an instance of Ruote::FlowExpressionId.
Uses root behind the scenes, hence the stubborn option.
Turns this FlowExpression instance into a Hash (well, just hands back the base hash behind it).
Called to check if the expression has a :tag attribute. If yes, will register the tag in a variable (and in the workitem).
When used with override = true(ish), will try to locate the binding site for the variable and return it.
If override is set to ‘sub’, will stop before digging into the parent subprocess.
Returns the flow expression that owns a variable (or the one that should own it) and the var without its potential / prefixes.
In other words:
[ owner, varname_without_slashes ]
When a location for the variable could not be found, it returns:
[ nil, nil ]
Used locally but also by ConcurrenceExpression, when preparing children before they get applied.
Some expressions have to keep track of their (instantiated) children, this method does the registration (of the child‘s fei).
Called by trigger when it encounters something like
:on_error => '5m: retry, pass'
Used by consider_timers and ParticipantExpression#consider_participant_timers
Takes care of registering the timers/timeout for an expression.
Used by lookup_variable and set_variable to extract the prefix in a variable name