class AWS::Flow::SingleDecisionIterator
Attributes
decision_events[RW]
Public Class Methods
new(decision_tasks)
click to toggle source
# File lib/aws/decider/history_helper.rb, line 105 def initialize(decision_tasks) @events = EventsIterator.new(decision_tasks) fill_next @current = @next fill_next end
Public Instance Methods
fill_next()
click to toggle source
# File lib/aws/decider/history_helper.rb, line 129 def fill_next decision_task_timed_out = false decision_start_to_completion_events, decision_completion_to_start_events = [], [] next_replay_current_time_milliseconds = -1 last_decision_index = -1 concurrent_to_decision = true while @events.events.length > 0 event = @events.events.shift event_type = event.event_type.to_sym case event_type when :DecisionTaskCompleted #TODO get execution context #TODO updateWorkflowContextDataAndComponentVersions concurrent_to_decision = false when :DecisionTaskStarted next_replay_current_time_milliseconds = event.created_at if decision_task_timed_out @current.decision_events.concat(decision_start_to_completion_events) decision_start_to_completion_events = [] decision_task_timed_out = false else break end when :DecisionTaskTimedOut decision_task_timed_out = true when :DecisionTaskScheduled # pass when :MarkerRecorded # pass else if concurrent_to_decision decision_start_to_completion_events << event else if is_decision_event? event_type last_decision_index = decision_completion_to_start_events.length end decision_completion_to_start_events << event end end end next_events = reorder_events(decision_start_to_completion_events, decision_completion_to_start_events, last_decision_index) @next = SingleDecisionData.new(next_events, next_replay_current_time_milliseconds, @workflow_context_data ) end
get_decision_task()
click to toggle source
# File lib/aws/decider/history_helper.rb, line 101 def get_decision_task @events.decision_task end
is_decision_event?(event)
click to toggle source
# File lib/aws/decider/history_helper.rb, line 97 def is_decision_event?(event) SingleDecisionIterator.decision_events.member? event end
next()
click to toggle source
# File lib/aws/decider/history_helper.rb, line 112 def next result = @current @current = @next fill_next return result end
reorder_events(start_to_completion, completion_to_start, last_decision_index)
click to toggle source
# File lib/aws/decider/history_helper.rb, line 119 def reorder_events(start_to_completion, completion_to_start, last_decision_index) reordered = [] reordered.concat(completion_to_start.slice(0, last_decision_index + 1)) if last_decision_index >= 0 reordered.concat(start_to_completion) if completion_to_start.length > last_decision_index + 1 reordered.concat(completion_to_start.slice((last_decision_index + 1)..-1)) end return reordered.flatten end