Pipeline.State.VariableEngine (pipeline v0.0.1)
View SourceManages pipeline variables and state interpolation.
Provides variable assignment, retrieval, and interpolation capabilities for pipeline execution with support for different scoping levels.
Summary
Functions
Clear variables in a specific scope.
Deserialize state from checkpoint data.
Get all variables as a flattened map with scope precedence.
Get a variable value from the state with scope precedence.
Interpolate variables in any data structure recursively.
Interpolate variables in any data structure with execution context access. This allows resolving step results and other execution-time data.
Interpolate variables in any data structure with type preservation for single templates.
Interpolate variables in a string using {{variable_name}} syntax.
Interpolate variables in a string with execution context access. This handles both variable state and step result patterns.
Interpolate variables with type preservation for single templates. This is used for nested pipeline execution where types should be preserved.
Initialize a new variable state.
Serialize state for checkpoint persistence.
Set variables in the specified scope.
Update the current step information in state.
Functions
Clear variables in a specific scope.
Deserialize state from checkpoint data.
Get all variables as a flattened map with scope precedence.
Get a variable value from the state with scope precedence.
Lookup order: loop -> session -> global
Parameters
state
: Current variable statevar_name
: Variable name to retrieve
Returns
Variable value or nil if not found
Interpolate variables in any data structure recursively.
Interpolate variables in any data structure with execution context access. This allows resolving step results and other execution-time data.
Interpolate variables in any data structure with type preservation for single templates.
Interpolate variables in a string using {{variable_name}} syntax.
Supports:
- Simple variables: {{variable_name}}
- State references: {{state.variable_name}}
- Nested access: {{state.nested.value}}
- Arithmetic expressions: {{state.count + 1}}
Examples
iex> state = %{global: %{"name" => "test", "count" => 5}}
iex> Pipeline.State.VariableEngine.interpolate_string("Hello {{name}}, count: {{count}}", state)
"Hello test, count: 5"
Interpolate variables in a string with execution context access. This handles both variable state and step result patterns.
Interpolate variables with type preservation for single templates. This is used for nested pipeline execution where types should be preserved.
Initialize a new variable state.
Serialize state for checkpoint persistence.
Set variables in the specified scope.
Parameters
state
: Current variable statevariables
: Map of variable names to valuesscope
: Variable scope (:global, :session, :loop)
Examples
iex> state = Pipeline.State.VariableEngine.new_state()
iex> Pipeline.State.VariableEngine.set_variables(state, %{"count" => 1}, :global)
%{global: %{"count" => 1}, session: %{}, loop: %{}, current_step: nil, step_index: 0}
Update the current step information in state.