Class: Temporal::Workflow::History::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/temporal/workflow/history/window.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWindow

Returns a new instance of Window.



7
8
9
10
11
12
13
# File 'lib/temporal/workflow/history/window.rb', line 7

def initialize
  @local_time = nil
  @last_event_id = nil
  @events = []
  @markers = []
  @replay = false
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



5
6
7
# File 'lib/temporal/workflow/history/window.rb', line 5

def events
  @events
end

#last_event_idObject (readonly)

Returns the value of attribute last_event_id.



5
6
7
# File 'lib/temporal/workflow/history/window.rb', line 5

def last_event_id
  @last_event_id
end

#local_timeObject (readonly)

Returns the value of attribute local_time.



5
6
7
# File 'lib/temporal/workflow/history/window.rb', line 5

def local_time
  @local_time
end

#markersObject (readonly)

Returns the value of attribute markers.



5
6
7
# File 'lib/temporal/workflow/history/window.rb', line 5

def markers
  @markers
end

Instance Method Details

#add(event) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# 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?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/temporal/workflow/history/window.rb', line 15

def replay?
  @replay
end