class Temporal::Workflow::History::Window

Attributes

events[R]
last_event_id[R]
local_time[R]
markers[R]

Public Class Methods

new() click to toggle source
# File lib/temporal/workflow/history/window.rb, line 7
def initialize
  @local_time = nil
  @last_event_id = nil
  @events = []
  @markers = []
  @replay = false
end

Public Instance Methods

add(event) click to toggle source
# File lib/temporal/workflow/history/window.rb, line 19
def add(event)
  case event.type
  when 'MARKER_RECORDED'
    markers << event
  when 'WORKFLOW_TASK_STARTED'
    @last_event_id = event.id + 1 # one for completed
    @local_time = event.timestamp
  when 'WORKFLOW_TASK_FAILED', 'WORKFLOW_TASK_TIMED_OUT'
    @last_event_id = nil
    @local_time = nil
  when 'WORKFLOW_TASK_COMPLETED'
    @replay = true
  when 'WORKFLOW_TASK_SCHEDULED'
    # no-op
  else
    events << event
  end
end
replay?() click to toggle source
# File lib/temporal/workflow/history/window.rb, line 15
def replay?
  @replay
end