Skip to content

Commit

Permalink
Drop pointer for signal name fields (cadence-workflow#3966)
Browse files Browse the repository at this point in the history
  • Loading branch information
vytautas-karpavicius authored Feb 10, 2021
1 parent c244e9d commit 663f74c
Show file tree
Hide file tree
Showing 25 changed files with 117 additions and 118 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 @@ -250,7 +250,7 @@ func InitializeHistoryEventGenerator(
historyEvent := getDefaultHistoryEvent(EventID, version)
historyEvent.EventType = types.EventTypeWorkflowExecutionSignaled.Ptr()
historyEvent.WorkflowExecutionSignaledEventAttributes = &types.WorkflowExecutionSignaledEventAttributes{
SignalName: common.StringPtr(signal),
SignalName: signal,
Identity: identity,
}
return historyEvent
Expand Down Expand Up @@ -825,7 +825,7 @@ func InitializeHistoryEventGenerator(
WorkflowID: externalWorkflowID,
RunID: uuid.New(),
},
SignalName: common.StringPtr("signal"),
SignalName: "signal",
ChildWorkflowOnly: false,
}
return historyEvent
Expand Down
20 changes: 10 additions & 10 deletions common/types/mapper/thrift/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -4648,7 +4648,7 @@ func FromSignalExternalWorkflowExecutionDecisionAttributes(t *types.SignalExtern
return &shared.SignalExternalWorkflowExecutionDecisionAttributes{
Domain: &t.Domain,
Execution: FromWorkflowExecution(t.Execution),
SignalName: t.SignalName,
SignalName: &t.SignalName,
Input: t.Input,
Control: t.Control,
ChildWorkflowOnly: &t.ChildWorkflowOnly,
Expand All @@ -4663,7 +4663,7 @@ func ToSignalExternalWorkflowExecutionDecisionAttributes(t *shared.SignalExterna
return &types.SignalExternalWorkflowExecutionDecisionAttributes{
Domain: t.GetDomain(),
Execution: ToWorkflowExecution(t.Execution),
SignalName: t.SignalName,
SignalName: t.GetSignalName(),
Input: t.Input,
Control: t.Control,
ChildWorkflowOnly: t.GetChildWorkflowOnly(),
Expand Down Expand Up @@ -4735,7 +4735,7 @@ func FromSignalExternalWorkflowExecutionInitiatedEventAttributes(t *types.Signal
DecisionTaskCompletedEventId: &t.DecisionTaskCompletedEventID,
Domain: &t.Domain,
WorkflowExecution: FromWorkflowExecution(t.WorkflowExecution),
SignalName: t.SignalName,
SignalName: &t.SignalName,
Input: t.Input,
Control: t.Control,
ChildWorkflowOnly: &t.ChildWorkflowOnly,
Expand All @@ -4751,7 +4751,7 @@ func ToSignalExternalWorkflowExecutionInitiatedEventAttributes(t *shared.SignalE
DecisionTaskCompletedEventID: t.GetDecisionTaskCompletedEventId(),
Domain: t.GetDomain(),
WorkflowExecution: ToWorkflowExecution(t.WorkflowExecution),
SignalName: t.SignalName,
SignalName: t.GetSignalName(),
Input: t.Input,
Control: t.Control,
ChildWorkflowOnly: t.GetChildWorkflowOnly(),
Expand All @@ -4774,7 +4774,7 @@ func FromSignalWithStartWorkflowExecutionRequest(t *types.SignalWithStartWorkflo
Identity: &t.Identity,
RequestId: &t.RequestID,
WorkflowIdReusePolicy: FromWorkflowIDReusePolicy(t.WorkflowIDReusePolicy),
SignalName: t.SignalName,
SignalName: &t.SignalName,
SignalInput: t.SignalInput,
Control: t.Control,
RetryPolicy: FromRetryPolicy(t.RetryPolicy),
Expand All @@ -4801,7 +4801,7 @@ func ToSignalWithStartWorkflowExecutionRequest(t *shared.SignalWithStartWorkflow
Identity: t.GetIdentity(),
RequestID: t.GetRequestId(),
WorkflowIDReusePolicy: ToWorkflowIDReusePolicy(t.WorkflowIdReusePolicy),
SignalName: t.SignalName,
SignalName: t.GetSignalName(),
SignalInput: t.SignalInput,
Control: t.Control,
RetryPolicy: ToRetryPolicy(t.RetryPolicy),
Expand All @@ -4820,7 +4820,7 @@ func FromSignalWorkflowExecutionRequest(t *types.SignalWorkflowExecutionRequest)
return &shared.SignalWorkflowExecutionRequest{
Domain: &t.Domain,
WorkflowExecution: FromWorkflowExecution(t.WorkflowExecution),
SignalName: t.SignalName,
SignalName: &t.SignalName,
Input: t.Input,
Identity: &t.Identity,
RequestId: &t.RequestID,
Expand All @@ -4836,7 +4836,7 @@ func ToSignalWorkflowExecutionRequest(t *shared.SignalWorkflowExecutionRequest)
return &types.SignalWorkflowExecutionRequest{
Domain: t.GetDomain(),
WorkflowExecution: ToWorkflowExecution(t.WorkflowExecution),
SignalName: t.SignalName,
SignalName: t.GetSignalName(),
Input: t.Input,
Identity: t.GetIdentity(),
RequestID: t.GetRequestId(),
Expand Down Expand Up @@ -6048,7 +6048,7 @@ func FromWorkflowExecutionSignaledEventAttributes(t *types.WorkflowExecutionSign
return nil
}
return &shared.WorkflowExecutionSignaledEventAttributes{
SignalName: t.SignalName,
SignalName: &t.SignalName,
Input: t.Input,
Identity: &t.Identity,
}
Expand All @@ -6060,7 +6060,7 @@ func ToWorkflowExecutionSignaledEventAttributes(t *shared.WorkflowExecutionSigna
return nil
}
return &types.WorkflowExecutionSignaledEventAttributes{
SignalName: t.SignalName,
SignalName: t.GetSignalName(),
Input: t.Input,
Identity: t.GetIdentity(),
}
Expand Down
34 changes: 17 additions & 17 deletions common/types/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -7275,7 +7275,7 @@ func (v *ServiceBusyError) GetMessage() (o string) {
type SignalExternalWorkflowExecutionDecisionAttributes struct {
Domain string `json:"domain,omitempty"`
Execution *WorkflowExecution `json:"execution,omitempty"`
SignalName *string `json:"signalName,omitempty"`
SignalName string `json:"signalName,omitempty"`
Input []byte `json:"input,omitempty"`
Control []byte `json:"control,omitempty"`
ChildWorkflowOnly bool `json:"childWorkflowOnly,omitempty"`
Expand All @@ -7299,8 +7299,8 @@ func (v *SignalExternalWorkflowExecutionDecisionAttributes) GetExecution() (o *W

// GetSignalName is an internal getter (TBD...)
func (v *SignalExternalWorkflowExecutionDecisionAttributes) GetSignalName() (o string) {
if v != nil && v.SignalName != nil {
return *v.SignalName
if v != nil {
return v.SignalName
}
return
}
Expand Down Expand Up @@ -7436,7 +7436,7 @@ type SignalExternalWorkflowExecutionInitiatedEventAttributes struct {
DecisionTaskCompletedEventID int64 `json:"decisionTaskCompletedEventId,omitempty"`
Domain string `json:"domain,omitempty"`
WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"`
SignalName *string `json:"signalName,omitempty"`
SignalName string `json:"signalName,omitempty"`
Input []byte `json:"input,omitempty"`
Control []byte `json:"control,omitempty"`
ChildWorkflowOnly bool `json:"childWorkflowOnly,omitempty"`
Expand Down Expand Up @@ -7468,8 +7468,8 @@ func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) GetWorkflowExe

// GetSignalName is an internal getter (TBD...)
func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) GetSignalName() (o string) {
if v != nil && v.SignalName != nil {
return *v.SignalName
if v != nil {
return v.SignalName
}
return
}
Expand Down Expand Up @@ -7510,7 +7510,7 @@ type SignalWithStartWorkflowExecutionRequest struct {
Identity string `json:"identity,omitempty"`
RequestID string `json:"requestId,omitempty"`
WorkflowIDReusePolicy *WorkflowIDReusePolicy `json:"workflowIdReusePolicy,omitempty"`
SignalName *string `json:"signalName,omitempty"`
SignalName string `json:"signalName,omitempty"`
SignalInput []byte `json:"signalInput,omitempty"`
Control []byte `json:"control,omitempty"`
RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"`
Expand Down Expand Up @@ -7602,8 +7602,8 @@ func (v *SignalWithStartWorkflowExecutionRequest) GetWorkflowIDReusePolicy() (o

// GetSignalName is an internal getter (TBD...)
func (v *SignalWithStartWorkflowExecutionRequest) GetSignalName() (o string) {
if v != nil && v.SignalName != nil {
return *v.SignalName
if v != nil {
return v.SignalName
}
return
}
Expand Down Expand Up @@ -7668,7 +7668,7 @@ func (v *SignalWithStartWorkflowExecutionRequest) GetHeader() (o *Header) {
type SignalWorkflowExecutionRequest struct {
Domain string `json:"domain,omitempty"`
WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"`
SignalName *string `json:"signalName,omitempty"`
SignalName string `json:"signalName,omitempty"`
Input []byte `json:"input,omitempty"`
Identity string `json:"identity,omitempty"`
RequestID string `json:"requestId,omitempty"`
Expand All @@ -7693,8 +7693,8 @@ func (v *SignalWorkflowExecutionRequest) GetWorkflowExecution() (o *WorkflowExec

// GetSignalName is an internal getter (TBD...)
func (v *SignalWorkflowExecutionRequest) GetSignalName() (o string) {
if v != nil && v.SignalName != nil {
return *v.SignalName
if v != nil {
return v.SignalName
}
return
}
Expand Down Expand Up @@ -9586,15 +9586,15 @@ func (v *WorkflowExecutionInfo) GetTaskList() (o string) {

// WorkflowExecutionSignaledEventAttributes is an internal type (TBD...)
type WorkflowExecutionSignaledEventAttributes struct {
SignalName *string `json:"signalName,omitempty"`
Input []byte `json:"input,omitempty"`
Identity string `json:"identity,omitempty"`
SignalName string `json:"signalName,omitempty"`
Input []byte `json:"input,omitempty"`
Identity string `json:"identity,omitempty"`
}

// GetSignalName is an internal getter (TBD...)
func (v *WorkflowExecutionSignaledEventAttributes) GetSignalName() (o string) {
if v != nil && v.SignalName != nil {
return *v.SignalName
if v != nil {
return v.SignalName
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion host/activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ func (s *integrationSuite) TestActivityCancellationNotStarted() {
WorkflowID: id,
RunID: we.RunID,
},
SignalName: common.StringPtr(signalName),
SignalName: signalName,
Input: signalInput,
Identity: identity,
})
Expand Down
12 changes: 6 additions & 6 deletions host/decision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func (s *integrationSuite) TestWorkflowTerminationSignalBeforeRegularDecisionSta
err0 = s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: s.domainName,
WorkflowExecution: we,
SignalName: common.StringPtr("sig-for-integ-test"),
SignalName: "sig-for-integ-test",
Input: []byte(""),
Identity: "integ test",
RequestID: uuid.New(),
Expand Down Expand Up @@ -405,7 +405,7 @@ func (s *integrationSuite) TestWorkflowTerminationSignalAfterRegularDecisionStar
err0 = s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: s.domainName,
WorkflowExecution: we,
SignalName: common.StringPtr("sig-for-integ-test"),
SignalName: "sig-for-integ-test",
Input: []byte(""),
Identity: "integ test",
RequestID: uuid.New(),
Expand Down Expand Up @@ -482,7 +482,7 @@ func (s *integrationSuite) TestWorkflowTerminationSignalAfterRegularDecisionStar
err0 = s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: s.domainName,
WorkflowExecution: we,
SignalName: common.StringPtr("sig-for-integ-test"),
SignalName: "sig-for-integ-test",
Input: []byte(""),
Identity: "integ test",
RequestID: uuid.New(),
Expand Down Expand Up @@ -583,7 +583,7 @@ func (s *integrationSuite) TestWorkflowTerminationSignalBeforeTransientDecisionS
err0 = s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: s.domainName,
WorkflowExecution: we,
SignalName: common.StringPtr("sig-for-integ-test"),
SignalName: "sig-for-integ-test",
Input: []byte(""),
Identity: "integ test",
RequestID: uuid.New(),
Expand Down Expand Up @@ -699,7 +699,7 @@ func (s *integrationSuite) TestWorkflowTerminationSignalAfterTransientDecisionSt
err0 = s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: s.domainName,
WorkflowExecution: we,
SignalName: common.StringPtr("sig-for-integ-test"),
SignalName: "sig-for-integ-test",
Input: []byte(""),
Identity: "integ test",
RequestID: uuid.New(),
Expand Down Expand Up @@ -801,7 +801,7 @@ func (s *integrationSuite) TestWorkflowTerminationSignalAfterTransientDecisionSt
err0 = s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: s.domainName,
WorkflowExecution: we,
SignalName: common.StringPtr("sig-for-integ-test"),
SignalName: "sig-for-integ-test",
Input: []byte(""),
Identity: "integ test",
RequestID: uuid.New(),
Expand Down
18 changes: 9 additions & 9 deletions host/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ func (s *integrationSuite) TestBufferedEvents() {
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: id,
},
SignalName: common.StringPtr("buffered-signal"),
SignalName: "buffered-signal",
Input: []byte("buffered-signal-input"),
Identity: identity,
})
Expand Down Expand Up @@ -1617,7 +1617,7 @@ func (s *integrationSuite) TestBufferedEvents() {
s.Logger.Info("PollAndProcessDecisionTask", tag.Error(err))
s.Nil(err)
s.NotNil(signalEvent)
s.Equal(signalName, *signalEvent.WorkflowExecutionSignaledEventAttributes.SignalName)
s.Equal(signalName, signalEvent.WorkflowExecutionSignaledEventAttributes.SignalName)
s.Equal(identity, signalEvent.WorkflowExecutionSignaledEventAttributes.Identity)
s.True(workflowComplete)
}
Expand Down Expand Up @@ -2825,7 +2825,7 @@ func (s *integrationSuite) TestNoTransientDecisionAfterFlushBufferedEvents() {
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: id,
},
SignalName: common.StringPtr("buffered-signal-1"),
SignalName: "buffered-signal-1",
Input: []byte("buffered-signal-input"),
Identity: identity,
})
Expand Down Expand Up @@ -3197,7 +3197,7 @@ func (s *integrationSuite) TestStickyTimeout_NonTransientDecision() {
err = s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: s.domainName,
WorkflowExecution: workflowExecution,
SignalName: common.StringPtr("signalA"),
SignalName: "signalA",
Input: []byte("signal input"),
Identity: identity,
RequestID: uuid.New(),
Expand Down Expand Up @@ -3228,7 +3228,7 @@ WaitForStickyTimeoutLoop:
err = s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: s.domainName,
WorkflowExecution: workflowExecution,
SignalName: common.StringPtr("signalB"),
SignalName: "signalB",
Input: []byte("signal input"),
Identity: identity,
RequestID: uuid.New(),
Expand Down Expand Up @@ -3359,7 +3359,7 @@ func (s *integrationSuite) TestStickyTasklistResetThenTimeout() {
err = s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: s.domainName,
WorkflowExecution: workflowExecution,
SignalName: common.StringPtr("signalA"),
SignalName: "signalA",
Input: []byte("signal input"),
Identity: identity,
RequestID: uuid.New(),
Expand Down Expand Up @@ -3396,7 +3396,7 @@ WaitForStickyTimeoutLoop:
err = s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: s.domainName,
WorkflowExecution: workflowExecution,
SignalName: common.StringPtr("signalB"),
SignalName: "signalB",
Input: []byte("signal input"),
Identity: identity,
RequestID: uuid.New(),
Expand Down Expand Up @@ -3665,7 +3665,7 @@ func (s *integrationSuite) TestSignalWithStartWithMemo() {
Input: nil,
ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(100),
TaskStartToCloseTimeoutSeconds: common.Int32Ptr(1),
SignalName: common.StringPtr(signalName),
SignalName: signalName,
SignalInput: signalInput,
Identity: identity,
Memo: memo,
Expand Down Expand Up @@ -4067,7 +4067,7 @@ func (s *integrationSuite) sendSignal(domainName string, execution *types.Workfl
return s.engine.SignalWorkflowExecution(createContext(), &types.SignalWorkflowExecutionRequest{
Domain: domainName,
WorkflowExecution: execution,
SignalName: common.StringPtr(signalName),
SignalName: signalName,
Input: input,
Identity: identity,
})
Expand Down
Loading

0 comments on commit 663f74c

Please sign in to comment.