Class: Kitchen::Instance::FSM Private
- Inherits:
-
Object
- Object
- Kitchen::Instance::FSM
- Defined in:
- lib/kitchen/instance.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The simplest finite state machine pseudo-implementation needed to manage an Instance.
Constant Summary collapse
- TRANSITIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The instance state lifecycle, ordered from least to most converged.
%i{destroy create converge setup verify}.freeze
Class Method Summary collapse
-
.actions(last = nil, desired) ⇒ Array<Symbol>
private
Returns an Array of all transitions to bring an Instance from its last reported transitioned state into the desired transitioned state.
-
.index(transition) ⇒ Integer
private
Determines the index of a state in the state lifecycle vector.
Class Method Details
.actions(last = nil, desired) ⇒ Array<Symbol>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns an Array of all transitions to bring an Instance from its last reported transitioned state into the desired transitioned state.
779 780 781 782 783 784 785 786 787 788 |
# File 'lib/kitchen/instance.rb', line 779 def self.actions(last = nil, desired) last_index = index(last) desired_index = index(desired) if last_index == desired_index || last_index > desired_index Array(TRANSITIONS[desired_index]) else TRANSITIONS.slice(last_index + 1, desired_index - last_index) end end |
.index(transition) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Determines the index of a state in the state lifecycle vector. Whoa.
801 802 803 804 805 806 807 |
# File 'lib/kitchen/instance.rb', line 801 def self.index(transition) if transition.nil? 0 else TRANSITIONS.find_index { |t| t == transition.to_sym } end end |