in common/types/mapper/proto/api.go [5469:5650]
func FromHistoryEvent(e *types.HistoryEvent) *apiv1.HistoryEvent {
if e == nil {
return nil
}
event := apiv1.HistoryEvent{
EventId: e.ID,
EventTime: unixNanoToTime(e.Timestamp),
Version: e.Version,
TaskId: e.TaskID,
}
switch *e.EventType {
case types.EventTypeWorkflowExecutionStarted:
event.Attributes = &apiv1.HistoryEvent_WorkflowExecutionStartedEventAttributes{
WorkflowExecutionStartedEventAttributes: FromWorkflowExecutionStartedEventAttributes(e.WorkflowExecutionStartedEventAttributes),
}
case types.EventTypeWorkflowExecutionCompleted:
event.Attributes = &apiv1.HistoryEvent_WorkflowExecutionCompletedEventAttributes{
WorkflowExecutionCompletedEventAttributes: FromWorkflowExecutionCompletedEventAttributes(e.WorkflowExecutionCompletedEventAttributes),
}
case types.EventTypeWorkflowExecutionFailed:
event.Attributes = &apiv1.HistoryEvent_WorkflowExecutionFailedEventAttributes{
WorkflowExecutionFailedEventAttributes: FromWorkflowExecutionFailedEventAttributes(e.WorkflowExecutionFailedEventAttributes),
}
case types.EventTypeWorkflowExecutionTimedOut:
event.Attributes = &apiv1.HistoryEvent_WorkflowExecutionTimedOutEventAttributes{
WorkflowExecutionTimedOutEventAttributes: FromWorkflowExecutionTimedOutEventAttributes(e.WorkflowExecutionTimedOutEventAttributes),
}
case types.EventTypeDecisionTaskScheduled:
event.Attributes = &apiv1.HistoryEvent_DecisionTaskScheduledEventAttributes{
DecisionTaskScheduledEventAttributes: FromDecisionTaskScheduledEventAttributes(e.DecisionTaskScheduledEventAttributes),
}
case types.EventTypeDecisionTaskStarted:
event.Attributes = &apiv1.HistoryEvent_DecisionTaskStartedEventAttributes{
DecisionTaskStartedEventAttributes: FromDecisionTaskStartedEventAttributes(e.DecisionTaskStartedEventAttributes),
}
case types.EventTypeDecisionTaskCompleted:
event.Attributes = &apiv1.HistoryEvent_DecisionTaskCompletedEventAttributes{
DecisionTaskCompletedEventAttributes: FromDecisionTaskCompletedEventAttributes(e.DecisionTaskCompletedEventAttributes),
}
case types.EventTypeDecisionTaskTimedOut:
event.Attributes = &apiv1.HistoryEvent_DecisionTaskTimedOutEventAttributes{
DecisionTaskTimedOutEventAttributes: FromDecisionTaskTimedOutEventAttributes(e.DecisionTaskTimedOutEventAttributes),
}
case types.EventTypeDecisionTaskFailed:
event.Attributes = &apiv1.HistoryEvent_DecisionTaskFailedEventAttributes{
DecisionTaskFailedEventAttributes: FromDecisionTaskFailedEventAttributes(e.DecisionTaskFailedEventAttributes),
}
case types.EventTypeActivityTaskScheduled:
event.Attributes = &apiv1.HistoryEvent_ActivityTaskScheduledEventAttributes{
ActivityTaskScheduledEventAttributes: FromActivityTaskScheduledEventAttributes(e.ActivityTaskScheduledEventAttributes),
}
case types.EventTypeActivityTaskStarted:
event.Attributes = &apiv1.HistoryEvent_ActivityTaskStartedEventAttributes{
ActivityTaskStartedEventAttributes: FromActivityTaskStartedEventAttributes(e.ActivityTaskStartedEventAttributes),
}
case types.EventTypeActivityTaskCompleted:
event.Attributes = &apiv1.HistoryEvent_ActivityTaskCompletedEventAttributes{
ActivityTaskCompletedEventAttributes: FromActivityTaskCompletedEventAttributes(e.ActivityTaskCompletedEventAttributes),
}
case types.EventTypeActivityTaskFailed:
event.Attributes = &apiv1.HistoryEvent_ActivityTaskFailedEventAttributes{
ActivityTaskFailedEventAttributes: FromActivityTaskFailedEventAttributes(e.ActivityTaskFailedEventAttributes),
}
case types.EventTypeActivityTaskTimedOut:
event.Attributes = &apiv1.HistoryEvent_ActivityTaskTimedOutEventAttributes{
ActivityTaskTimedOutEventAttributes: FromActivityTaskTimedOutEventAttributes(e.ActivityTaskTimedOutEventAttributes),
}
case types.EventTypeActivityTaskCancelRequested:
event.Attributes = &apiv1.HistoryEvent_ActivityTaskCancelRequestedEventAttributes{
ActivityTaskCancelRequestedEventAttributes: FromActivityTaskCancelRequestedEventAttributes(e.ActivityTaskCancelRequestedEventAttributes),
}
case types.EventTypeRequestCancelActivityTaskFailed:
event.Attributes = &apiv1.HistoryEvent_RequestCancelActivityTaskFailedEventAttributes{
RequestCancelActivityTaskFailedEventAttributes: FromRequestCancelActivityTaskFailedEventAttributes(e.RequestCancelActivityTaskFailedEventAttributes),
}
case types.EventTypeActivityTaskCanceled:
event.Attributes = &apiv1.HistoryEvent_ActivityTaskCanceledEventAttributes{
ActivityTaskCanceledEventAttributes: FromActivityTaskCanceledEventAttributes(e.ActivityTaskCanceledEventAttributes),
}
case types.EventTypeTimerStarted:
event.Attributes = &apiv1.HistoryEvent_TimerStartedEventAttributes{
TimerStartedEventAttributes: FromTimerStartedEventAttributes(e.TimerStartedEventAttributes),
}
case types.EventTypeTimerFired:
event.Attributes = &apiv1.HistoryEvent_TimerFiredEventAttributes{
TimerFiredEventAttributes: FromTimerFiredEventAttributes(e.TimerFiredEventAttributes),
}
case types.EventTypeTimerCanceled:
event.Attributes = &apiv1.HistoryEvent_TimerCanceledEventAttributes{
TimerCanceledEventAttributes: FromTimerCanceledEventAttributes(e.TimerCanceledEventAttributes),
}
case types.EventTypeCancelTimerFailed:
event.Attributes = &apiv1.HistoryEvent_CancelTimerFailedEventAttributes{
CancelTimerFailedEventAttributes: FromCancelTimerFailedEventAttributes(e.CancelTimerFailedEventAttributes),
}
case types.EventTypeWorkflowExecutionCancelRequested:
event.Attributes = &apiv1.HistoryEvent_WorkflowExecutionCancelRequestedEventAttributes{
WorkflowExecutionCancelRequestedEventAttributes: FromWorkflowExecutionCancelRequestedEventAttributes(e.WorkflowExecutionCancelRequestedEventAttributes),
}
case types.EventTypeWorkflowExecutionCanceled:
event.Attributes = &apiv1.HistoryEvent_WorkflowExecutionCanceledEventAttributes{
WorkflowExecutionCanceledEventAttributes: FromWorkflowExecutionCanceledEventAttributes(e.WorkflowExecutionCanceledEventAttributes),
}
case types.EventTypeRequestCancelExternalWorkflowExecutionInitiated:
event.Attributes = &apiv1.HistoryEvent_RequestCancelExternalWorkflowExecutionInitiatedEventAttributes{
RequestCancelExternalWorkflowExecutionInitiatedEventAttributes: FromRequestCancelExternalWorkflowExecutionInitiatedEventAttributes(e.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes),
}
case types.EventTypeRequestCancelExternalWorkflowExecutionFailed:
event.Attributes = &apiv1.HistoryEvent_RequestCancelExternalWorkflowExecutionFailedEventAttributes{
RequestCancelExternalWorkflowExecutionFailedEventAttributes: FromRequestCancelExternalWorkflowExecutionFailedEventAttributes(e.RequestCancelExternalWorkflowExecutionFailedEventAttributes),
}
case types.EventTypeExternalWorkflowExecutionCancelRequested:
event.Attributes = &apiv1.HistoryEvent_ExternalWorkflowExecutionCancelRequestedEventAttributes{
ExternalWorkflowExecutionCancelRequestedEventAttributes: FromExternalWorkflowExecutionCancelRequestedEventAttributes(e.ExternalWorkflowExecutionCancelRequestedEventAttributes),
}
case types.EventTypeMarkerRecorded:
event.Attributes = &apiv1.HistoryEvent_MarkerRecordedEventAttributes{
MarkerRecordedEventAttributes: FromMarkerRecordedEventAttributes(e.MarkerRecordedEventAttributes),
}
case types.EventTypeWorkflowExecutionSignaled:
event.Attributes = &apiv1.HistoryEvent_WorkflowExecutionSignaledEventAttributes{
WorkflowExecutionSignaledEventAttributes: FromWorkflowExecutionSignaledEventAttributes(e.WorkflowExecutionSignaledEventAttributes),
}
case types.EventTypeWorkflowExecutionTerminated:
event.Attributes = &apiv1.HistoryEvent_WorkflowExecutionTerminatedEventAttributes{
WorkflowExecutionTerminatedEventAttributes: FromWorkflowExecutionTerminatedEventAttributes(e.WorkflowExecutionTerminatedEventAttributes),
}
case types.EventTypeWorkflowExecutionContinuedAsNew:
event.Attributes = &apiv1.HistoryEvent_WorkflowExecutionContinuedAsNewEventAttributes{
WorkflowExecutionContinuedAsNewEventAttributes: FromWorkflowExecutionContinuedAsNewEventAttributes(e.WorkflowExecutionContinuedAsNewEventAttributes),
}
case types.EventTypeStartChildWorkflowExecutionInitiated:
event.Attributes = &apiv1.HistoryEvent_StartChildWorkflowExecutionInitiatedEventAttributes{
StartChildWorkflowExecutionInitiatedEventAttributes: FromStartChildWorkflowExecutionInitiatedEventAttributes(e.StartChildWorkflowExecutionInitiatedEventAttributes),
}
case types.EventTypeStartChildWorkflowExecutionFailed:
event.Attributes = &apiv1.HistoryEvent_StartChildWorkflowExecutionFailedEventAttributes{
StartChildWorkflowExecutionFailedEventAttributes: FromStartChildWorkflowExecutionFailedEventAttributes(e.StartChildWorkflowExecutionFailedEventAttributes),
}
case types.EventTypeChildWorkflowExecutionStarted:
event.Attributes = &apiv1.HistoryEvent_ChildWorkflowExecutionStartedEventAttributes{
ChildWorkflowExecutionStartedEventAttributes: FromChildWorkflowExecutionStartedEventAttributes(e.ChildWorkflowExecutionStartedEventAttributes),
}
case types.EventTypeChildWorkflowExecutionCompleted:
event.Attributes = &apiv1.HistoryEvent_ChildWorkflowExecutionCompletedEventAttributes{
ChildWorkflowExecutionCompletedEventAttributes: FromChildWorkflowExecutionCompletedEventAttributes(e.ChildWorkflowExecutionCompletedEventAttributes),
}
case types.EventTypeChildWorkflowExecutionFailed:
event.Attributes = &apiv1.HistoryEvent_ChildWorkflowExecutionFailedEventAttributes{
ChildWorkflowExecutionFailedEventAttributes: FromChildWorkflowExecutionFailedEventAttributes(e.ChildWorkflowExecutionFailedEventAttributes),
}
case types.EventTypeChildWorkflowExecutionCanceled:
event.Attributes = &apiv1.HistoryEvent_ChildWorkflowExecutionCanceledEventAttributes{
ChildWorkflowExecutionCanceledEventAttributes: FromChildWorkflowExecutionCanceledEventAttributes(e.ChildWorkflowExecutionCanceledEventAttributes),
}
case types.EventTypeChildWorkflowExecutionTimedOut:
event.Attributes = &apiv1.HistoryEvent_ChildWorkflowExecutionTimedOutEventAttributes{
ChildWorkflowExecutionTimedOutEventAttributes: FromChildWorkflowExecutionTimedOutEventAttributes(e.ChildWorkflowExecutionTimedOutEventAttributes),
}
case types.EventTypeChildWorkflowExecutionTerminated:
event.Attributes = &apiv1.HistoryEvent_ChildWorkflowExecutionTerminatedEventAttributes{
ChildWorkflowExecutionTerminatedEventAttributes: FromChildWorkflowExecutionTerminatedEventAttributes(e.ChildWorkflowExecutionTerminatedEventAttributes),
}
case types.EventTypeSignalExternalWorkflowExecutionInitiated:
event.Attributes = &apiv1.HistoryEvent_SignalExternalWorkflowExecutionInitiatedEventAttributes{
SignalExternalWorkflowExecutionInitiatedEventAttributes: FromSignalExternalWorkflowExecutionInitiatedEventAttributes(e.SignalExternalWorkflowExecutionInitiatedEventAttributes),
}
case types.EventTypeSignalExternalWorkflowExecutionFailed:
event.Attributes = &apiv1.HistoryEvent_SignalExternalWorkflowExecutionFailedEventAttributes{
SignalExternalWorkflowExecutionFailedEventAttributes: FromSignalExternalWorkflowExecutionFailedEventAttributes(e.SignalExternalWorkflowExecutionFailedEventAttributes),
}
case types.EventTypeExternalWorkflowExecutionSignaled:
event.Attributes = &apiv1.HistoryEvent_ExternalWorkflowExecutionSignaledEventAttributes{
ExternalWorkflowExecutionSignaledEventAttributes: FromExternalWorkflowExecutionSignaledEventAttributes(e.ExternalWorkflowExecutionSignaledEventAttributes),
}
case types.EventTypeUpsertWorkflowSearchAttributes:
event.Attributes = &apiv1.HistoryEvent_UpsertWorkflowSearchAttributesEventAttributes{
UpsertWorkflowSearchAttributesEventAttributes: FromUpsertWorkflowSearchAttributesEventAttributes(e.UpsertWorkflowSearchAttributesEventAttributes),
}
}
return &event
}