Skip to content

Commit

Permalink
Remove type prefix from enum values (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshtin authored Apr 4, 2020
1 parent 0d22f81 commit 34a5163
Show file tree
Hide file tree
Showing 169 changed files with 2,636 additions and 2,626 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ PROTO_ROOT := proto
# Note: using "shell find" instead of "wildcard" because "wildcard" caches directory structure.
PROTO_DIRS = $(sort $(dir $(shell find $(PROTO_ROOT) -name "*.proto" | grep -v temporal-proto)))
PROTO_SERVICES = $(shell find $(PROTO_ROOT) -name "*service.proto" | grep -v temporal-proto)
PROTO_IMPORT := $(PROTO_ROOT):$(PROTO_ROOT)/temporal-proto:$(GOPATH)/src/github.com/gogo/protobuf/protobuf
PROTO_IMPORT := $(PROTO_ROOT):$(PROTO_ROOT)/temporal-proto:$(GOPATH)/src/github.com/gogo/protobuf:$(GOPATH)/src/github.com/gogo/protobuf/protobuf
PROTO_GEN := .gen/proto

##### Tools #####
Expand Down Expand Up @@ -133,7 +133,7 @@ install-proto-submodule:
protoc: $(PROTO_GEN)
@printf $(COLOR) "Build proto files..."
# Run protoc separately for each directory because of different package names.
$(foreach PROTO_DIR,$(PROTO_DIRS),protoc --proto_path=$(PROTO_IMPORT) --gogoslick_out=Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,plugins=grpc,paths=source_relative:$(PROTO_GEN) $(PROTO_DIR)*.proto$(NEWLINE))
$(foreach PROTO_DIR,$(PROTO_DIRS),protoc --proto_path=$(PROTO_IMPORT) --gogoslick_out=Mprotobuf/google/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mprotobuf/google/protobuf/timestamp.proto=github.com/gogo/protobuf/types,plugins=grpc,paths=source_relative:$(PROTO_GEN) $(PROTO_DIR)*.proto$(NEWLINE))

# All gRPC generated service files pathes relative to PROTO_ROOT.
PROTO_GRPC_SERVICES = $(patsubst $(PROTO_GEN)/%,%,$(shell find $(PROTO_GEN) -name "service.pb.go"))
Expand Down
4 changes: 2 additions & 2 deletions canary/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ func (c *canaryImpl) createNamespace() error {
name := c.canaryNamespace
desc := "Namespace for running cadence canary workflows"
owner := "canary"
return c.canaryClient.createNamespace(name, desc, owner, namespacepb.ArchivalStatusDisabled)
return c.canaryClient.createNamespace(name, desc, owner, namespacepb.ArchivalStatus_Disabled)
}

func (c *canaryImpl) createArchivalNamespace() error {
name := archivalNamespace
desc := "Namespace used by cadence canary workflows to verify archival"
owner := "canary"
archivalStatus := namespacepb.ArchivalStatusEnabled
archivalStatus := namespacepb.ArchivalStatus_Enabled
return c.archivalClient.createNamespace(name, desc, owner, archivalStatus)
}

Expand Down
2 changes: 1 addition & 1 deletion canary/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type cadenceClient struct {
func (client *cadenceClient) createNamespace(name string, desc string, owner string, archivalStatus namespacepb.ArchivalStatus) error {
emitMetric := true
retention := int32(workflowRetentionDays)
if archivalStatus == namespacepb.ArchivalStatusEnabled {
if archivalStatus == namespacepb.ArchivalStatus_Enabled {
retention = int32(0)
}
req := &workflowservice.RegisterNamespaceRequest{
Expand Down
6 changes: 3 additions & 3 deletions canary/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ func triggerResetActivity(ctx context.Context, namespace string, baseWE workflow
return workflow.Execution{}, err
}
for _, event := range events {
if event.GetEventType() == eventpb.EventTypeDecisionTaskCompleted {
if event.GetEventType() == eventpb.EventType_DecisionTaskCompleted {
resetEventID = event.GetEventId()
}
if event.GetEventType() == eventpb.EventTypeSignalExternalWorkflowExecutionInitiated {
if event.GetEventType() == eventpb.EventType_SignalExternalWorkflowExecutionInitiated {
seenTrigger = true
break
}
Expand Down Expand Up @@ -237,7 +237,7 @@ func verifyResetActivity(ctx context.Context, namespace string, newWE workflow.E
if err != nil {
return err
}
if resp.WorkflowExecutionInfo.GetStatus() == executionpb.WorkflowExecutionStatusRunning || resp.WorkflowExecutionInfo.GetStatus() != executionpb.WorkflowExecutionStatusCompleted {
if resp.WorkflowExecutionInfo.GetStatus() == executionpb.WorkflowExecutionStatus_Running || resp.WorkflowExecutionInfo.GetStatus() != executionpb.WorkflowExecutionStatus_Completed {
return fmt.Errorf("new execution triggered by reset is not completed")
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion canary/visibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func getMyHistory(client cadenceClient, execInfo workflow.Execution, scope tally
defer sw.Stop()

var events []*eventpb.HistoryEvent
iter := client.GetWorkflowHistory(context.Background(), execInfo.ID, execInfo.RunID, false, filterpb.HistoryEventFilterTypeAllEvent)
iter := client.GetWorkflowHistory(context.Background(), execInfo.ID, execInfo.RunID, false, filterpb.HistoryEventFilterType_AllEvent)

for iter.HasNext() {
event, err := iter.Next()
Expand Down
2 changes: 1 addition & 1 deletion canary/visibilityArchival.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func visibilityArchivalActivity(ctx context.Context, scheduledTimeNanos int64) e
}

if resp.Configuration != nil &&
resp.Configuration.GetVisibilityArchivalStatus() == namespacepb.ArchivalStatusDisabled {
resp.Configuration.GetVisibilityArchivalStatus() == namespacepb.ArchivalStatus_Disabled {
return errors.New("namespace not configured for visibility archival")
}

Expand Down
2 changes: 1 addition & 1 deletion client/matching/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (lb *defaultLoadBalancer) pickPartition(
nPartitions dynamicconfig.IntPropertyFnWithTaskListInfoFilters,
) string {

if forwardedFrom != "" || taskList.GetKind() == tasklistpb.TaskListKindSticky {
if forwardedFrom != "" || taskList.GetKind() == tasklistpb.TaskListKind_Sticky {
return taskList.GetName()
}

Expand Down
8 changes: 4 additions & 4 deletions common/archiver/archivalMetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func NewDisabledArchvialConfig() ArchivalConfig {
staticClusterStatus: ArchivalDisabled,
dynamicClusterStatus: nil,
enableRead: nil,
namespaceDefaultStatus: namespacepb.ArchivalStatusDisabled,
namespaceDefaultStatus: namespacepb.ArchivalStatus_Disabled,
namespaceDefaultURI: "",
}
}
Expand Down Expand Up @@ -206,9 +206,9 @@ func getNamespaceArchivalStatus(str string) (namespacepb.ArchivalStatus, error)
str = strings.TrimSpace(strings.ToLower(str))
switch str {
case "", common.ArchivalDisabled:
return namespacepb.ArchivalStatusDisabled, nil
return namespacepb.ArchivalStatus_Disabled, nil
case common.ArchivalEnabled:
return namespacepb.ArchivalStatusEnabled, nil
return namespacepb.ArchivalStatus_Enabled, nil
}
return namespacepb.ArchivalStatusDisabled, fmt.Errorf("invalid archival status of %v for namespace, valid status are: {\"\", \"disabled\", \"enabled\"}", str)
return namespacepb.ArchivalStatus_Disabled, fmt.Errorf("invalid archival status of %v for namespace, valid status are: {\"\", \"disabled\", \"enabled\"}", str)
}
10 changes: 5 additions & 5 deletions common/archiver/filestore/queryParser.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,15 @@ func convertStatusStr(statusStr string) (executionpb.WorkflowExecutionStatus, er
statusStr = strings.ToLower(statusStr)
switch statusStr {
case "completed":
return executionpb.WorkflowExecutionStatusCompleted, nil
return executionpb.WorkflowExecutionStatus_Completed, nil
case "failed":
return executionpb.WorkflowExecutionStatusFailed, nil
return executionpb.WorkflowExecutionStatus_Failed, nil
case "canceled":
return executionpb.WorkflowExecutionStatusCanceled, nil
return executionpb.WorkflowExecutionStatus_Canceled, nil
case "continuedasnew":
return executionpb.WorkflowExecutionStatusContinuedAsNew, nil
return executionpb.WorkflowExecutionStatus_ContinuedAsNew, nil
case "timedout":
return executionpb.WorkflowExecutionStatusTimedOut, nil
return executionpb.WorkflowExecutionStatus_TimedOut, nil
default:
return 0, fmt.Errorf("unknown workflow close status: %s", statusStr)
}
Expand Down
8 changes: 4 additions & 4 deletions common/archiver/filestore/queryParser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,21 @@ func (s *queryParserSuite) TestParseCloseStatus() {
query: "ExecutionStatus = \"Completed\"",
expectErr: false,
parsedQuery: &parsedQuery{
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatusCompleted),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatus_Completed),
},
},
{
query: "ExecutionStatus = 'continuedasnew'",
expectErr: false,
parsedQuery: &parsedQuery{
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatusContinuedAsNew),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatus_ContinuedAsNew),
},
},
{
query: "ExecutionStatus = 'Failed' and ExecutionStatus = \"Failed\"",
expectErr: false,
parsedQuery: &parsedQuery{
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatusFailed),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatus_Failed),
},
},
{
Expand Down Expand Up @@ -296,7 +296,7 @@ func (s *queryParserSuite) TestParse() {
earliestCloseTime: 2000,
latestCloseTime: 9999,
runID: common.StringPtr("random runID"),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatusFailed),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatus_Failed),
},
},
{
Expand Down
22 changes: 11 additions & 11 deletions common/archiver/filestore/visibilityArchiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (s *visibilityArchiverSuite) TestArchive_Fail_InvalidURI() {
StartTimestamp: time.Now().UnixNano(),
ExecutionTimestamp: 0, // workflow without backoff
CloseTimestamp: time.Now().UnixNano(),
Status: executionpb.WorkflowExecutionStatusFailed,
Status: executionpb.WorkflowExecutionStatus_Failed,
HistoryLength: int64(101),
}
err = visibilityArchiver.Archive(context.Background(), URI, request)
Expand Down Expand Up @@ -171,7 +171,7 @@ func (s *visibilityArchiverSuite) TestArchive_Success() {
StartTimestamp: closeTimestamp.Add(-time.Hour).UnixNano(),
ExecutionTimestamp: 0, // workflow without backoff
CloseTimestamp: closeTimestamp.UnixNano(),
Status: executionpb.WorkflowExecutionStatusFailed,
Status: executionpb.WorkflowExecutionStatus_Failed,
HistoryLength: int64(101),
Memo: &commonpb.Memo{
Fields: map[string][]byte{
Expand Down Expand Up @@ -269,11 +269,11 @@ func (s *visibilityArchiverSuite) TestMatchQuery() {
earliestCloseTime: int64(1000),
latestCloseTime: int64(12345),
workflowTypeName: common.StringPtr("some random type name"),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatusContinuedAsNew),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatus_ContinuedAsNew),
},
record: &archiverproto.ArchiveVisibilityRequest{
CloseTimestamp: int64(12345),
Status: executionpb.WorkflowExecutionStatusContinuedAsNew,
Status: executionpb.WorkflowExecutionStatus_ContinuedAsNew,
WorkflowTypeName: "some random type name",
},
shouldMatch: true,
Expand Down Expand Up @@ -428,7 +428,7 @@ func (s *visibilityArchiverSuite) TestQuery_Success_SmallPageSize() {
mockParser.EXPECT().Parse(gomock.Any()).Return(&parsedQuery{
earliestCloseTime: int64(1),
latestCloseTime: int64(10001),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatusFailed),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatus_Failed),
}, nil).AnyTimes()
visibilityArchiver.queryParser = mockParser
request := &archiver.QueryVisibilityRequest{
Expand Down Expand Up @@ -465,7 +465,7 @@ func (s *visibilityArchiverSuite) TestArchiveAndQuery() {
mockParser.EXPECT().Parse(gomock.Any()).Return(&parsedQuery{
earliestCloseTime: int64(10),
latestCloseTime: int64(10001),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatusFailed),
status: toWorkflowExecutionStatusPtr(executionpb.WorkflowExecutionStatus_Failed),
}, nil).AnyTimes()
visibilityArchiver.queryParser = mockParser
URI, err := archiver.NewURI("file://" + dir)
Expand Down Expand Up @@ -513,7 +513,7 @@ func (s *visibilityArchiverSuite) setupVisibilityDirectory() {
WorkflowTypeName: testWorkflowTypeName,
StartTimestamp: 1,
CloseTimestamp: 10000,
Status: executionpb.WorkflowExecutionStatusFailed,
Status: executionpb.WorkflowExecutionStatus_Failed,
HistoryLength: 101,
},
{
Expand All @@ -525,7 +525,7 @@ func (s *visibilityArchiverSuite) setupVisibilityDirectory() {
StartTimestamp: 2,
ExecutionTimestamp: 0,
CloseTimestamp: 1000,
Status: executionpb.WorkflowExecutionStatusFailed,
Status: executionpb.WorkflowExecutionStatus_Failed,
HistoryLength: 123,
},
{
Expand All @@ -537,7 +537,7 @@ func (s *visibilityArchiverSuite) setupVisibilityDirectory() {
StartTimestamp: 3,
ExecutionTimestamp: 0,
CloseTimestamp: 10,
Status: executionpb.WorkflowExecutionStatusContinuedAsNew,
Status: executionpb.WorkflowExecutionStatus_ContinuedAsNew,
HistoryLength: 456,
},
{
Expand All @@ -549,7 +549,7 @@ func (s *visibilityArchiverSuite) setupVisibilityDirectory() {
StartTimestamp: 3,
ExecutionTimestamp: 0,
CloseTimestamp: 5,
Status: executionpb.WorkflowExecutionStatusFailed,
Status: executionpb.WorkflowExecutionStatus_Failed,
HistoryLength: 456,
},
{
Expand All @@ -561,7 +561,7 @@ func (s *visibilityArchiverSuite) setupVisibilityDirectory() {
StartTimestamp: 3,
ExecutionTimestamp: 0,
CloseTimestamp: 10000,
Status: executionpb.WorkflowExecutionStatusContinuedAsNew,
Status: executionpb.WorkflowExecutionStatus_ContinuedAsNew,
HistoryLength: 456,
},
}
Expand Down
Loading

0 comments on commit 34a5163

Please sign in to comment.