Class: Temporal::Workflow::History::Window
- Inherits:
-
Object
- Object
- Temporal::Workflow::History::Window
- Defined in:
- lib/temporal/workflow/history/window.rb
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#last_event_id ⇒ Object
readonly
Returns the value of attribute last_event_id.
-
#local_time ⇒ Object
readonly
Returns the value of attribute local_time.
-
#markers ⇒ Object
readonly
Returns the value of attribute markers.
Instance Method Summary collapse
- #add(event) ⇒ Object
-
#initialize ⇒ Window
constructor
A new instance of Window.
- #replay? ⇒ Boolean
Constructor Details
#initialize ⇒ Window
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
#events ⇒ Object (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_id ⇒ Object (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_time ⇒ Object (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 |
#markers ⇒ Object (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. 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
15 16 17 |
# File 'lib/temporal/workflow/history/window.rb', line 15 def replay? @replay end |