Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop pointers for domain name/id fields #3916

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/ndc/history_resender.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (n *HistoryResenderImpl) createReplicationRawRequest(
) *types.ReplicateEventsV2Request {

request := &types.ReplicateEventsV2Request{
DomainUUID: common.StringPtr(domainID),
DomainUUID: domainID,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(workflowID),
RunID: common.StringPtr(runID),
Expand Down Expand Up @@ -282,7 +282,7 @@ func (n *HistoryResenderImpl) getHistory(
ctx, cancel := context.WithTimeout(ctx, resendContextTimeout)
defer cancel()
response, err := n.adminClient.GetWorkflowExecutionRawHistoryV2(ctx, &types.GetWorkflowExecutionRawHistoryV2Request{
Domain: common.StringPtr(domainName),
Domain: domainName,
Execution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(workflowID),
RunID: common.StringPtr(runID),
Expand Down
16 changes: 8 additions & 8 deletions common/ndc/history_resender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (s *historyResenderSuite) TestSendSingleWorkflowHistory() {
s.mockAdminClient.EXPECT().GetWorkflowExecutionRawHistoryV2(
gomock.Any(),
&types.GetWorkflowExecutionRawHistoryV2Request{
Domain: common.StringPtr(s.domainName),
Domain: s.domainName,
Execution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(workflowID),
RunID: common.StringPtr(runID),
Expand All @@ -178,7 +178,7 @@ func (s *historyResenderSuite) TestSendSingleWorkflowHistory() {
s.mockAdminClient.EXPECT().GetWorkflowExecutionRawHistoryV2(
gomock.Any(),
&types.GetWorkflowExecutionRawHistoryV2Request{
Domain: common.StringPtr(s.domainName),
Domain: s.domainName,
Execution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(workflowID),
RunID: common.StringPtr(runID),
Expand All @@ -198,7 +198,7 @@ func (s *historyResenderSuite) TestSendSingleWorkflowHistory() {
s.mockHistoryClient.EXPECT().ReplicateEventsV2(
gomock.Any(),
&types.ReplicateEventsV2Request{
DomainUUID: common.StringPtr(s.domainID),
DomainUUID: s.domainID,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(workflowID),
RunID: common.StringPtr(runID),
Expand Down Expand Up @@ -235,7 +235,7 @@ func (s *historyResenderSuite) TestCreateReplicateRawEventsRequest() {
}

s.Equal(&types.ReplicateEventsV2Request{
DomainUUID: common.StringPtr(s.domainID),
DomainUUID: s.domainID,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(workflowID),
RunID: common.StringPtr(runID),
Expand All @@ -258,7 +258,7 @@ func (s *historyResenderSuite) TestSendReplicationRawRequest() {
Version: common.Int64Ptr(1),
}
request := &types.ReplicateEventsV2Request{
DomainUUID: common.StringPtr(s.domainID),
DomainUUID: s.domainID,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(workflowID),
RunID: common.StringPtr(runID),
Expand All @@ -283,7 +283,7 @@ func (s *historyResenderSuite) TestSendReplicationRawRequest_Err() {
Version: common.Int64Ptr(1),
}
request := &types.ReplicateEventsV2Request{
DomainUUID: common.StringPtr(s.domainID),
DomainUUID: s.domainID,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(workflowID),
RunID: common.StringPtr(runID),
Expand All @@ -295,7 +295,7 @@ func (s *historyResenderSuite) TestSendReplicationRawRequest_Err() {
VersionHistoryItems: []*types.VersionHistoryItem{item},
}
retryErr := &types.RetryTaskV2Error{
DomainID: common.StringPtr(s.domainID),
DomainID: s.domainID,
WorkflowID: common.StringPtr(workflowID),
RunID: common.StringPtr(runID),
}
Expand Down Expand Up @@ -325,7 +325,7 @@ func (s *historyResenderSuite) TestGetHistory() {
NextPageToken: nextTokenOut,
}
s.mockAdminClient.EXPECT().GetWorkflowExecutionRawHistoryV2(gomock.Any(), &types.GetWorkflowExecutionRawHistoryV2Request{
Domain: common.StringPtr(s.domainName),
Domain: s.domainName,
Execution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(workflowID),
RunID: common.StringPtr(runID),
Expand Down
28 changes: 14 additions & 14 deletions common/testing/history_event_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ func InitializeHistoryEventGenerator(
historyEvent := getDefaultHistoryEvent(EventID, version)
historyEvent.EventType = types.EventTypeStartChildWorkflowExecutionInitiated.Ptr()
historyEvent.StartChildWorkflowExecutionInitiatedEventAttributes = &types.StartChildWorkflowExecutionInitiatedEventAttributes{
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowID: common.StringPtr(childWorkflowID),
WorkflowType: &types.WorkflowType{
Name: common.StringPtr(childWorkflowPrefix + workflowType),
Expand All @@ -639,7 +639,7 @@ func InitializeHistoryEventGenerator(
historyEvent := getDefaultHistoryEvent(EventID, version)
historyEvent.EventType = types.EventTypeStartChildWorkflowExecutionFailed.Ptr()
historyEvent.StartChildWorkflowExecutionFailedEventAttributes = &types.StartChildWorkflowExecutionFailedEventAttributes{
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowID: common.StringPtr(childWorkflowID),
WorkflowType: &types.WorkflowType{
Name: common.StringPtr(childWorkflowPrefix + workflowType),
Expand All @@ -659,7 +659,7 @@ func InitializeHistoryEventGenerator(
historyEvent := getDefaultHistoryEvent(EventID, version)
historyEvent.EventType = types.EventTypeChildWorkflowExecutionStarted.Ptr()
historyEvent.ChildWorkflowExecutionStartedEventAttributes = &types.ChildWorkflowExecutionStartedEventAttributes{
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowType: &types.WorkflowType{
Name: common.StringPtr(childWorkflowPrefix + workflowType),
},
Expand All @@ -680,7 +680,7 @@ func InitializeHistoryEventGenerator(
historyEvent := getDefaultHistoryEvent(EventID, version)
historyEvent.EventType = types.EventTypeChildWorkflowExecutionCanceled.Ptr()
historyEvent.ChildWorkflowExecutionCanceledEventAttributes = &types.ChildWorkflowExecutionCanceledEventAttributes{
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowType: &types.WorkflowType{
Name: common.StringPtr(childWorkflowPrefix + workflowType),
},
Expand All @@ -702,7 +702,7 @@ func InitializeHistoryEventGenerator(
historyEvent := getDefaultHistoryEvent(EventID, version)
historyEvent.EventType = types.EventTypeChildWorkflowExecutionCompleted.Ptr()
historyEvent.ChildWorkflowExecutionCompletedEventAttributes = &types.ChildWorkflowExecutionCompletedEventAttributes{
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowType: &types.WorkflowType{
Name: common.StringPtr(childWorkflowPrefix + workflowType),
},
Expand All @@ -724,7 +724,7 @@ func InitializeHistoryEventGenerator(
historyEvent := getDefaultHistoryEvent(EventID, version)
historyEvent.EventType = types.EventTypeChildWorkflowExecutionFailed.Ptr()
historyEvent.ChildWorkflowExecutionFailedEventAttributes = &types.ChildWorkflowExecutionFailedEventAttributes{
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowType: &types.WorkflowType{
Name: common.StringPtr(childWorkflowPrefix + workflowType),
},
Expand All @@ -746,7 +746,7 @@ func InitializeHistoryEventGenerator(
historyEvent := getDefaultHistoryEvent(EventID, version)
historyEvent.EventType = types.EventTypeChildWorkflowExecutionTerminated.Ptr()
historyEvent.ChildWorkflowExecutionTerminatedEventAttributes = &types.ChildWorkflowExecutionTerminatedEventAttributes{
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowType: &types.WorkflowType{
Name: common.StringPtr(childWorkflowPrefix + workflowType),
},
Expand All @@ -768,7 +768,7 @@ func InitializeHistoryEventGenerator(
historyEvent := getDefaultHistoryEvent(EventID, version)
historyEvent.EventType = types.EventTypeChildWorkflowExecutionTimedOut.Ptr()
historyEvent.ChildWorkflowExecutionTimedOutEventAttributes = &types.ChildWorkflowExecutionTimedOutEventAttributes{
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowType: &types.WorkflowType{
Name: common.StringPtr(childWorkflowPrefix + workflowType),
},
Expand Down Expand Up @@ -820,7 +820,7 @@ func InitializeHistoryEventGenerator(
historyEvent.EventType = types.EventTypeSignalExternalWorkflowExecutionInitiated.Ptr()
historyEvent.SignalExternalWorkflowExecutionInitiatedEventAttributes = &types.SignalExternalWorkflowExecutionInitiatedEventAttributes{
DecisionTaskCompletedEventID: lastEvent.EventID,
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(externalWorkflowID),
RunID: common.StringPtr(uuid.New()),
Expand All @@ -841,7 +841,7 @@ func InitializeHistoryEventGenerator(
historyEvent.SignalExternalWorkflowExecutionFailedEventAttributes = &types.SignalExternalWorkflowExecutionFailedEventAttributes{
Cause: types.SignalExternalWorkflowExecutionFailedCauseUnknownExternalWorkflowExecution.Ptr(),
DecisionTaskCompletedEventID: lastEvent.GetSignalExternalWorkflowExecutionInitiatedEventAttributes().DecisionTaskCompletedEventID,
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: lastEvent.GetSignalExternalWorkflowExecutionInitiatedEventAttributes().GetWorkflowExecution().WorkflowID,
RunID: lastEvent.GetSignalExternalWorkflowExecutionInitiatedEventAttributes().GetWorkflowExecution().RunID,
Expand All @@ -860,7 +860,7 @@ func InitializeHistoryEventGenerator(
historyEvent.EventType = types.EventTypeExternalWorkflowExecutionSignaled.Ptr()
historyEvent.ExternalWorkflowExecutionSignaledEventAttributes = &types.ExternalWorkflowExecutionSignaledEventAttributes{
InitiatedEventID: lastEvent.EventID,
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: lastEvent.GetSignalExternalWorkflowExecutionInitiatedEventAttributes().GetWorkflowExecution().WorkflowID,
RunID: lastEvent.GetSignalExternalWorkflowExecutionInitiatedEventAttributes().GetWorkflowExecution().RunID,
Expand All @@ -879,7 +879,7 @@ func InitializeHistoryEventGenerator(
historyEvent.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes =
&types.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes{
DecisionTaskCompletedEventID: lastEvent.EventID,
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: common.StringPtr(externalWorkflowID),
RunID: common.StringPtr(uuid.New()),
Expand All @@ -899,7 +899,7 @@ func InitializeHistoryEventGenerator(
historyEvent.RequestCancelExternalWorkflowExecutionFailedEventAttributes = &types.RequestCancelExternalWorkflowExecutionFailedEventAttributes{
Cause: types.CancelExternalWorkflowExecutionFailedCauseUnknownExternalWorkflowExecution.Ptr(),
DecisionTaskCompletedEventID: lastEvent.GetRequestCancelExternalWorkflowExecutionInitiatedEventAttributes().DecisionTaskCompletedEventID,
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: lastEvent.GetRequestCancelExternalWorkflowExecutionInitiatedEventAttributes().GetWorkflowExecution().WorkflowID,
RunID: lastEvent.GetRequestCancelExternalWorkflowExecutionInitiatedEventAttributes().GetWorkflowExecution().RunID,
Expand All @@ -918,7 +918,7 @@ func InitializeHistoryEventGenerator(
historyEvent.EventType = types.EventTypeExternalWorkflowExecutionCancelRequested.Ptr()
historyEvent.ExternalWorkflowExecutionCancelRequestedEventAttributes = &types.ExternalWorkflowExecutionCancelRequestedEventAttributes{
InitiatedEventID: lastEvent.EventID,
Domain: common.StringPtr(domain),
Domain: domain,
WorkflowExecution: &types.WorkflowExecution{
WorkflowID: lastEvent.GetRequestCancelExternalWorkflowExecutionInitiatedEventAttributes().GetWorkflowExecution().WorkflowID,
RunID: lastEvent.GetRequestCancelExternalWorkflowExecutionInitiatedEventAttributes().GetWorkflowExecution().RunID,
Expand Down
18 changes: 9 additions & 9 deletions common/types/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -1011,14 +1011,14 @@ func (v *DescribeClusterResponse) GetMembershipInfo() (o *MembershipInfo) {

// AdminDescribeWorkflowExecutionRequest is an internal type (TBD...)
type AdminDescribeWorkflowExecutionRequest struct {
Domain *string `json:"domain,omitempty"`
Domain string `json:"domain,omitempty"`
Execution *WorkflowExecution `json:"execution,omitempty"`
}

// GetDomain is an internal getter (TBD...)
func (v *AdminDescribeWorkflowExecutionRequest) GetDomain() (o string) {
if v != nil && v.Domain != nil {
return *v.Domain
if v != nil {
return v.Domain
}
return
}
Expand Down Expand Up @@ -1073,7 +1073,7 @@ func (v *AdminDescribeWorkflowExecutionResponse) GetMutableStateInDatabase() (o

// GetWorkflowExecutionRawHistoryV2Request is an internal type (TBD...)
type GetWorkflowExecutionRawHistoryV2Request struct {
Domain *string `json:"domain,omitempty"`
Domain string `json:"domain,omitempty"`
Execution *WorkflowExecution `json:"execution,omitempty"`
StartEventID *int64 `json:"startEventId,omitempty"`
StartEventVersion *int64 `json:"startEventVersion,omitempty"`
Expand All @@ -1085,8 +1085,8 @@ type GetWorkflowExecutionRawHistoryV2Request struct {

// GetDomain is an internal getter (TBD...)
func (v *GetWorkflowExecutionRawHistoryV2Request) GetDomain() (o string) {
if v != nil && v.Domain != nil {
return *v.Domain
if v != nil {
return v.Domain
}
return
}
Expand Down Expand Up @@ -1224,7 +1224,7 @@ func (v *MembershipInfo) GetRings() (o []*RingInfo) {

// ResendReplicationTasksRequest is an internal type (TBD...)
type ResendReplicationTasksRequest struct {
DomainID *string `json:"domainID,omitempty"`
DomainID string `json:"domainID,omitempty"`
WorkflowID *string `json:"workflowID,omitempty"`
RunID *string `json:"runID,omitempty"`
RemoteCluster *string `json:"remoteCluster,omitempty"`
Expand All @@ -1236,8 +1236,8 @@ type ResendReplicationTasksRequest struct {

// GetDomainID is an internal getter (TBD...)
func (v *ResendReplicationTasksRequest) GetDomainID() (o string) {
if v != nil && v.DomainID != nil {
return *v.DomainID
if v != nil {
return v.DomainID
}
return
}
Expand Down
4 changes: 1 addition & 3 deletions common/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ func (err RemoteSyncMatchedError) Error() string {
func (err RetryTaskV2Error) Error() string {
sb := &strings.Builder{}
printField(sb, "Message", err.Message)
if err.DomainID != nil {
printField(sb, "DomainID", *err.DomainID)
}
printField(sb, "DomainID", err.DomainID)
if err.WorkflowID != nil {
printField(sb, "WorkflowID", *err.WorkflowID)
}
Expand Down
Loading