common

package
v1.2.12-prerelease2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 29 Imported by: 68

Documentation

Overview

Package common is a generated GoMock package.

Index

Constants

View Source
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
)
View Source
const (
	// GetHistoryMaxPageSize is the max page size for get history
	GetHistoryMaxPageSize = 1000
	// ReadDLQMessagesPageSize is the max page size for read DLQ messages
	ReadDLQMessagesPageSize = 1000
)
View Source
const (
	// VisibilityAppName is used to find kafka topics and ES indexName for visibility
	VisibilityAppName      = "visibility"
	PinotVisibilityAppName = "pinot-visibility"
)
View Source
const (
	// ESVisibilityStoreName is used to find es advanced visibility store
	ESVisibilityStoreName = "es-visibility"
	// PinotVisibilityStoreName is used to find pinot advanced visibility store
	PinotVisibilityStoreName = "pinot-visibility"
)
View Source
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
)

This was flagged by salus as potentially hardcoded credentials. This is a false positive by the scanner and should be disregarded. #nosec

View Source
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
)
View Source
const (
	// DefaultIDLengthWarnLimit is the warning length for various ID types
	DefaultIDLengthWarnLimit = 128
	// DefaultIDLengthErrorLimit is the maximum length allowed for various ID types
	DefaultIDLengthErrorLimit = 1000
)
View Source
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"
)
View Source
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"
	// AdvancedVisibilityWritingModeTriple means write to both normal visibility and advanced visibility store, includes ES and Pinot
	AdvancedVisibilityWritingModeTriple = "triple"
)

enum for dynamic config AdvancedVisibilityWritingMode

View Source
const (
	// DomainDataKeyForManagedFailover is key of DomainData for managed failover
	DomainDataKeyForManagedFailover = "IsManagedByCadence"
	// DomainDataKeyForPreferredCluster is the key of DomainData for domain rebalance
	DomainDataKeyForPreferredCluster = "PreferredCluster"
	// DomainDataKeyForFailoverHistory is the key of DomainData for failover history
	DomainDataKeyForFailoverHistory = "FailoverHistory"
	// 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"
)
View Source
const (
	// DefaultESAnalyzerPause controls if we want to dynamically pause the analyzer
	DefaultESAnalyzerPause = 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 = ""
)
View Source
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
)
View Source
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
)
View Source
const (
	FailoverTypeForce = iota + 1
	FailoverTypeGrace
)
View Source
const (

	// DaemonStatusInitialized coroutine pool initialized
	DaemonStatusInitialized int32 = 0
	// DaemonStatusStarted coroutine pool started
	DaemonStatusStarted int32 = 1
	// DaemonStatusStopped coroutine pool stopped
	DaemonStatusStopped int32 = 2
)
View Source
const (
	// LibraryVersionHeaderName refers to the name of the
	// tchannel / http header that contains the client
	// library version
	LibraryVersionHeaderName = "cadence-client-library-version"

	// FeatureVersionHeaderName refers to the name of the
	// tchannel / http header that contains the client
	// feature version
	// the feature version sent from client represents the
	// feature set of the cadence client library support.
	// This can be used for client capibility check, on
	// Cadence server, for backward compatibility
	FeatureVersionHeaderName = "cadence-client-feature-version"

	// Header name to pass the feature flags from customer to client or server
	ClientFeatureFlagsHeaderName = "cadence-client-feature-flags"

	// ClientImplHeaderName refers to the name of the
	// header that contains the client implementation
	ClientImplHeaderName = "cadence-client-name"
	// AuthorizationTokenHeaderName refers to the jwt token in the request
	AuthorizationTokenHeaderName = "cadence-authorization"

	// AutoforwardingClusterHeaderName refers to the name of the header that contains the source cluster of the auto-forwarding request
	AutoforwardingClusterHeaderName = "cadence-forwarding-cluster"

	// PartitionConfigHeaderName refers to the name of the header that contains the json encoded partition config of the request
	PartitionConfigHeaderName = "cadence-workflow-partition-config"
	// IsolationGroupHeaderName refers to the name of the header that contains the isolation group of the client
	IsolationGroupHeaderName = "cadence-worker-isolation-group"

	// ClientIsolationGroupHeaderName refers to the name of the header that contains the isolation group which the client request is from
	ClientIsolationGroupHeaderName = "cadence-client-isolation-group"
)
View Source
const (

	// FailureReasonCompleteResultExceedsLimit is failureReason for complete result exceeds limit
	FailureReasonCompleteResultExceedsLimit = "COMPLETE_RESULT_EXCEEDS_LIMIT"
	// FailureReasonFailureDetailsExceedsLimit is failureReason for failure details exceeds limit
	FailureReasonFailureDetailsExceedsLimit = "FAILURE_DETAILS_EXCEEDS_LIMIT"
	// FailureReasonCancelDetailsExceedsLimit is failureReason for cancel details exceeds limit
	FailureReasonCancelDetailsExceedsLimit = "CANCEL_DETAILS_EXCEEDS_LIMIT"
	// FailureReasonHeartbeatExceedsLimit is failureReason for heartbeat exceeds limit
	FailureReasonHeartbeatExceedsLimit = "HEARTBEAT_EXCEEDS_LIMIT"
	// FailureReasonDecisionBlobSizeExceedsLimit is the failureReason for decision blob exceeds size limit
	FailureReasonDecisionBlobSizeExceedsLimit = "DECISION_BLOB_SIZE_EXCEEDS_LIMIT"
	// FailureReasonSizeExceedsLimit is reason to fail workflow when history size or count exceed limit
	FailureReasonSizeExceedsLimit = "HISTORY_EXCEEDS_LIMIT"
	// FailureReasonTransactionSizeExceedsLimit is the failureReason for when transaction cannot be committed because it exceeds size limit
	FailureReasonTransactionSizeExceedsLimit = "TRANSACTION_SIZE_EXCEEDS_LIMIT"
	// FailureReasonDecisionAttemptsExceedsLimit is reason to fail workflow when decision attempts fail too many times
	FailureReasonDecisionAttemptsExceedsLimit = "DECISION_ATTEMPTS_EXCEEDS_LIMIT"
)
View Source
const (
	// DefaultHistoryMaxAutoResetPoints is the default maximum number for auto reset points
	DefaultHistoryMaxAutoResetPoints = 20
)
View Source
const (
	// DefaultTransactionSizeLimit is the largest allowed transaction size to persistence
	DefaultTransactionSizeLimit = 14 * 1024 * 1024
)
View Source
const (
	// EmptyUUID is the placeholder for UUID when it's empty
	EmptyUUID = "emptyUuid"
)
View Source
const MaxTaskTimeout = 31622400

MaxTaskTimeout is maximum task timeout allowed. 366 days in seconds

View Source
const MemoKeyForOperator = "operator"

MemoKeyForOperator is the memo key for operator

View Source
const ReservedTaskListPrefix = "/__cadence_sys/"

ReservedTaskListPrefix is the required naming prefix for any task list partition other than partition 0

View Source
const StickyTaskConditionFailedErrorMsg = "StickyTaskConditionFailedError"

StickyTaskConditionFailedErrorMsg error msg for sticky task ConditionFailedError

View Source
const (
	// WorkflowIDRateLimitReason is the reason set in ServiceBusyError when workflow ID rate limit is exceeded
	WorkflowIDRateLimitReason = "external-workflow-id-rate-limit"
)

Variables

View Source
var (
	// ErrBlobSizeExceedsLimit is error for event blob size exceeds limit
	ErrBlobSizeExceedsLimit = &types.BadRequestError{Message: "Blob data size exceeds limit."}
	// ErrContextTimeoutTooShort is error for setting a very short context timeout when calling a long poll API
	ErrContextTimeoutTooShort = &types.BadRequestError{Message: "Context timeout is too short."}
	// ErrContextTimeoutNotSet is error for not setting a context timeout when calling a long poll API
	ErrContextTimeoutNotSet = &types.BadRequestError{Message: "Context timeout is not set."}
	// ErrDecisionResultCountTooLarge error for decision result count exceeds limit
	ErrDecisionResultCountTooLarge = &types.BadRequestError{Message: "Decision result count exceeds limit."}
)

Functions

func ActivityTypePtr

func ActivityTypePtr(v s.ActivityType) *s.ActivityType

ActivityTypePtr makes a copy and returns the pointer to a ActivityType.

func ArchivalStatusPtr added in v0.5.0

func ArchivalStatusPtr(t s.ArchivalStatus) *s.ArchivalStatus

ArchivalStatusPtr makes a copy and returns the pointer to an ArchivalStatus.

func AwaitWaitGroup

func AwaitWaitGroup(wg *sync.WaitGroup, timeout time.Duration) bool

AwaitWaitGroup calls Wait on the given wait Returns true if the Wait() call succeeded before the timeout Returns false if the Wait() did not return before the timeout

func BoolDefault added in v0.3.2

func BoolDefault(v *bool) bool

BoolDefault returns value if bool pointer is set otherwise default value of bool

func BoolPtr

func BoolPtr(v bool) *bool

BoolPtr makes a copy and returns the pointer to a bool.

func CancelExternalWorkflowExecutionFailedCausePtr added in v0.3.2

func CancelExternalWorkflowExecutionFailedCausePtr(t s.CancelExternalWorkflowExecutionFailedCause) *s.CancelExternalWorkflowExecutionFailedCause

CancelExternalWorkflowExecutionFailedCausePtr makes a copy and returns the pointer to a CancelExternalWorkflowExecutionFailedCause.

func CheckDecisionResultLimit added in v0.23.1

func CheckDecisionResultLimit(
	actualSize int,
	limit int,
	scope metrics.Scope,
) error

CheckDecisionResultLimit checks if decision result count exceeds limits.

func CheckEventBlobSizeLimit added in v0.5.0

func CheckEventBlobSizeLimit(
	actualSize int,
	warnLimit int,
	errorLimit int,
	domainID string,
	workflowID string,
	runID string,
	scope metrics.Scope,
	logger log.Logger,
	blobSizeViolationOperationTag tag.Tag,
) error

CheckEventBlobSizeLimit checks if a blob data exceeds limits. It logs a warning if it exceeds warnLimit, and return ErrBlobSizeExceedsLimit if it exceeds errorLimit.

func ChildWorkflowExecutionFailedCausePtr added in v0.3.2

func ChildWorkflowExecutionFailedCausePtr(t s.ChildWorkflowExecutionFailedCause) *s.ChildWorkflowExecutionFailedCause

ChildWorkflowExecutionFailedCausePtr makes a copy and returns the pointer to a ChildWorkflowExecutionFailedCause.

func ClientArchivalStatusPtr added in v0.5.7

func ClientArchivalStatusPtr(t shared.ArchivalStatus) *shared.ArchivalStatus

ClientArchivalStatusPtr makes a copy and returns the pointer to a client ArchivalStatus.

func ConvertDynamicConfigMapPropertyToIntMap added in v0.13.0

func ConvertDynamicConfigMapPropertyToIntMap(dcValue map[string]interface{}) (map[int]int, error)

ConvertDynamicConfigMapPropertyToIntMap convert a map property from dynamic config to a map whose type for both key and value are int

func ConvertErrToGetTaskFailedCause added in v0.23.1

func ConvertErrToGetTaskFailedCause(err error) types.GetTaskFailedCause

ConvertErrToGetTaskFailedCause converts error to GetTaskFailedCause

func ConvertGetTaskFailedCauseToErr added in v0.24.0

func ConvertGetTaskFailedCauseToErr(failedCause types.GetTaskFailedCause) error

ConvertGetTaskFailedCauseToErr converts GetTaskFailedCause to error

func ConvertIndexedValueTypeToInternalType added in v1.0.0

func ConvertIndexedValueTypeToInternalType(fieldType interface{}, logger log.Logger) types.IndexedValueType

ConvertIndexedValueTypeToInternalType takes fieldType as interface{} and convert to IndexedValueType. Because different implementation of dynamic config client may lead to different types

func ConvertIntMapToDynamicConfigMapProperty added in v0.13.0

func ConvertIntMapToDynamicConfigMapProperty(
	intMap map[int]int,
) map[string]interface{}

ConvertIntMapToDynamicConfigMapProperty converts a map whose key value type are both int to a map value that is compatible with dynamic config's map property

func CreateAdminServiceRetryPolicy added in v0.5.0

func CreateAdminServiceRetryPolicy() backoff.RetryPolicy

CreateAdminServiceRetryPolicy creates a retry policy for calls to matching service

func CreateChildContext added in v0.23.1

func CreateChildContext(
	parent context.Context,
	tailroom float64,
) (context.Context, context.CancelFunc)

CreateChildContext creates a child context which shorted context timeout from the given parent context tailroom must be in range [0, 1] and (1-tailroom) * parent timeout will be the new child context timeout if tailroom is less 0, tailroom will be considered as 0 if tailroom is greater than 1, tailroom wil be considered as 1

func CreateDlqPublishRetryPolicy added in v0.18.0

func CreateDlqPublishRetryPolicy() backoff.RetryPolicy

CreateDlqPublishRetryPolicy creates a retry policy for kafka operation

func CreateFrontendServiceRetryPolicy added in v0.3.11

func CreateFrontendServiceRetryPolicy() backoff.RetryPolicy

CreateFrontendServiceRetryPolicy creates a retry policy for calls to frontend service

func CreateHistoryServiceRetryPolicy

func CreateHistoryServiceRetryPolicy() backoff.RetryPolicy

CreateHistoryServiceRetryPolicy creates a retry policy for calls to history service

func CreateHistoryStartWorkflowRequest added in v0.4.0

func CreateHistoryStartWorkflowRequest(
	domainID string,
	startRequest *types.StartWorkflowExecutionRequest,
	now time.Time,
	partitionConfig map[string]string,
) (*types.HistoryStartWorkflowExecutionRequest, error)

CreateHistoryStartWorkflowRequest create a start workflow request for history

func CreateMatchingPollForDecisionTaskResponse added in v0.3.12

func CreateMatchingPollForDecisionTaskResponse(historyResponse *types.RecordDecisionTaskStartedResponse, workflowExecution *types.WorkflowExecution, token []byte) *types.MatchingPollForDecisionTaskResponse

CreateMatchingPollForDecisionTaskResponse create response for matching's PollForDecisionTask

func CreateMatchingServiceRetryPolicy added in v0.5.0

func CreateMatchingServiceRetryPolicy() backoff.RetryPolicy

CreateMatchingServiceRetryPolicy creates a retry policy for calls to matching service

func CreatePersistenceRetryPolicy added in v0.13.0

func CreatePersistenceRetryPolicy() backoff.RetryPolicy

CreatePersistenceRetryPolicy creates a retry policy for persistence layer operations

func CreateReplicationServiceBusyRetryPolicy added in v0.14.0

func CreateReplicationServiceBusyRetryPolicy() backoff.RetryPolicy

CreateReplicationServiceBusyRetryPolicy creates a retry policy to handle replication service busy

func CreateTaskProcessingRetryPolicy added in v0.13.0

func CreateTaskProcessingRetryPolicy() backoff.RetryPolicy

CreateTaskProcessingRetryPolicy creates a retry policy for task processing

func DaysToDuration added in v0.17.0

func DaysToDuration(d int32) time.Duration

DaysToDuration converts number of 24 hour days to time.Duration

func DecisionTaskFailedCausePtr added in v0.3.2

func DecisionTaskFailedCausePtr(t s.DecisionTaskFailedCause) *s.DecisionTaskFailedCause

DecisionTaskFailedCausePtr makes a copy and returns the pointer to a DecisionTaskFailedCause.

func DecisionTypePtr

func DecisionTypePtr(t s.DecisionType) *s.DecisionType

DecisionTypePtr makes a copy and returns the pointer to a DecisionType.

func DeserializeSearchAttributeValue added in v0.12.0

func DeserializeSearchAttributeValue(value []byte, valueType types.IndexedValueType) (interface{}, error)

DeserializeSearchAttributeValue takes json encoded search attribute value and it's type as input, then unmarshal the value into a concrete type and return the value

func DomainIDToHistoryShard added in v0.14.0

func DomainIDToHistoryShard(domainID string, numberOfShards int) int

DomainIDToHistoryShard is used to map a domainID to a shardID

func DurationPtr added in v0.18.0

func DurationPtr(v time.Duration) *time.Duration

DurationPtr makes a copy and returns the pointer to a duration

func DurationToDays added in v0.17.0

func DurationToDays(d time.Duration) int32

DurationToDays converts time.Duration to number of 24 hour days

func DurationToSeconds added in v0.17.0

func DurationToSeconds(d time.Duration) int64

DurationToSeconds converts time.Duration to number of seconds

func EventTypePtr

func EventTypePtr(t s.EventType) *s.EventType

EventTypePtr makes a copy and returns the pointer to a EventType.

func Float64Ptr

func Float64Ptr(v float64) *float64

Float64Ptr makes a copy and returns the pointer to an int64.

func FrontendRetry added in v1.2.9

func FrontendRetry(err error) bool

HistoryRetryFuncFrontendExceptions checks if an error should be retried in a call from frontend

func GenerateRandomString added in v0.3.12

func GenerateRandomString(n int) string

GenerateRandomString is used for generate test string

func GetSizeOfHistoryEvent added in v0.14.0

func GetSizeOfHistoryEvent(event *types.HistoryEvent) uint64

GetSizeOfHistoryEvent returns approximate size in bytes of the history event taking into account byte arrays only now

func GetSizeOfMapStringToByteArray added in v0.5.7

func GetSizeOfMapStringToByteArray(input map[string][]byte) int

GetSizeOfMapStringToByteArray get size of map[string][]byte

func GetTaskPriority added in v0.25.0

func GetTaskPriority(
	class int,
	subClass int,
) int

GetTaskPriority returns priority given a task's priority class and subclass

func Int16Ptr added in v0.5.7

func Int16Ptr(v int16) *int16

Int16Ptr makes a copy and returns the pointer to an int16.

func Int32Default added in v0.3.2

func Int32Default(v *int32) int32

Int32Default returns value if int32 pointer is set otherwise default value of int32

func Int32Ptr

func Int32Ptr(v int32) *int32

Int32Ptr makes a copy and returns the pointer to an int32.

func Int64Default added in v0.3.2

func Int64Default(v *int64) int64

Int64Default returns value if int64 pointer is set otherwise default value of int64

func Int64Ptr

func Int64Ptr(v int64) *int64

Int64Ptr makes a copy and returns the pointer to an int64.

func IntPtr

func IntPtr(v int) *int

IntPtr makes a copy and returns the pointer to an int.

func IntersectionStringSlice added in v1.2.1

func IntersectionStringSlice(a, b []string) []string

IntersectionStringSlice get the intersection of 2 string slices

func IsAdvancedVisibilityReadingEnabled added in v0.25.0

func IsAdvancedVisibilityReadingEnabled(isAdvancedVisReadEnabled, isAdvancedVisConfigExist bool) bool

IsAdvancedVisibilityReadingEnabled returns true if we should read from advanced visibility

func IsAdvancedVisibilityWritingEnabled added in v0.25.0

func IsAdvancedVisibilityWritingEnabled(advancedVisibilityWritingMode string, isAdvancedVisConfigExist bool) bool

IsAdvancedVisibilityWritingEnabled returns true if we should write to advanced visibility

func IsContextTimeoutError added in v0.14.0

func IsContextTimeoutError(err error) bool

IsContextTimeoutError checks if the error is context timeout error

func IsEntityNotExistsError added in v0.21.2

func IsEntityNotExistsError(err error) bool

IsEntityNotExistsError checks if the error is an entity not exists error.

func IsExpectedError added in v1.2.11

func IsExpectedError(err error) bool

IsExpectedError checks if an error is expected to happen in normal operation of the system

func IsJustOrderByClause added in v0.5.9

func IsJustOrderByClause(clause string) bool

IsJustOrderByClause return true is query start with order by

func IsServiceBusyError added in v0.14.0

func IsServiceBusyError(err error) bool

IsServiceBusyError checks if the error is a service busy error.

func IsServiceTransientError added in v0.3.11

func IsServiceTransientError(err error) bool

IsServiceTransientError checks if the error is a transient error.

func IsStickyTaskConditionError added in v0.14.0

func IsStickyTaskConditionError(err error) bool

IsStickyTaskConditionError is error from matching engine

func IsValidContext

func IsValidContext(ctx context.Context) error

IsValidContext checks that the thrift context is not expired on cancelled. Returns nil if the context is still valid. Otherwise, returns the result of ctx.Err()

func IsValidIDLength added in v1.2.7

func IsValidIDLength(
	id string,
	scope metrics.Scope,
	warnLimit int,
	errorLimit int,
	metricsCounter int,
	domainName string,
	logger log.Logger,
	idTypeViolationTag tag.Tag,
) bool

IsValidIDLength checks if id is valid according to its length

func LoadRSAPrivateKey added in v0.23.1

func LoadRSAPrivateKey(path string) (*rsa.PrivateKey, error)

func LoadRSAPublicKey added in v0.23.1

func LoadRSAPublicKey(path string) (*rsa.PublicKey, error)

func MaxDuration added in v0.12.0

func MaxDuration(a, b time.Duration) time.Duration

MaxDuration returns the greater of two given time durations

func MaxInt added in v0.7.0

func MaxInt(a, b int) int

MaxInt returns the greater one of two given integers

func MaxInt64 added in v0.6.0

func MaxInt64(a, b int64) int64

MaxInt64 returns the greater of two given int64

func MinDuration added in v0.12.0

func MinDuration(a, b time.Duration) time.Duration

MinDuration returns the smaller of two given time duration

func MinInt added in v0.5.7

func MinInt(a, b int) int

MinInt returns the smaller of two given integers

func MinInt32 added in v0.3.14

func MinInt32(a, b int32) int32

MinInt32 return smaller one of two inputs int32

func MinInt64 added in v0.5.8

func MinInt64(a, b int64) int64

MinInt64 returns the smaller of two given int64

func ParentClosePolicyPtr added in v0.9.0

func ParentClosePolicyPtr(t s.ParentClosePolicy) *s.ParentClosePolicy

ParentClosePolicyPtr makes a copy and returns the pointer to a DecisionType.

func PrettyPrintHistory

func PrettyPrintHistory(history *types.History, logger log.Logger)

PrettyPrintHistory prints history in human readable format

func Ptr added in v1.2.9

func Ptr[T any](v T) *T

Returns a pointer to the given value. todo (david.porter) Remove the remaining helpers here which are now obsolete

func QueryConsistencyLevelPtr added in v0.11.0

func QueryConsistencyLevelPtr(t s.QueryConsistencyLevel) *s.QueryConsistencyLevel

QueryConsistencyLevelPtr makes a copy and returns the pointer to a QueryConsistencyLevel

func QueryRejectConditionPtr added in v0.11.0

func QueryRejectConditionPtr(t s.QueryRejectCondition) *s.QueryRejectCondition

QueryRejectConditionPtr makes a copy and returns the pointer to a QueryRejectCondition

func QueryResultTypePtr added in v0.11.0

func QueryResultTypePtr(t s.QueryResultType) *s.QueryResultType

QueryResultTypePtr makes a copy and returns the pointer to a QueryResultType

func QueryTaskCompletedTypePtr added in v0.10.1

func QueryTaskCompletedTypePtr(t s.QueryTaskCompletedType) *s.QueryTaskCompletedType

QueryTaskCompletedTypePtr makes a copy and returns the pointer to a QueryTaskCompletedType

func SecondsToDuration added in v0.17.0

func SecondsToDuration(d int64) time.Duration

SecondsToDuration converts number of seconds to time.Duration

func SignalExternalWorkflowExecutionFailedCausePtr added in v0.3.6

func SignalExternalWorkflowExecutionFailedCausePtr(t s.SignalExternalWorkflowExecutionFailedCause) *s.SignalExternalWorkflowExecutionFailedCause

SignalExternalWorkflowExecutionFailedCausePtr makes a copy and returns the pointer to a SignalExternalWorkflowExecutionFailedCause.

func SleepWithMinDuration added in v0.23.1

func SleepWithMinDuration(desired time.Duration, available time.Duration) time.Duration

SleepWithMinDuration sleeps for the minimum of desired and available duration returns the remaining available time duration

func SortInt64Slice added in v0.12.0

func SortInt64Slice(slice []int64)

SortInt64Slice sorts the given int64 slice. Sort is not guaranteed to be stable.

func StringDefault added in v0.3.2

func StringDefault(v *string) string

StringDefault returns value if string pointer is set otherwise default value of string

func StringPtr

func StringPtr(v string) *string

StringPtr makes a copy and returns the pointer to a string.

func TaskListKindPtr added in v0.3.6

func TaskListKindPtr(t s.TaskListKind) *s.TaskListKind

TaskListKindPtr makes a copy and returns the pointer to a TaskListKind.

func TaskListPtr

func TaskListPtr(v s.TaskList) *s.TaskList

TaskListPtr makes a copy and returns the pointer to a TaskList.

func TaskListTypePtr added in v0.4.0

func TaskListTypePtr(t s.TaskListType) *s.TaskListType

TaskListTypePtr makes a copy and returns the pointer to a TaskListKind.

func TimeNowNanosPtr added in v0.5.7

func TimeNowNanosPtr() *int64

TimeNowNanosPtr returns an int64 ptr to current time in unix nanos

func TimePtr added in v0.17.0

func TimePtr(v time.Time) *time.Time

TimePtr makes a copy and returns the pointer to a time

func TimeoutTypePtr added in v0.3.2

func TimeoutTypePtr(t s.TimeoutType) *s.TimeoutType

TimeoutTypePtr makes a copy and returns the pointer to a TimeoutType.

func ToServiceTransientError added in v0.25.0

func ToServiceTransientError(err error) error

ToServiceTransientError converts an error to ServiceTransientError

func Uint32Ptr

func Uint32Ptr(v uint32) *uint32

Uint32Ptr makes a copy and returns the pointer to a uint32.

func Uint64Ptr

func Uint64Ptr(v uint64) *uint64

Uint64Ptr makes a copy and returns the pointer to a uint64.

func ValidateDomainUUID added in v0.20.0

func ValidateDomainUUID(
	domainUUID string,
) error

ValidateDomainUUID checks if the given domainID string is a valid UUID

func ValidateLongPollContextTimeout added in v0.5.7

func ValidateLongPollContextTimeout(
	ctx context.Context,
	handlerName string,
	logger log.Logger,
) error

ValidateLongPollContextTimeout check if the context timeout for a long poll handler is too short or below a normal value. If the timeout is not set or too short, it logs an error, and return ErrContextTimeoutNotSet or ErrContextTimeoutTooShort accordingly. If the timeout is only below a normal value, it just logs an info and return nil.

func ValidateLongPollContextTimeoutIsSet added in v0.8.6

func ValidateLongPollContextTimeoutIsSet(
	ctx context.Context,
	handlerName string,
	logger log.Logger,
) (time.Time, error)

ValidateLongPollContextTimeoutIsSet checks if the context timeout is set for long poll requests.

func ValidateRetryPolicy added in v0.4.0

func ValidateRetryPolicy(policy *types.RetryPolicy) error

ValidateRetryPolicy validates a retry policy

func WorkflowIDToHistoryShard

func WorkflowIDToHistoryShard(workflowID string, numberOfShards int) int

WorkflowIDToHistoryShard is used to map a workflowID to a shardID

func WorkflowTypePtr

func WorkflowTypePtr(t s.WorkflowType) *s.WorkflowType

WorkflowTypePtr makes a copy and returns the pointer to a WorkflowType.

Types

type Daemon

type Daemon interface {
	Start()
	Stop()
}

Daemon is the base interfaces implemented by background tasks within Cadence

type EncodingType

type EncodingType string

EncodingType is an enum that represents various data encoding types

const (
	EncodingTypeJSON     EncodingType = "json"
	EncodingTypeThriftRW EncodingType = "thriftrw"
	EncodingTypeGob      EncodingType = "gob"
	EncodingTypeUnknown  EncodingType = "unknow"
	EncodingTypeEmpty    EncodingType = ""
	EncodingTypeProto    EncodingType = "proto3"
)

Data encoding types

type FailoverType added in v1.2.11

type FailoverType int

FailoverType is the enum for representing different failover types

func (FailoverType) String added in v1.2.11

func (v FailoverType) String() string

type KeyType added in v0.23.1

type KeyType string
const (
	KeyTypePrivate KeyType = "private key"

	KeyTypePublic KeyType = "public key"
)

type MockTaskTokenSerializer added in v1.2.9

type MockTaskTokenSerializer struct {
	// contains filtered or unexported fields
}

MockTaskTokenSerializer is a mock of TaskTokenSerializer interface.

func NewMockTaskTokenSerializer added in v1.2.9

func NewMockTaskTokenSerializer(ctrl *gomock.Controller) *MockTaskTokenSerializer

NewMockTaskTokenSerializer creates a new mock instance.

func (*MockTaskTokenSerializer) Deserialize added in v1.2.9

func (m *MockTaskTokenSerializer) Deserialize(data []byte) (*TaskToken, error)

Deserialize mocks base method.

func (*MockTaskTokenSerializer) DeserializeQueryTaskToken added in v1.2.9

func (m *MockTaskTokenSerializer) DeserializeQueryTaskToken(data []byte) (*QueryTaskToken, error)

DeserializeQueryTaskToken mocks base method.

func (*MockTaskTokenSerializer) EXPECT added in v1.2.9

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTaskTokenSerializer) Serialize added in v1.2.9

func (m *MockTaskTokenSerializer) Serialize(token *TaskToken) ([]byte, error)

Serialize mocks base method.

func (*MockTaskTokenSerializer) SerializeQueryTaskToken added in v1.2.9

func (m *MockTaskTokenSerializer) SerializeQueryTaskToken(token *QueryTaskToken) ([]byte, error)

SerializeQueryTaskToken mocks base method.

type MockTaskTokenSerializerMockRecorder added in v1.2.9

type MockTaskTokenSerializerMockRecorder struct {
	// contains filtered or unexported fields
}

MockTaskTokenSerializerMockRecorder is the mock recorder for MockTaskTokenSerializer.

func (*MockTaskTokenSerializerMockRecorder) Deserialize added in v1.2.9

func (mr *MockTaskTokenSerializerMockRecorder) Deserialize(data interface{}) *gomock.Call

Deserialize indicates an expected call of Deserialize.

func (*MockTaskTokenSerializerMockRecorder) DeserializeQueryTaskToken added in v1.2.9

func (mr *MockTaskTokenSerializerMockRecorder) DeserializeQueryTaskToken(data interface{}) *gomock.Call

DeserializeQueryTaskToken indicates an expected call of DeserializeQueryTaskToken.

func (*MockTaskTokenSerializerMockRecorder) Serialize added in v1.2.9

func (mr *MockTaskTokenSerializerMockRecorder) Serialize(token interface{}) *gomock.Call

Serialize indicates an expected call of Serialize.

func (*MockTaskTokenSerializerMockRecorder) SerializeQueryTaskToken added in v1.2.9

func (mr *MockTaskTokenSerializerMockRecorder) SerializeQueryTaskToken(token interface{}) *gomock.Call

SerializeQueryTaskToken indicates an expected call of SerializeQueryTaskToken.

type PProfInitializer added in v0.3.5

type PProfInitializer interface {
	Start() error
}

PProfInitializer initialize the pprof based on config

type QueryTaskToken added in v0.3.2

type QueryTaskToken struct {
	DomainID string `json:"domainId"`
	TaskList string `json:"taskList"`
	TaskID   string `json:"taskId"`
}

QueryTaskToken identifies a query task

func (QueryTaskToken) GetDomainID added in v1.2.9

func (t QueryTaskToken) GetDomainID() string

type RPCFactory added in v0.3.2

type RPCFactory interface {
	GetDispatcher() *yarpc.Dispatcher
	GetMaxMessageSize() int
}

RPCFactory Creates a dispatcher that knows how to transport requests.

type TaskToken

type TaskToken struct {
	DomainID        string `json:"domainId"`
	WorkflowID      string `json:"workflowId"`
	WorkflowType    string `json:"workflowType"`
	RunID           string `json:"runId"`
	ScheduleID      int64  `json:"scheduleId"`
	ScheduleAttempt int64  `json:"scheduleAttempt"`
	ActivityID      string `json:"activityId"`
	ActivityType    string `json:"activityType"`
}

TaskToken identifies a task

func (TaskToken) GetDomainID added in v1.2.9

func (t TaskToken) GetDomainID() string

type TaskTokenSerializer

type TaskTokenSerializer interface {
	Serialize(token *TaskToken) ([]byte, error)
	Deserialize(data []byte) (*TaskToken, error)
	SerializeQueryTaskToken(token *QueryTaskToken) ([]byte, error)
	DeserializeQueryTaskToken(data []byte) (*QueryTaskToken, error)
}

TaskTokenSerializer serializes task tokens

func NewJSONTaskTokenSerializer

func NewJSONTaskTokenSerializer() TaskTokenSerializer

NewJSONTaskTokenSerializer creates a new instance of TaskTokenSerializer

type TaskType added in v0.12.0

type TaskType int

TaskType is the enum for representing different task types

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
	// Deprecated: TaskTypeCrossCluster is the task type for cross cluster task
	// as of June 2024, this feature is no longer supported. Keeping the enum here
	// to avoid future reuse of the ID and/or confusion
	TaskTypeCrossCluster TaskType = 6
)

type VisibilityOperation added in v0.25.0

type VisibilityOperation string

VisibilityOperation is an enum that represents visibility message types

const (
	RecordStarted          VisibilityOperation = "RecordStarted"
	RecordClosed           VisibilityOperation = "RecordClosed"
	UpsertSearchAttributes VisibilityOperation = "UpsertSearchAttributes"
)

Enum for visibility message type

Directories

Path Synopsis
Package archiver is a generated GoMock package.
Package archiver is a generated GoMock package.
filestore
Package filestore is a generated GoMock package.
Package filestore is a generated GoMock package.
s3store
Package s3store is a generated GoMock package.
Package s3store is a generated GoMock package.
gcloud Module
asyncworkflow
queue
Package queue is a generated GoMock package.
Package queue is a generated GoMock package.
queue/provider
Package provider is a generated GoMock package.
Package provider is a generated GoMock package.
queueconfigapi
Package queueconfigapi is a generated GoMock package.
Package queueconfigapi is a generated GoMock package.
Package authorization is a generated GoMock package.
Package authorization is a generated GoMock package.
Package mock_client is a generated GoMock package.
Package mock_client is a generated GoMock package.
gob
Package domain is a generated GoMock package.
Package domain is a generated GoMock package.
Package dynamicconfig is a generated GoMock package.
Package dynamicconfig is a generated GoMock package.
configstore
Package configstore is a generated GoMock package.
Package configstore is a generated GoMock package.
Package isolationgroup is a generated GoMock package.
Package isolationgroup is a generated GoMock package.
isolationgroupapi
Package isolationgroupapi is a generated GoMock package.
Package isolationgroupapi is a generated GoMock package.
log
tag
types
Package types is a generated GoMock package.
Package types is a generated GoMock package.
Package membership is a generated GoMock package.
Package membership is a generated GoMock package.
Package messaging is a generated GoMock package.
Package messaging is a generated GoMock package.
Package ndc is a generated GoMock package.
Package ndc is a generated GoMock package.
Package pagination is a generated GoMock package.
Package pagination is a generated GoMock package.
Package partition is a generated GoMock package.
Package partition is a generated GoMock package.
peerprovider
Package persistence is a generated GoMock package.
Package persistence is a generated GoMock package.
client
Package client is a generated GoMock package.
Package client is a generated GoMock package.
nosql
Package nosql is a generated GoMock package.
Package nosql is a generated GoMock package.
nosql/nosqlplugin
Package nosqlplugin is a generated GoMock package.
Package nosqlplugin is a generated GoMock package.
nosql/nosqlplugin/cassandra/gocql
Package gocql is a generated GoMock package.
Package gocql is a generated GoMock package.
serialization
Package serialization is a generated GoMock package.
Package serialization is a generated GoMock package.
sql
sql/sqldriver
Package sqldriver is a generated GoMock package.
Package sqldriver is a generated GoMock package.
sql/sqlplugin
Package sqlplugin is a generated GoMock package.
Package sqlplugin is a generated GoMock package.
Package pinot is a generated GoMock package.
Package pinot is a generated GoMock package.
Package quotas is a generated GoMock package.
Package quotas is a generated GoMock package.
global
Package global contains a global-load-balance-aware ratelimiter (when complete).
Package global contains a global-load-balance-aware ratelimiter (when complete).
global/algorithm
Package algorithm contains a running-weighted-average calculator for ratelimits, and some associated types to prevent accidental confusion between the various floats/ints/etc involved.
Package algorithm contains a running-weighted-average calculator for ratelimits, and some associated types to prevent accidental confusion between the various floats/ints/etc involved.
global/collection
Package collection contains the limiting-host ratelimit usage tracking and enforcing logic, which acts as a quotas.Collection.
Package collection contains the limiting-host ratelimit usage tracking and enforcing logic, which acts as a quotas.Collection.
global/collection/internal
Package internal protects these types' concurrency primitives and other internals from accidental misuse.
Package internal protects these types' concurrency primitives and other internals from accidental misuse.
global/rpc
Package rpc contains a concurrent RPC client, and handles mapping to/from the Any-typed request details so other packages do not have to concern themselves with those details.
Package rpc contains a concurrent RPC client, and handles mapping to/from the Any-typed request details so other packages do not have to concern themselves with those details.
global/shared
Package shared holds some types that are used between multiple global-ratelimiter packages, and need to be broken out to prevent import cycles.
Package shared holds some types that are used between multiple global-ratelimiter packages, and need to be broken out to prevent import cycles.
invariant
Package invariant is a generated GoMock package.
Package invariant is a generated GoMock package.
store
Package store is a generated GoMock package.
Package store is a generated GoMock package.
Package task is a generated GoMock package.
Package task is a generated GoMock package.
Package taskvalidator provides a Work in Progress service for workflow validations.
Package taskvalidator provides a Work in Progress service for workflow validations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL