Documentation ¶
Index ¶
- type ActivityExecutionState
- func (state *ActivityExecutionState) GetAttempt() int32
- func (state *ActivityExecutionState) GetDuration() *time.Duration
- func (state *ActivityExecutionState) GetFailure() *failure.Failure
- func (state *ActivityExecutionState) GetName() string
- func (state *ActivityExecutionState) GetRetryState() enums.RetryState
- func (state *ActivityExecutionState) GetStartTime() *time.Time
- func (state *ActivityExecutionState) Update(event *history.HistoryEvent)
- type ActivityExecutionStatus
- type ExecutionState
- type TimerExecutionState
- func (t *TimerExecutionState) GetAttempt() int32
- func (t *TimerExecutionState) GetDuration() *time.Duration
- func (t *TimerExecutionState) GetFailure() *failure.Failure
- func (t *TimerExecutionState) GetName() string
- func (t *TimerExecutionState) GetRetryState() enums.RetryState
- func (t *TimerExecutionState) GetStartTime() *time.Time
- func (t *TimerExecutionState) Update(event *history.HistoryEvent)
- type TimerExecutionStatus
- type WorkflowExecutionState
- func (state *WorkflowExecutionState) FindChildWorkflow(execution *common.WorkflowExecution) *WorkflowExecutionState
- func (state *WorkflowExecutionState) GetAttempt() int32
- func (state *WorkflowExecutionState) GetDuration() *time.Duration
- func (state *WorkflowExecutionState) GetFailure() *failure.Failure
- func (state *WorkflowExecutionState) GetName() string
- func (state *WorkflowExecutionState) GetNumberOfEvents() (int64, int64)
- func (state *WorkflowExecutionState) GetRetryState() enums.RetryState
- func (state *WorkflowExecutionState) GetStartTime() *time.Time
- func (state *WorkflowExecutionState) IsCompleted() bool
- func (state *WorkflowExecutionState) Update(event *history.HistoryEvent)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityExecutionState ¶
type ActivityExecutionState struct { // ActivityId is the Activity's id, which will usually be the EventId of the Event it was scheduled with. ActivityId string // Status is the Execution's Status based on the last event that was processed. Status ActivityExecutionStatus // Type is the name/type of Activity. Type *common.ActivityType // Attempt contains the current Activity Execution's attempt. // Since Activities' events aren't reported until the Activity is closed, this will always be the last attempt. Attempt int32 // Failure contains the last failure that the Execution has reported (if any). Failure *failure.Failure // RetryState contains the reason provided for whether the Task should or shouldn't be retried. RetryState enums.RetryState // StartTime is the time the Execution was started (based on the start Event). StartTime *time.Time // CloseTime is the time the Execution was closed (based on the closing Event). Will be nil if the Execution hasn't been closed yet. CloseTime *time.Time }
ActivityExecutionState is a snapshot of the state of an Activity's Execution. It implements the ExecutionState interface so it can be referenced as a WorkflowExecutionState's child state.
func NewActivityExecutionState ¶
func NewActivityExecutionState() *ActivityExecutionState
func (*ActivityExecutionState) GetAttempt ¶
func (state *ActivityExecutionState) GetAttempt() int32
func (*ActivityExecutionState) GetDuration ¶
func (state *ActivityExecutionState) GetDuration() *time.Duration
func (*ActivityExecutionState) GetFailure ¶
func (state *ActivityExecutionState) GetFailure() *failure.Failure
func (*ActivityExecutionState) GetName ¶
func (state *ActivityExecutionState) GetName() string
func (*ActivityExecutionState) GetRetryState ¶
func (state *ActivityExecutionState) GetRetryState() enums.RetryState
func (*ActivityExecutionState) GetStartTime ¶
func (state *ActivityExecutionState) GetStartTime() *time.Time
func (*ActivityExecutionState) Update ¶
func (state *ActivityExecutionState) Update(event *history.HistoryEvent)
Update updates the ActivityExecutionState with a HistoryEvent.
type ActivityExecutionStatus ¶
type ActivityExecutionStatus int32
ActivityExecutionStatus is the Status of an ActivityExecution, analogous to enums.WorkflowExecutionStatus.
var ( ACTIVITY_EXECUTION_STATUS_UNSPECIFIED ActivityExecutionStatus = 0 ACTIVITY_EXECUTION_STATUS_SCHEDULED ActivityExecutionStatus = 1 ACTIVITY_EXECUTION_STATUS_RUNNING ActivityExecutionStatus = 2 ACTIVITY_EXECUTION_STATUS_COMPLETED ActivityExecutionStatus = 3 ACTIVITY_EXECUTION_STATUS_FAILED ActivityExecutionStatus = 4 ACTIVITY_EXECUTION_STATUS_TIMED_OUT ActivityExecutionStatus = 5 ACTIVITY_EXECUTION_STATUS_CANCEL_REQUESTED ActivityExecutionStatus = 6 ACTIVITY_EXECUTION_STATUS_CANCELED ActivityExecutionStatus = 7 )
type ExecutionState ¶
type ExecutionState interface { Update(*history.HistoryEvent) GetName() string GetAttempt() int32 GetFailure() *failure.Failure GetRetryState() enums.RetryState GetDuration() *time.Duration GetStartTime() *time.Time }
ExecutionState provides a common interface to any execution (Workflows, Activities and Timers in this case) updated through HistoryEvents.
type TimerExecutionState ¶
type TimerExecutionState struct { TimerId string // Name is the name of the Timer (if any has been given to it) Name string // StartToFireTimeout is the amount of time to elapse before the timer fires. StartToFireTimeout *time.Duration // Status is the Execution's Status based on the last event that was processed. Status TimerExecutionStatus // StartTime is the time the Execution was started (based on the start Event). StartTime *time.Time // CloseTime is the time the Execution was closed (based on the closing Event). Will be nil if the Execution hasn't been closed yet. CloseTime *time.Time }
TimerExecutionState contains information about a Timer as an execution. It implements the ExecutionState interface so it can be referenced as a WorkflowExecutionState's child state.
func (*TimerExecutionState) GetAttempt ¶
func (t *TimerExecutionState) GetAttempt() int32
func (*TimerExecutionState) GetDuration ¶
func (t *TimerExecutionState) GetDuration() *time.Duration
func (*TimerExecutionState) GetFailure ¶
func (t *TimerExecutionState) GetFailure() *failure.Failure
func (*TimerExecutionState) GetName ¶
func (t *TimerExecutionState) GetName() string
func (*TimerExecutionState) GetRetryState ¶
func (t *TimerExecutionState) GetRetryState() enums.RetryState
GetRetryState will always return RETRY_STATE_UNSPECIFIED since Timers don't retry.
func (*TimerExecutionState) GetStartTime ¶
func (t *TimerExecutionState) GetStartTime() *time.Time
func (*TimerExecutionState) Update ¶
func (t *TimerExecutionState) Update(event *history.HistoryEvent)
Update updates the TimerExecutionState with a HistoryEvent.
type TimerExecutionStatus ¶
type TimerExecutionStatus int32
TimerExecutionStatus is the Status of a TimerExecution, analogous to enums.WorkflowExecutionStatus.
var ( TIMER_STATUS_WAITING TimerExecutionStatus = 0 TIMER_STATUS_FIRED TimerExecutionStatus = 1 TIMER_STATUS_CANCELED TimerExecutionStatus = 2 )
type WorkflowExecutionState ¶
type WorkflowExecutionState struct { // Execution is the workflow's execution (WorkflowId and RunId). Execution *common.WorkflowExecution // Type is the name/type of Workflow. Type *common.WorkflowType // StartTime is the time the Execution was started (based on the first Execution's Event). StartTime *time.Time // CloseTime is the time the Execution was closed (based on the first Execution's Event). Will be nil if the Execution hasn't been closed yet. CloseTime *time.Time // Status is the Execution's Status based on the last event that was processed. Status enums.WorkflowExecutionStatus // IsArchived will be true if the workflow has been archived. IsArchived bool // LastEventId is the EventId of the last processed HistoryEvent. LastEventId int64 // HistoryLength is the number of HistoryEvents available in the server. It will zero for archived workflows and non-zero positive for any other workflow executions. HistoryLength int64 // ChildStates contains all the ExecutionStates contained by this WorkflowExecutionState in order of execution. ChildStates []ExecutionState // Non-successful closed states // Failure contains the last failure that the Execution has reported (if any). Failure *failure.Failure // Termination contains the last available termination information that the Workflow Execution has reported (if any). Termination *history.WorkflowExecutionTerminatedEventAttributes // CancelRequest contains the last request that has been made to cancel the Workflow Execution (if any). CancelRequest *history.WorkflowExecutionCancelRequestedEventAttributes // RetryState contains the reason provided for whether the Task should or shouldn't be retried. RetryState enums.RetryState // Timeout and retry policies // WorkflowExecutionTimeout contains the Workflow Execution's timeout if it has been set. WorkflowExecutionTimeout *time.Duration // Attempt contains the current Workflow Execution's attempt. Attempt int32 // MaximumAttempts contains the maximum number of times the Workflow Execution is allowed to retry before failing. MaximumAttempts int32 // ParentWorkflowExecution identifies the parent Workflow and the execution run. ParentWorkflowExecution *common.WorkflowExecution // contains filtered or unexported fields }
WorkflowExecutionState is a snapshot of the state of a WorkflowExecution. It is updated through HistoryEvents.
func NewWorkflowExecutionState ¶
func NewWorkflowExecutionState(wfId, runId string) *WorkflowExecutionState
func (*WorkflowExecutionState) FindChildWorkflow ¶
func (state *WorkflowExecutionState) FindChildWorkflow(execution *common.WorkflowExecution) *WorkflowExecutionState
FindChildWorkflow searches for a child workflow that matches the given WorkflowExecution. It's searched within the ChildStates list to avoid concurrent map writes.
func (*WorkflowExecutionState) GetAttempt ¶
func (state *WorkflowExecutionState) GetAttempt() int32
func (*WorkflowExecutionState) GetDuration ¶
func (state *WorkflowExecutionState) GetDuration() *time.Duration
func (*WorkflowExecutionState) GetFailure ¶
func (state *WorkflowExecutionState) GetFailure() *failure.Failure
func (*WorkflowExecutionState) GetName ¶
func (state *WorkflowExecutionState) GetName() string
func (*WorkflowExecutionState) GetNumberOfEvents ¶
func (state *WorkflowExecutionState) GetNumberOfEvents() (int64, int64)
GetNumberOfEvents returns a count of the number of events processed and the total for a workflow execution. This method iteratively sums the LastEventId (the sequential id of the last event processed) and the HistoryLength for all child workflows
func (*WorkflowExecutionState) GetRetryState ¶
func (state *WorkflowExecutionState) GetRetryState() enums.RetryState
func (*WorkflowExecutionState) GetStartTime ¶
func (state *WorkflowExecutionState) GetStartTime() *time.Time
func (*WorkflowExecutionState) IsCompleted ¶
func (state *WorkflowExecutionState) IsCompleted() bool
IsCompleted returns true when the Workflow Execution is completed in a non-failed state. This is useful to know if we should fetch child workflows or fold the information. For now this is when the workflow is completed, terminated or canceled.
func (*WorkflowExecutionState) Update ¶
func (state *WorkflowExecutionState) Update(event *history.HistoryEvent)
Update updates the WorkflowExecutionState and its child states with a HistoryEvent.