Class: Cadence::Workflow::History::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/cadence/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/cadence/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/cadence/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/cadence/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/cadence/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/cadence/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/cadence/workflow/history/window.rb', line 19

def add(event)
  case event.type
  when 'MarkerRecorded'
    markers << event
  when 'DecisionTaskStarted'
    @last_event_id = event.id + 1 # one for completed
    @local_time = event.timestamp
  when 'DecisionTaskFailed', 'DecisionTaskTimedOut'
    @next_event_id = nil
    @local_time = nil
  when 'DecisionTaskCompleted'
    @replay = true
  when 'DecisionTaskScheduled', 'DecisionTaskFailed'
    # no-op
  else
    events << event
  end
end

#replay?Boolean

Returns:

  • (Boolean)


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

def replay?
  @replay
end