-
Notifications
You must be signed in to change notification settings - Fork 825
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
Add UNSPECIFIED to every enum #441
Changes from 3 commits
c203a79
6d8a14d
6b5d62f
3dafbff
a89ec71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// The MIT License | ||
// | ||
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. | ||
// | ||
// Copyright (c) 2020 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
package enums | ||
|
||
import ( | ||
commonpb "go.temporal.io/temporal-proto/common" | ||
filterpb "go.temporal.io/temporal-proto/filter" | ||
querypb "go.temporal.io/temporal-proto/query" | ||
tasklistpb "go.temporal.io/temporal-proto/tasklist" | ||
) | ||
|
||
func SetDefaultWorkflowIdReusePolicy(f *commonpb.WorkflowIdReusePolicy){ | ||
if *f == commonpb.WORKFLOW_ID_REUSE_POLICY_UNSPECIFIED{ | ||
*f = commonpb.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE | ||
} | ||
} | ||
|
||
func SetDefaultContinueAsNewInitiator(f *commonpb.ContinueAsNewInitiator){ | ||
if *f == commonpb.CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED{ | ||
*f = commonpb.CONTINUE_AS_NEW_INITIATOR_DECIDER | ||
} | ||
} | ||
|
||
func SetDefaultQueryConsistencyLevel(f *querypb.QueryConsistencyLevel){ | ||
if *f == querypb.QUERY_CONSISTENCY_LEVEL_UNSPECIFIED{ | ||
*f = querypb.QUERY_CONSISTENCY_LEVEL_EVENTUAL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think eventual consistency should be the default here. We should default to new implementation which is highly consistent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mfateev what's your take? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am setting this to |
||
} | ||
} | ||
|
||
func SetDefaultHistoryEventFilterType(f *filterpb.HistoryEventFilterType){ | ||
if *f == filterpb.HISTORY_EVENT_FILTER_TYPE_UNSPECIFIED{ | ||
*f = filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT | ||
} | ||
} | ||
|
||
func SetDefaultTasklListType(f *tasklistpb.TaskListType){ | ||
if *f == tasklistpb.TASK_LIST_TYPE_UNSPECIFIED{ | ||
*f = tasklistpb.TASK_LIST_TYPE_DECISION | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need a default here. This should be a required option. What is the use case when this is optional? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made it required for |
||
} | ||
} | ||
|
||
func SetDefaultTasklListKind(f *tasklistpb.TaskListKind){ | ||
if *f == tasklistpb.TASK_LIST_KIND_UNSPECIFIED{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this public API? I'm surprised if it is as client never cares about tasklist kind. If this is internal then we should make it required. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it is used in |
||
*f = tasklistpb.TASK_LIST_KIND_NORMAL | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,8 +65,8 @@ require ( | |
github.com/urfave/cli v1.22.4 | ||
github.com/valyala/fastjson v1.5.1 | ||
github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2 | ||
go.temporal.io/temporal v0.23.9 | ||
go.temporal.io/temporal-proto v0.23.6 | ||
go.temporal.io/temporal v0.24.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👯 |
||
go.temporal.io/temporal-proto v0.24.0 | ||
go.uber.org/atomic v1.6.0 | ||
go.uber.org/multierr v1.5.0 | ||
go.uber.org/zap v1.15.0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All enums in this file are considered to be optional. If value is not set (i.e. set to
UNSPECIFIED
) some default value will be used.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reader Note: Ideally these are only used from within the grpc handlers of each service