forked from cadence-workflow/cadence
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.go
261 lines (231 loc) · 10.4 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
// Copyright (c) 2017 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 common
import (
"time"
"github.com/uber/cadence/.gen/go/shadower"
)
const (
// FirstEventID is the id of the first event in the history
FirstEventID int64 = 1
// EmptyEventID is the id of the empty event
EmptyEventID int64 = -23
// EmptyVersion is used as the default value for failover version when no value is provided
EmptyVersion int64 = -24
// EndEventID is the id of the end event, here we use the int64 max
EndEventID int64 = 1<<63 - 1
// BufferedEventID is the id of the buffered event
BufferedEventID int64 = -123
// EmptyEventTaskID is uninitialized id of the task id within event
EmptyEventTaskID int64 = -1234
// TransientEventID is the id of the transient event
TransientEventID int64 = -124
// FirstBlobPageToken is the page token identifying the first blob for each history archival
FirstBlobPageToken = 1
// LastBlobNextPageToken is the next page token on the last blob for each history archival
LastBlobNextPageToken = -1
// EndMessageID is the id of the end message, here we use the int64 max
EndMessageID int64 = 1<<63 - 1
// EmptyMessageID is the default start message ID for replication level
EmptyMessageID = -1
// InitialPreviousFailoverVersion is the initial previous failover version
InitialPreviousFailoverVersion int64 = -1
)
const (
// EmptyUUID is the placeholder for UUID when it's empty
EmptyUUID = "emptyUuid"
)
// Data encoding types
const (
EncodingTypeJSON EncodingType = "json"
EncodingTypeThriftRW EncodingType = "thriftrw"
EncodingTypeGob EncodingType = "gob"
EncodingTypeUnknown EncodingType = "unknow"
EncodingTypeEmpty EncodingType = ""
EncodingTypeProto EncodingType = "proto3"
)
type (
// EncodingType is an enum that represents various data encoding types
EncodingType string
)
// MaxTaskTimeout is maximum task timeout allowed. 366 days in seconds
const MaxTaskTimeout = 31622400
const (
// GetHistoryMaxPageSize is the max page size for get history
GetHistoryMaxPageSize = 1000
// ReadDLQMessagesPageSize is the max page size for read DLQ messages
ReadDLQMessagesPageSize = 1000
)
const (
// VisibilityAppName is used to find kafka topics and ES indexName for visibility
VisibilityAppName = "visibility"
)
// This was flagged by salus as potentially hardcoded credentials. This is a false positive by the scanner and should be
// disregarded.
// #nosec
const (
// SystemGlobalDomainName is global domain name for cadence system workflows running globally
SystemGlobalDomainName = "cadence-system-global"
// SystemDomainID is domain id for all cadence system workflows
SystemDomainID = "32049b68-7872-4094-8e63-d0dd59896a83"
// SystemLocalDomainName is domain name for cadence system workflows running in local cluster
SystemLocalDomainName = "cadence-system"
// SystemDomainRetentionDays is retention config for all cadence system workflows
SystemDomainRetentionDays = 7
// BatcherDomainID is domain id for batcher local domain
BatcherDomainID = "3116607e-419b-4783-85fc-47726a4c3fe9"
// BatcherLocalDomainName is domain name for batcher workflows running in local cluster
// Batcher cannot use SystemLocalDomain because auth
BatcherLocalDomainName = "cadence-batcher"
// ShadowerDomainID is domain id for workflow shadower local domain
ShadowerDomainID = "59c51119-1b41-4a28-986d-d6e377716f82"
// ShadowerLocalDomainName
ShadowerLocalDomainName = shadower.LocalDomainName
)
const (
// MinLongPollTimeout is the minimum context timeout for long poll API, below which
// the request won't be processed
MinLongPollTimeout = time.Second * 2
// CriticalLongPollTimeout is a threshold for the context timeout passed into long poll API,
// below which a warning will be logged
CriticalLongPollTimeout = time.Second * 20
)
const (
// DefaultTransactionSizeLimit is the largest allowed transaction size to persistence
DefaultTransactionSizeLimit = 14 * 1024 * 1024
)
const (
// DefaultIDLengthWarnLimit is the warning length for various ID types
DefaultIDLengthWarnLimit = 128
// DefaultIDLengthErrorLimit is the maximum length allowed for various ID types
DefaultIDLengthErrorLimit = 1000
)
const (
// ArchivalEnabled is the status for enabling archival
ArchivalEnabled = "enabled"
// ArchivalDisabled is the status for disabling archival
ArchivalDisabled = "disabled"
// ArchivalPaused is the status for pausing archival
ArchivalPaused = "paused"
)
// enum for dynamic config AdvancedVisibilityWritingMode
const (
// AdvancedVisibilityWritingModeOff means do not write to advanced visibility store
AdvancedVisibilityWritingModeOff = "off"
// AdvancedVisibilityWritingModeOn means only write to advanced visibility store
AdvancedVisibilityWritingModeOn = "on"
// AdvancedVisibilityWritingModeDual means write to both normal visibility and advanced visibility store
AdvancedVisibilityWritingModeDual = "dual"
)
const (
// DomainDataKeyForManagedFailover is key of DomainData for managed failover
DomainDataKeyForManagedFailover = "IsManagedByCadence"
// DomainDataKeyForPreferredCluster is the key of DomainData for domain rebalance
DomainDataKeyForPreferredCluster = "PreferredCluster"
// DomainDataKeyForReadGroups stores which groups have read permission of the domain API
DomainDataKeyForReadGroups = "READ_GROUPS"
// DomainDataKeyForWriteGroups stores which groups have write permission of the domain API
DomainDataKeyForWriteGroups = "WRITE_GROUPS"
)
type (
// TaskType is the enum for representing different task types
TaskType int
)
const (
// TaskTypeTransfer is the task type for transfer task
// starting from 2 here to be consistent with the row type define for cassandra
// TODO: we can remove +2 from the following definition
// we don't have to make them consistent with cassandra definition
// there's also no row type for sql or other nosql persistence implementation
TaskTypeTransfer TaskType = iota + 2
// TaskTypeTimer is the task type for timer task
TaskTypeTimer
// TaskTypeReplication is the task type for replication task
TaskTypeReplication
// TaskTypeCrossCluster is the task type for cross cluster task
TaskTypeCrossCluster TaskType = 6
)
const (
// DefaultESAnalyzerPause controls if we want to dynamically pause the analyzer
DefaultESAnalyzerPause = false
// DefaultCorruptWorkflowWatchdogPause controls if we want to dynamically pause the watchdog
DefaultCorruptWorkflowWatchdogPause = false
// DefaultESAnalyzerTimeWindow controls how many days to go back for ElasticSearch Analyzer
DefaultESAnalyzerTimeWindow = time.Hour * 24 * 30
// DefaultESAnalyzerMaxNumDomains controls how many domains to check
DefaultESAnalyzerMaxNumDomains = 500
// DefaultESAnalyzerMaxNumWorkflowTypes controls how many workflow types per domain to check
DefaultESAnalyzerMaxNumWorkflowTypes = 100
// DefaultESAnalyzerNumWorkflowsToRefresh controls how many workflows per workflow type should be refreshed
DefaultESAnalyzerNumWorkflowsToRefresh = 100
// DefaultESAnalyzerBufferWaitTime controls min time required to consider a worklow stuck
DefaultESAnalyzerBufferWaitTime = time.Minute * 30
// DefaultESAnalyzerMinNumWorkflowsForAvg controls how many workflows to have at least to rely on workflow run time avg per type
DefaultESAnalyzerMinNumWorkflowsForAvg = 100
// DefaultESAnalyzerLimitToTypes controls if we want to limit ESAnalyzer only to some workflow types
DefaultESAnalyzerLimitToTypes = ""
// DefaultESAnalyzerEnableAvgDurationBasedChecks controls if we want to enable avg duration based refreshes
DefaultESAnalyzerEnableAvgDurationBasedChecks = false
// DefaultESAnalyzerLimitToDomains controls if we want to limit ESAnalyzer only to some domains
DefaultESAnalyzerLimitToDomains = ""
// DefaultESAnalyzerWorkflowDurationWarnThreshold defines warning threshold for a workflow duration
DefaultESAnalyzerWorkflowDurationWarnThresholds = ""
)
// StickyTaskConditionFailedErrorMsg error msg for sticky task ConditionFailedError
const StickyTaskConditionFailedErrorMsg = "StickyTaskConditionFailedError"
// MemoKeyForOperator is the memo key for operator
const MemoKeyForOperator = "operator"
// ReservedTaskListPrefix is the required naming prefix for any task list partition other than partition 0
const ReservedTaskListPrefix = "/__cadence_sys/"
type (
// VisibilityOperation is an enum that represents visibility message types
VisibilityOperation string
)
// Enum for visibility message type
const (
RecordStarted VisibilityOperation = "RecordStarted"
RecordClosed VisibilityOperation = "RecordClosed"
UpsertSearchAttributes VisibilityOperation = "UpsertSearchAttributes"
)
const (
numBitsPerLevel = 3
// NoPriority is the value returned if no priority is ever assigned to the task
NoPriority = -1
)
const (
// HighPriorityClass is the priority class for high priority tasks
HighPriorityClass = iota << numBitsPerLevel
// DefaultPriorityClass is the priority class for default priority tasks
DefaultPriorityClass
// LowPriorityClass is the priority class for low priority tasks
LowPriorityClass
)
const (
// HighPrioritySubclass is the priority subclass for high priority tasks
HighPrioritySubclass = iota
// DefaultPrioritySubclass is the priority subclass for high priority tasks
DefaultPrioritySubclass
// LowPrioritySubclass is the priority subclass for high priority tasks
LowPrioritySubclass
)
const (
// DefaultHistoryMaxAutoResetPoints is the default maximum number for auto reset points
DefaultHistoryMaxAutoResetPoints = 20
)