Skip to content

Commit

Permalink
Drop pointer on request id fields (#3928)
Browse files Browse the repository at this point in the history
  • Loading branch information
vytautas-karpavicius authored Jan 29, 2021
1 parent 6b5c103 commit e3d0943
Show file tree
Hide file tree
Showing 34 changed files with 259 additions and 264 deletions.
4 changes: 2 additions & 2 deletions common/testing/history_event_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func InitializeHistoryEventGenerator(
historyEvent.DecisionTaskStartedEventAttributes = &types.DecisionTaskStartedEventAttributes{
ScheduledEventID: lastEvent.EventID,
Identity: identity,
RequestID: common.StringPtr(uuid.New()),
RequestID: uuid.New(),
}
return historyEvent
})
Expand Down Expand Up @@ -411,7 +411,7 @@ func InitializeHistoryEventGenerator(
historyEvent.ActivityTaskStartedEventAttributes = &types.ActivityTaskStartedEventAttributes{
ScheduledEventID: lastEvent.EventID,
Identity: identity,
RequestID: common.StringPtr(uuid.New()),
RequestID: uuid.New(),
Attempt: common.Int32Ptr(0),
}
return historyEvent
Expand Down
4 changes: 1 addition & 3 deletions common/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ func (err WorkflowExecutionAlreadyStartedError) Error() string {
if err.Message != nil {
printField(sb, "Message", *err.Message)
}
if err.StartRequestID != nil {
printField(sb, "StartRequestID", *err.StartRequestID)
}
printField(sb, "StartRequestID", err.StartRequestID)
printField(sb, "RunID", err.RunID)
return fmt.Sprintf("WorkflowExecutionAlreadyStartedError{%s}", sb.String())
}
Expand Down
18 changes: 9 additions & 9 deletions common/types/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -3659,7 +3659,7 @@ type RecordActivityTaskStartedRequest struct {
WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"`
ScheduleID *int64 `json:"scheduleId,omitempty"`
TaskID *int64 `json:"taskId,omitempty"`
RequestID *string `json:"requestId,omitempty"`
RequestID string `json:"requestId,omitempty"`
PollRequest *PollForActivityTaskRequest `json:"pollRequest,omitempty"`
}

Expand Down Expand Up @@ -3697,8 +3697,8 @@ func (v *RecordActivityTaskStartedRequest) GetTaskID() (o int64) {

// GetRequestID is an internal getter (TBD...)
func (v *RecordActivityTaskStartedRequest) GetRequestID() (o string) {
if v != nil && v.RequestID != nil {
return *v.RequestID
if v != nil {
return v.RequestID
}
return
}
Expand Down Expand Up @@ -3833,7 +3833,7 @@ type RecordDecisionTaskStartedRequest struct {
WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"`
ScheduleID *int64 `json:"scheduleId,omitempty"`
TaskID *int64 `json:"taskId,omitempty"`
RequestID *string `json:"requestId,omitempty"`
RequestID string `json:"requestId,omitempty"`
PollRequest *PollForDecisionTaskRequest `json:"pollRequest,omitempty"`
}

Expand Down Expand Up @@ -3871,8 +3871,8 @@ func (v *RecordDecisionTaskStartedRequest) GetTaskID() (o int64) {

// GetRequestID is an internal getter (TBD...)
func (v *RecordDecisionTaskStartedRequest) GetRequestID() (o string) {
if v != nil && v.RequestID != nil {
return *v.RequestID
if v != nil {
return v.RequestID
}
return
}
Expand Down Expand Up @@ -4041,7 +4041,7 @@ func (v *HistoryRefreshWorkflowTasksRequest) GetRequest() (o *RefreshWorkflowTas
type RemoveSignalMutableStateRequest struct {
DomainUUID string `json:"domainUUID,omitempty"`
WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"`
RequestID *string `json:"requestId,omitempty"`
RequestID string `json:"requestId,omitempty"`
}

// GetDomainUUID is an internal getter (TBD...)
Expand All @@ -4062,8 +4062,8 @@ func (v *RemoveSignalMutableStateRequest) GetWorkflowExecution() (o *WorkflowExe

// GetRequestID is an internal getter (TBD...)
func (v *RemoveSignalMutableStateRequest) GetRequestID() (o string) {
if v != nil && v.RequestID != nil {
return *v.RequestID
if v != nil {
return v.RequestID
}
return
}
Expand Down
12 changes: 6 additions & 6 deletions common/types/mapper/thrift/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -2486,7 +2486,7 @@ func FromRecordActivityTaskStartedRequest(t *types.RecordActivityTaskStartedRequ
WorkflowExecution: FromWorkflowExecution(t.WorkflowExecution),
ScheduleId: t.ScheduleID,
TaskId: t.TaskID,
RequestId: t.RequestID,
RequestId: &t.RequestID,
PollRequest: FromPollForActivityTaskRequest(t.PollRequest),
}
}
Expand All @@ -2501,7 +2501,7 @@ func ToRecordActivityTaskStartedRequest(t *history.RecordActivityTaskStartedRequ
WorkflowExecution: ToWorkflowExecution(t.WorkflowExecution),
ScheduleID: t.ScheduleId,
TaskID: t.TaskId,
RequestID: t.RequestId,
RequestID: t.GetRequestId(),
PollRequest: ToPollForActivityTaskRequest(t.PollRequest),
}
}
Expand Down Expand Up @@ -2576,7 +2576,7 @@ func FromRecordDecisionTaskStartedRequest(t *types.RecordDecisionTaskStartedRequ
WorkflowExecution: FromWorkflowExecution(t.WorkflowExecution),
ScheduleId: t.ScheduleID,
TaskId: t.TaskID,
RequestId: t.RequestID,
RequestId: &t.RequestID,
PollRequest: FromPollForDecisionTaskRequest(t.PollRequest),
}
}
Expand All @@ -2591,7 +2591,7 @@ func ToRecordDecisionTaskStartedRequest(t *history.RecordDecisionTaskStartedRequ
WorkflowExecution: ToWorkflowExecution(t.WorkflowExecution),
ScheduleID: t.ScheduleId,
TaskID: t.TaskId,
RequestID: t.RequestId,
RequestID: t.GetRequestId(),
PollRequest: ToPollForDecisionTaskRequest(t.PollRequest),
}
}
Expand Down Expand Up @@ -2672,7 +2672,7 @@ func FromRemoveSignalMutableStateRequest(t *types.RemoveSignalMutableStateReques
return &history.RemoveSignalMutableStateRequest{
DomainUUID: &t.DomainUUID,
WorkflowExecution: FromWorkflowExecution(t.WorkflowExecution),
RequestId: t.RequestID,
RequestId: &t.RequestID,
}
}

Expand All @@ -2684,7 +2684,7 @@ func ToRemoveSignalMutableStateRequest(t *history.RemoveSignalMutableStateReques
return &types.RemoveSignalMutableStateRequest{
DomainUUID: t.GetDomainUUID(),
WorkflowExecution: ToWorkflowExecution(t.WorkflowExecution),
RequestID: t.RequestId,
RequestID: t.GetRequestId(),
}
}

Expand Down
32 changes: 16 additions & 16 deletions common/types/mapper/thrift/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func FromActivityTaskStartedEventAttributes(t *types.ActivityTaskStartedEventAtt
return &shared.ActivityTaskStartedEventAttributes{
ScheduledEventId: t.ScheduledEventID,
Identity: &t.Identity,
RequestId: t.RequestID,
RequestId: &t.RequestID,
Attempt: t.Attempt,
LastFailureReason: t.LastFailureReason,
LastFailureDetails: t.LastFailureDetails,
Expand All @@ -243,7 +243,7 @@ func ToActivityTaskStartedEventAttributes(t *shared.ActivityTaskStartedEventAttr
return &types.ActivityTaskStartedEventAttributes{
ScheduledEventID: t.ScheduledEventId,
Identity: t.GetIdentity(),
RequestID: t.RequestId,
RequestID: t.GetRequestId(),
Attempt: t.Attempt,
LastFailureReason: t.LastFailureReason,
LastFailureDetails: t.LastFailureDetails,
Expand Down Expand Up @@ -1290,7 +1290,7 @@ func FromDecisionTaskStartedEventAttributes(t *types.DecisionTaskStartedEventAtt
return &shared.DecisionTaskStartedEventAttributes{
ScheduledEventId: t.ScheduledEventID,
Identity: &t.Identity,
RequestId: t.RequestID,
RequestId: &t.RequestID,
}
}

Expand All @@ -1302,7 +1302,7 @@ func ToDecisionTaskStartedEventAttributes(t *shared.DecisionTaskStartedEventAttr
return &types.DecisionTaskStartedEventAttributes{
ScheduledEventID: t.ScheduledEventId,
Identity: t.GetIdentity(),
RequestID: t.RequestId,
RequestID: t.GetRequestId(),
}
}

Expand Down Expand Up @@ -4035,7 +4035,7 @@ func FromRequestCancelWorkflowExecutionRequest(t *types.RequestCancelWorkflowExe
Domain: &t.Domain,
WorkflowExecution: FromWorkflowExecution(t.WorkflowExecution),
Identity: &t.Identity,
RequestId: t.RequestID,
RequestId: &t.RequestID,
}
}

Expand All @@ -4048,7 +4048,7 @@ func ToRequestCancelWorkflowExecutionRequest(t *shared.RequestCancelWorkflowExec
Domain: t.GetDomain(),
WorkflowExecution: ToWorkflowExecution(t.WorkflowExecution),
Identity: t.GetIdentity(),
RequestID: t.RequestId,
RequestID: t.GetRequestId(),
}
}

Expand Down Expand Up @@ -4174,7 +4174,7 @@ func FromResetWorkflowExecutionRequest(t *types.ResetWorkflowExecutionRequest) *
WorkflowExecution: FromWorkflowExecution(t.WorkflowExecution),
Reason: t.Reason,
DecisionFinishEventId: t.DecisionFinishEventID,
RequestId: t.RequestID,
RequestId: &t.RequestID,
SkipSignalReapply: t.SkipSignalReapply,
}
}
Expand All @@ -4189,7 +4189,7 @@ func ToResetWorkflowExecutionRequest(t *shared.ResetWorkflowExecutionRequest) *t
WorkflowExecution: ToWorkflowExecution(t.WorkflowExecution),
Reason: t.Reason,
DecisionFinishEventID: t.DecisionFinishEventId,
RequestID: t.RequestId,
RequestID: t.GetRequestId(),
SkipSignalReapply: t.SkipSignalReapply,
}
}
Expand Down Expand Up @@ -4772,7 +4772,7 @@ func FromSignalWithStartWorkflowExecutionRequest(t *types.SignalWithStartWorkflo
ExecutionStartToCloseTimeoutSeconds: t.ExecutionStartToCloseTimeoutSeconds,
TaskStartToCloseTimeoutSeconds: t.TaskStartToCloseTimeoutSeconds,
Identity: &t.Identity,
RequestId: t.RequestID,
RequestId: &t.RequestID,
WorkflowIdReusePolicy: FromWorkflowIDReusePolicy(t.WorkflowIDReusePolicy),
SignalName: t.SignalName,
SignalInput: t.SignalInput,
Expand All @@ -4799,7 +4799,7 @@ func ToSignalWithStartWorkflowExecutionRequest(t *shared.SignalWithStartWorkflow
ExecutionStartToCloseTimeoutSeconds: t.ExecutionStartToCloseTimeoutSeconds,
TaskStartToCloseTimeoutSeconds: t.TaskStartToCloseTimeoutSeconds,
Identity: t.GetIdentity(),
RequestID: t.RequestId,
RequestID: t.GetRequestId(),
WorkflowIDReusePolicy: ToWorkflowIDReusePolicy(t.WorkflowIdReusePolicy),
SignalName: t.SignalName,
SignalInput: t.SignalInput,
Expand All @@ -4823,7 +4823,7 @@ func FromSignalWorkflowExecutionRequest(t *types.SignalWorkflowExecutionRequest)
SignalName: t.SignalName,
Input: t.Input,
Identity: &t.Identity,
RequestId: t.RequestID,
RequestId: &t.RequestID,
Control: t.Control,
}
}
Expand All @@ -4839,7 +4839,7 @@ func ToSignalWorkflowExecutionRequest(t *shared.SignalWorkflowExecutionRequest)
SignalName: t.SignalName,
Input: t.Input,
Identity: t.GetIdentity(),
RequestID: t.RequestId,
RequestID: t.GetRequestId(),
Control: t.Control,
}
}
Expand Down Expand Up @@ -5032,7 +5032,7 @@ func FromStartWorkflowExecutionRequest(t *types.StartWorkflowExecutionRequest) *
ExecutionStartToCloseTimeoutSeconds: t.ExecutionStartToCloseTimeoutSeconds,
TaskStartToCloseTimeoutSeconds: t.TaskStartToCloseTimeoutSeconds,
Identity: &t.Identity,
RequestId: t.RequestID,
RequestId: &t.RequestID,
WorkflowIdReusePolicy: FromWorkflowIDReusePolicy(t.WorkflowIDReusePolicy),
RetryPolicy: FromRetryPolicy(t.RetryPolicy),
CronSchedule: t.CronSchedule,
Expand All @@ -5056,7 +5056,7 @@ func ToStartWorkflowExecutionRequest(t *shared.StartWorkflowExecutionRequest) *t
ExecutionStartToCloseTimeoutSeconds: t.ExecutionStartToCloseTimeoutSeconds,
TaskStartToCloseTimeoutSeconds: t.TaskStartToCloseTimeoutSeconds,
Identity: t.GetIdentity(),
RequestID: t.RequestId,
RequestID: t.GetRequestId(),
WorkflowIDReusePolicy: ToWorkflowIDReusePolicy(t.WorkflowIdReusePolicy),
RetryPolicy: ToRetryPolicy(t.RetryPolicy),
CronSchedule: t.CronSchedule,
Expand Down Expand Up @@ -5717,7 +5717,7 @@ func FromWorkflowExecutionAlreadyStartedError(t *types.WorkflowExecutionAlreadyS
}
return &shared.WorkflowExecutionAlreadyStartedError{
Message: t.Message,
StartRequestId: t.StartRequestID,
StartRequestId: &t.StartRequestID,
RunId: &t.RunID,
}
}
Expand All @@ -5729,7 +5729,7 @@ func ToWorkflowExecutionAlreadyStartedError(t *shared.WorkflowExecutionAlreadySt
}
return &types.WorkflowExecutionAlreadyStartedError{
Message: t.Message,
StartRequestID: t.StartRequestId,
StartRequestID: t.GetStartRequestId(),
RunID: t.GetRunId(),
}
}
Expand Down
Loading

0 comments on commit e3d0943

Please sign in to comment.