in common/util.go [677:795]
func GetSizeOfHistoryEvent(event *types.HistoryEvent) uint64 {
if event == nil || event.EventType == nil {
return 0
}
res := 0
switch *event.EventType {
case types.EventTypeWorkflowExecutionStarted:
res += len(event.WorkflowExecutionStartedEventAttributes.Input)
res += len(event.WorkflowExecutionStartedEventAttributes.ContinuedFailureDetails)
res += len(event.WorkflowExecutionStartedEventAttributes.LastCompletionResult)
if event.WorkflowExecutionStartedEventAttributes.Memo != nil {
res += GetSizeOfMapStringToByteArray(event.WorkflowExecutionStartedEventAttributes.Memo.Fields)
}
if event.WorkflowExecutionStartedEventAttributes.Header != nil {
res += GetSizeOfMapStringToByteArray(event.WorkflowExecutionStartedEventAttributes.Header.Fields)
}
if event.WorkflowExecutionStartedEventAttributes.SearchAttributes != nil {
res += GetSizeOfMapStringToByteArray(event.WorkflowExecutionStartedEventAttributes.SearchAttributes.IndexedFields)
}
case types.EventTypeWorkflowExecutionCompleted:
res += len(event.WorkflowExecutionCompletedEventAttributes.Result)
case types.EventTypeWorkflowExecutionFailed:
res += len(event.WorkflowExecutionFailedEventAttributes.Details)
case types.EventTypeWorkflowExecutionTimedOut:
case types.EventTypeDecisionTaskScheduled:
case types.EventTypeDecisionTaskStarted:
case types.EventTypeDecisionTaskCompleted:
res += len(event.DecisionTaskCompletedEventAttributes.ExecutionContext)
case types.EventTypeDecisionTaskTimedOut:
case types.EventTypeDecisionTaskFailed:
res += len(event.DecisionTaskFailedEventAttributes.Details)
case types.EventTypeActivityTaskScheduled:
res += len(event.ActivityTaskScheduledEventAttributes.Input)
if event.ActivityTaskScheduledEventAttributes.Header != nil {
res += GetSizeOfMapStringToByteArray(event.ActivityTaskScheduledEventAttributes.Header.Fields)
}
case types.EventTypeActivityTaskStarted:
res += len(event.ActivityTaskStartedEventAttributes.LastFailureDetails)
case types.EventTypeActivityTaskCompleted:
res += len(event.ActivityTaskCompletedEventAttributes.Result)
case types.EventTypeActivityTaskFailed:
res += len(event.ActivityTaskFailedEventAttributes.Details)
case types.EventTypeActivityTaskTimedOut:
res += len(event.ActivityTaskTimedOutEventAttributes.Details)
res += len(event.ActivityTaskTimedOutEventAttributes.LastFailureDetails)
case types.EventTypeActivityTaskCancelRequested:
case types.EventTypeRequestCancelActivityTaskFailed:
case types.EventTypeActivityTaskCanceled:
res += len(event.ActivityTaskCanceledEventAttributes.Details)
case types.EventTypeTimerStarted:
case types.EventTypeTimerFired:
case types.EventTypeCancelTimerFailed:
case types.EventTypeTimerCanceled:
case types.EventTypeWorkflowExecutionCancelRequested:
case types.EventTypeWorkflowExecutionCanceled:
res += len(event.WorkflowExecutionCanceledEventAttributes.Details)
case types.EventTypeRequestCancelExternalWorkflowExecutionInitiated:
res += len(event.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.Control)
case types.EventTypeRequestCancelExternalWorkflowExecutionFailed:
res += len(event.RequestCancelExternalWorkflowExecutionFailedEventAttributes.Control)
case types.EventTypeExternalWorkflowExecutionCancelRequested:
case types.EventTypeMarkerRecorded:
res += len(event.MarkerRecordedEventAttributes.Details)
case types.EventTypeWorkflowExecutionSignaled:
res += len(event.WorkflowExecutionSignaledEventAttributes.Input)
case types.EventTypeWorkflowExecutionTerminated:
res += len(event.WorkflowExecutionTerminatedEventAttributes.Details)
case types.EventTypeWorkflowExecutionContinuedAsNew:
res += len(event.WorkflowExecutionContinuedAsNewEventAttributes.Input)
if event.WorkflowExecutionContinuedAsNewEventAttributes.Memo != nil {
res += GetSizeOfMapStringToByteArray(event.WorkflowExecutionContinuedAsNewEventAttributes.Memo.Fields)
}
if event.WorkflowExecutionContinuedAsNewEventAttributes.Header != nil {
res += GetSizeOfMapStringToByteArray(event.WorkflowExecutionContinuedAsNewEventAttributes.Header.Fields)
}
if event.WorkflowExecutionContinuedAsNewEventAttributes.SearchAttributes != nil {
res += GetSizeOfMapStringToByteArray(event.WorkflowExecutionContinuedAsNewEventAttributes.SearchAttributes.IndexedFields)
}
case types.EventTypeStartChildWorkflowExecutionInitiated:
res += len(event.StartChildWorkflowExecutionInitiatedEventAttributes.Input)
res += len(event.StartChildWorkflowExecutionInitiatedEventAttributes.Control)
if event.StartChildWorkflowExecutionInitiatedEventAttributes.Memo != nil {
res += GetSizeOfMapStringToByteArray(event.StartChildWorkflowExecutionInitiatedEventAttributes.Memo.Fields)
}
if event.StartChildWorkflowExecutionInitiatedEventAttributes.Header != nil {
res += GetSizeOfMapStringToByteArray(event.StartChildWorkflowExecutionInitiatedEventAttributes.Header.Fields)
}
if event.StartChildWorkflowExecutionInitiatedEventAttributes.SearchAttributes != nil {
res += GetSizeOfMapStringToByteArray(event.StartChildWorkflowExecutionInitiatedEventAttributes.SearchAttributes.IndexedFields)
}
case types.EventTypeStartChildWorkflowExecutionFailed:
res += len(event.StartChildWorkflowExecutionFailedEventAttributes.Control)
case types.EventTypeChildWorkflowExecutionStarted:
if event.ChildWorkflowExecutionStartedEventAttributes != nil && event.ChildWorkflowExecutionStartedEventAttributes.Header != nil {
res += GetSizeOfMapStringToByteArray(event.ChildWorkflowExecutionStartedEventAttributes.Header.Fields)
}
case types.EventTypeChildWorkflowExecutionCompleted:
res += len(event.ChildWorkflowExecutionCompletedEventAttributes.Result)
case types.EventTypeChildWorkflowExecutionFailed:
res += len(event.ChildWorkflowExecutionFailedEventAttributes.Details)
case types.EventTypeChildWorkflowExecutionCanceled:
res += len(event.ChildWorkflowExecutionCanceledEventAttributes.Details)
case types.EventTypeChildWorkflowExecutionTimedOut:
case types.EventTypeChildWorkflowExecutionTerminated:
case types.EventTypeSignalExternalWorkflowExecutionInitiated:
res += len(event.SignalExternalWorkflowExecutionInitiatedEventAttributes.Input)
res += len(event.SignalExternalWorkflowExecutionInitiatedEventAttributes.Control)
case types.EventTypeSignalExternalWorkflowExecutionFailed:
res += len(event.SignalExternalWorkflowExecutionFailedEventAttributes.Control)
case types.EventTypeExternalWorkflowExecutionSignaled:
res += len(event.ExternalWorkflowExecutionSignaledEventAttributes.Control)
case types.EventTypeUpsertWorkflowSearchAttributes:
if event.UpsertWorkflowSearchAttributesEventAttributes.SearchAttributes != nil {
res += GetSizeOfMapStringToByteArray(event.UpsertWorkflowSearchAttributesEventAttributes.SearchAttributes.IndexedFields)
}
}
return uint64(res)
}