Documentation ¶
Index ¶
- Constants
- Variables
- func AwaitWaitGroup(wg *sync.WaitGroup, timeout time.Duration) bool
- func BlockWithTimeout(fn func(), timeout time.Duration) bool
- func CheckEventBlobSizeLimit(actualSize int, warnLimit int, errorLimit int, namespace string, ...) error
- func CloneProto[T proto.Message](v T) T
- func CreateCompleteTaskRetryPolicy() backoff.RetryPolicy
- func CreateDependencyTaskNotCompletedReschedulePolicy() backoff.RetryPolicy
- func CreateFrontendClientRetryPolicy() backoff.RetryPolicy
- func CreateFrontendHandlerRetryPolicy() backoff.RetryPolicy
- func CreateHistoryClientRetryPolicy() backoff.RetryPolicy
- func CreateHistoryHandlerRetryPolicy() backoff.RetryPolicy
- func CreateHistoryStartWorkflowRequest(namespaceID string, ...) *historyservice.StartWorkflowExecutionRequest
- func CreateMatchingClientRetryPolicy() backoff.RetryPolicy
- func CreateMatchingHandlerRetryPolicy() backoff.RetryPolicy
- func CreateMatchingPollWorkflowTaskQueueResponse(historyResponse *historyservice.RecordWorkflowTaskStartedResponse, ...) *matchingservice.PollWorkflowTaskQueueResponse
- func CreatePersistenceClientRetryPolicy() backoff.RetryPolicy
- func CreateReadTaskRetryPolicy() backoff.RetryPolicy
- func CreateSdkClientFactoryRetryPolicy() backoff.RetryPolicy
- func CreateTaskNotReadyReschedulePolicy() backoff.RetryPolicy
- func CreateTaskReschedulePolicy() backoff.RetryPolicy
- func CreateTaskResourceExhaustedReschedulePolicy() backoff.RetryPolicy
- func ErrorHash(err error) string
- func GenerateRandomString(n int) string
- func GetPayloadsMapSize(data map[string]*commonpb.Payloads) int
- func InterruptibleSleep(ctx context.Context, timeout time.Duration)
- func IsContextCanceledErr(err error) bool
- func IsContextDeadlineExceededErr(err error) bool
- func IsInternalError(err error) bool
- func IsNotFoundError(err error) bool
- func IsPersistenceTransientError(err error) bool
- func IsResourceExhausted(err error) bool
- func IsServiceClientTransientError(err error) bool
- func IsServiceHandlerRetryableError(err error) bool
- func IsServiceTransientError(err error) bool
- func IsStickyWorkerUnavailable(err error) bool
- func IsValidContext(ctx context.Context) error
- func MapShardID(sourceShardCount int32, targetShardCount int32, sourceShardID int32) []int32
- func OverrideWorkflowRunTimeout(workflowRunTimeout time.Duration, workflowExecutionTimeout time.Duration) time.Duration
- func OverrideWorkflowTaskTimeout(namespace string, taskStartToCloseTimeout time.Duration, ...) time.Duration
- func PrettyPrint[T proto.Message](msgs []T, header ...string)
- func ValidateLongPollContextTimeout(ctx context.Context, handlerName string, logger log.Logger) error
- func ValidateLongPollContextTimeoutIsSet(ctx context.Context, handlerName string, logger log.Logger) (time.Time, error)
- func ValidateUTF8String(fieldName string, strValue string) error
- func VerifyShardIDMapping(thisShardCount int32, thatShardCount int32, thisShardID int32, ...) error
- func WorkflowIDToHistoryShard(namespaceID string, workflowID string, numberOfShards int32) int32
- type ClientCache
- type PingCheck
- type Pingable
- type RPCFactory
- type TaskTokenSerializer
Constants ¶
const ( // FirstEventID is the id of the first event in the history FirstEventID int64 = 1 // LastEventID is the id of the last possible event in the history LastEventID int64 = math.MaxInt64 // EmptyEventID is the id of the empty event EmptyEventID int64 = 0 // EmptyVersion is used as the default value for failover version when no value is provided EmptyVersion int64 = 0 // 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 = 0 // 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 )
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 ( // DaemonStatusInitialized coroutine pool initialized DaemonStatusInitialized int32 = 0 // DaemonStatusStarted coroutine pool started DaemonStatusStarted int32 = 1 // DaemonStatusStopped coroutine pool stopped DaemonStatusStopped int32 = 2 )
const ( // FailureReasonCompleteResultExceedsLimit is failureReason for complete result exceeds limit FailureReasonCompleteResultExceedsLimit = "Complete result exceeds size limit." // FailureReasonFailureDetailsExceedsLimit is failureReason for failure details exceeds limit FailureReasonFailureExceedsLimit = "Failure exceeds size limit." // FailureReasonCancelDetailsExceedsLimit is failureReason for cancel details exceeds limit FailureReasonCancelDetailsExceedsLimit = "Cancel details exceed size limit." // FailureReasonHeartbeatExceedsLimit is failureReason for heartbeat exceeds limit FailureReasonHeartbeatExceedsLimit = "Heartbeat details exceed size limit." // FailureReasonHistorySizeExceedsLimit is reason to fail workflow when history size exceeds limit FailureReasonHistorySizeExceedsLimit = "Workflow history size exceeds limit." // FailureReasonHistorySizeExceedsLimit is reason to fail workflow when history count exceeds limit FailureReasonHistoryCountExceedsLimit = "Workflow history count exceeds limit." // FailureReasonMutableStateSizeExceedsLimit is reason to fail workflow when mutable state size exceeds limit FailureReasonMutableStateSizeExceedsLimit = "Workflow mutable state size exceeds limit." // FailureReasonTransactionSizeExceedsLimit is the failureReason for when transaction cannot be committed because it exceeds size limit FailureReasonTransactionSizeExceedsLimit = "Transaction size exceeds limit." )
const ( // DefaultOperatorRPSRatio is the default percentage of rate limit that should be used for operator priority requests DefaultOperatorRPSRatio float64 = 0.2 )
const ( // DefaultQueueReaderID is the default readerID when loading history tasks DefaultQueueReaderID int64 = 0 )
const ( // MaxWorkflowTaskStartToCloseTimeout sets the Max Workflow Task start to close timeout for a Workflow MaxWorkflowTaskStartToCloseTimeout = 120 * time.Second )
const (
// Limit for schedule notes field
ScheduleNotesSizeLimit = 1000
)
Variables ¶
var ( // ErrBlobSizeExceedsLimit is error for event blob size exceeds limit ErrBlobSizeExceedsLimit = serviceerror.NewInvalidArgument("Blob data size exceeds limit.") // ErrMemoSizeExceedsLimit is error for memo size exceeds limit ErrMemoSizeExceedsLimit = serviceerror.NewInvalidArgument("Memo size exceeds limit.") // ErrContextTimeoutTooShort is error for setting a very short context timeout when calling a long poll API ErrContextTimeoutTooShort = serviceerror.NewFailedPrecondition("Context timeout is too short.") // ErrContextTimeoutNotSet is error for not setting a context timeout when calling a long poll API ErrContextTimeoutNotSet = serviceerror.NewInvalidArgument("Context timeout is not set.") )
var ( // ErrNamespaceHandover is error indicating namespace is in handover state and cannot process request. ErrNamespaceHandover = serviceerror.NewUnavailable(fmt.Sprintf("Namespace replication in %s state.", enumspb.REPLICATION_STATE_HANDOVER.String())) )
Functions ¶
func AwaitWaitGroup ¶
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 BlockWithTimeout ¶ added in v1.24.0
BlockWithTimeout invokes fn and waits for it to complete until the timeout. Returns true if the call completed before the timeout, otherwise returns false. fn is expected to be a blocking call and will continue to occupy a goroutine until it finally completes.
func CheckEventBlobSizeLimit ¶ added in v0.5.0
func CheckEventBlobSizeLimit( actualSize int, warnLimit int, errorLimit int, namespace string, workflowID string, runID string, metricsHandler metrics.Handler, logger log.Logger, blobSizeViolationOperationTag tag.ZapTag, ) 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 CloneProto ¶ added in v1.17.3
CloneProto is a generic typed version of proto.Clone from proto.
func CreateCompleteTaskRetryPolicy ¶ added in v1.17.3
func CreateCompleteTaskRetryPolicy() backoff.RetryPolicy
CreateCompleteTaskRetryPolicy creates a retry policy for completing background tasks
func CreateDependencyTaskNotCompletedReschedulePolicy ¶ added in v1.19.0
func CreateDependencyTaskNotCompletedReschedulePolicy() backoff.RetryPolicy
CreateDependencyTaskNotCompletedReschedulePolicy creates a retry policy for rescheduling task with ErrDependencyTaskNotCompleted
func CreateFrontendClientRetryPolicy ¶ added in v1.17.3
func CreateFrontendClientRetryPolicy() backoff.RetryPolicy
CreateFrontendClientRetryPolicy creates a retry policy for calls to frontend service
func CreateFrontendHandlerRetryPolicy ¶ added in v1.17.3
func CreateFrontendHandlerRetryPolicy() backoff.RetryPolicy
CreateFrontendHandlerRetryPolicy creates a retry policy for calls to frontend service
func CreateHistoryClientRetryPolicy ¶ added in v1.17.3
func CreateHistoryClientRetryPolicy() backoff.RetryPolicy
CreateHistoryClientRetryPolicy creates a retry policy for calls to history service
func CreateHistoryHandlerRetryPolicy ¶ added in v1.17.3
func CreateHistoryHandlerRetryPolicy() backoff.RetryPolicy
CreateHistoryHandlerRetryPolicy creates a retry policy for calls to history service
func CreateHistoryStartWorkflowRequest ¶ added in v0.4.0
func CreateHistoryStartWorkflowRequest( namespaceID string, startRequest *workflowservice.StartWorkflowExecutionRequest, parentExecutionInfo *workflowspb.ParentExecutionInfo, rootExecutionInfo *workflowspb.RootExecutionInfo, now time.Time, ) *historyservice.StartWorkflowExecutionRequest
CreateHistoryStartWorkflowRequest create a start workflow request for history. Note: this mutates startRequest by unsetting the fields ContinuedFailure and LastCompletionResult (these should only be set on workflows created by the scheduler worker). Assumes startRequest is valid. See frontend workflow_handler for detailed validation logic.
func CreateMatchingClientRetryPolicy ¶ added in v1.17.3
func CreateMatchingClientRetryPolicy() backoff.RetryPolicy
CreateMatchingClientRetryPolicy creates a retry policy for calls to matching service
func CreateMatchingHandlerRetryPolicy ¶ added in v1.17.3
func CreateMatchingHandlerRetryPolicy() backoff.RetryPolicy
CreateMatchingHandlerRetryPolicy creates a retry policy for calls to matching service
func CreateMatchingPollWorkflowTaskQueueResponse ¶ added in v0.27.0
func CreateMatchingPollWorkflowTaskQueueResponse(historyResponse *historyservice.RecordWorkflowTaskStartedResponse, workflowExecution *commonpb.WorkflowExecution, token []byte) *matchingservice.PollWorkflowTaskQueueResponse
CreateMatchingPollWorkflowTaskQueueResponse create response for matching's PollWorkflowTaskQueue
func CreatePersistenceClientRetryPolicy ¶ added in v1.17.3
func CreatePersistenceClientRetryPolicy() backoff.RetryPolicy
CreatePersistenceClientRetryPolicy creates a retry policy for calls to persistence
func CreateReadTaskRetryPolicy ¶ added in v1.17.3
func CreateReadTaskRetryPolicy() backoff.RetryPolicy
CreateReadTaskRetryPolicy creates a retry policy for loading background tasks
func CreateSdkClientFactoryRetryPolicy ¶ added in v1.16.0
func CreateSdkClientFactoryRetryPolicy() backoff.RetryPolicy
CreateSdkClientFactoryRetryPolicy creates a retry policy to handle SdkClientFactory NewClient when frontend service is not ready
func CreateTaskNotReadyReschedulePolicy ¶ added in v1.17.3
func CreateTaskNotReadyReschedulePolicy() backoff.RetryPolicy
CreateTaskNotReadyReschedulePolicy creates a retry policy for rescheduling task with ErrTaskRetry
func CreateTaskReschedulePolicy ¶ added in v1.17.0
func CreateTaskReschedulePolicy() backoff.RetryPolicy
CreateTaskReschedulePolicy creates a retry policy for rescheduling task with errors not equal to ErrTaskRetry
func CreateTaskResourceExhaustedReschedulePolicy ¶ added in v1.18.0
func CreateTaskResourceExhaustedReschedulePolicy() backoff.RetryPolicy
CreateTaskResourceExhaustedReschedulePolicy creates a retry policy for rescheduling task with resource exhausted error
func GenerateRandomString ¶ added in v0.3.12
GenerateRandomString is used for generate test string
func GetPayloadsMapSize ¶ added in v0.27.0
func InterruptibleSleep ¶ added in v1.21.0
InterruptibleSleep is like time.Sleep but can be interrupted by a context.
func IsContextCanceledErr ¶ added in v1.3.0
IsContextCanceledErr checks if the error is context.Canceled or serviceerror.Canceled error
func IsContextDeadlineExceededErr ¶ added in v1.3.0
IsContextDeadlineExceededErr checks if the error is context.DeadlineExceeded or serviceerror.DeadlineExceeded error
func IsInternalError ¶ added in v1.19.1
IsInternalError checks if the error is an internal error.
func IsNotFoundError ¶ added in v1.15.0
IsNotFoundError checks if the error is a not found error.
func IsPersistenceTransientError ¶
IsPersistenceTransientError checks if the error is a transient persistence error
func IsResourceExhausted ¶ added in v1.1.0
IsResourceExhausted checks if the error is a service busy error.
func IsServiceClientTransientError ¶ added in v1.17.3
IsServiceClientTransientError checks if the error is a transient error.
func IsServiceHandlerRetryableError ¶ added in v1.17.3
func IsServiceTransientError ¶ added in v0.3.11
IsServiceTransientError checks if the error is a retryable error.
func IsStickyWorkerUnavailable ¶ added in v1.17.0
func IsValidContext ¶
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 MapShardID ¶ added in v1.21.0
func OverrideWorkflowRunTimeout ¶ added in v1.4.0
func OverrideWorkflowRunTimeout( workflowRunTimeout time.Duration, workflowExecutionTimeout time.Duration, ) time.Duration
OverrideWorkflowRunTimeout override the run timeout according to execution timeout
func OverrideWorkflowTaskTimeout ¶ added in v1.4.0
func OverrideWorkflowTaskTimeout( namespace string, taskStartToCloseTimeout time.Duration, workflowRunTimeout time.Duration, getDefaultTimeoutFunc func(namespace string) time.Duration, ) time.Duration
OverrideWorkflowTaskTimeout override the workflow task timeout according to default timeout or max timeout
func PrettyPrint ¶ added in v1.20.0
func ValidateLongPollContextTimeout ¶ added in v0.5.7
func ValidateLongPollContextTimeout( ctx context.Context, handlerName string, logger log.Logger, ) error
ValidateLongPollContextTimeout checks 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 returns ErrContextTimeoutNotSet or ErrContextTimeoutTooShort accordingly. If the timeout is only below a normal value, it just logs an info and returns 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 ValidateUTF8String ¶ added in v1.20.5
func VerifyShardIDMapping ¶ added in v1.21.0
Types ¶
type ClientCache ¶ added in v0.5.0
type ClientCache interface { GetClientForKey(key string) (interface{}, error) GetClientForClientKey(clientKey string) (interface{}, error) GetAllClients() ([]interface{}, error) }
ClientCache store initialized clients
func NewClientCache ¶ added in v0.5.0
func NewClientCache( keyResolver keyResolver, clientProvider clientProvider, ) ClientCache
NewClientCache creates a new client cache based on membership
type PingCheck ¶ added in v1.19.0
type PingCheck struct { // Name of this component. Name string // The longest time that Ping can take. If it doesn't return in that much time, that's // considered a deadlock and the deadlock detector may take actions to recover, like // killing the process. Timeout time.Duration // Perform the check. The typical implementation will just be Lock() and then Unlock() // on a mutex, returning nil. Ping can also return more Pingables for sub-components // that will be checked independently. These should form a tree and not lead to cycles. Ping func() []Pingable // Metrics recording: // Timer id within DeadlockDetectorScope (or zero for no metrics) MetricsName string }
type Pingable ¶ added in v1.19.0
type Pingable interface {
GetPingChecks() []PingCheck
}
Pingable is interface to check for liveness of a component, to detect deadlocks. This call should not block.
type RPCFactory ¶ added in v0.3.2
type RPCFactory interface { GetFrontendGRPCServerOptions() ([]grpc.ServerOption, error) GetInternodeGRPCServerOptions() ([]grpc.ServerOption, error) GetGRPCListener() net.Listener CreateRemoteFrontendGRPCConnection(rpcAddress string) *grpc.ClientConn CreateLocalFrontendGRPCConnection() *grpc.ClientConn CreateInternodeGRPCConnection(rpcAddress string) *grpc.ClientConn }
RPCFactory creates gRPC listener and connection.
type TaskTokenSerializer ¶
type TaskTokenSerializer interface { Serialize(token *tokenspb.Task) ([]byte, error) Deserialize(data []byte) (*tokenspb.Task, error) SerializeQueryTaskToken(token *tokenspb.QueryTask) ([]byte, error) DeserializeQueryTaskToken(data []byte) (*tokenspb.QueryTask, error) SerializeNexusTaskToken(token *tokenspb.NexusTask) ([]byte, error) DeserializeNexusTaskToken(data []byte) (*tokenspb.NexusTask, error) }
TaskTokenSerializer serializes task tokens
func NewProtoTaskTokenSerializer ¶ added in v0.27.0
func NewProtoTaskTokenSerializer() TaskTokenSerializer
NewProtoTaskTokenSerializer creates a new instance of TaskTokenSerializer
Source Files ¶
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. |
gcloud
Package gcloud is a generated GoMock package.
|
Package gcloud is a generated GoMock package. |
gcloud/connector
Package connector is a generated GoMock package.
|
Package connector is a generated GoMock package. |
provider
Package provider is a generated GoMock package.
|
Package provider is a generated GoMock package. |
s3store
Package s3store is a generated GoMock package.
|
Package s3store is a generated GoMock package. |
s3store/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package authorization is a generated GoMock package.
|
Package authorization is a generated GoMock package. |
Package cache is a generated GoMock package.
|
Package cache is a generated GoMock package. |
Package clock provides extensions to the time package.
|
Package clock provides extensions to the time package. |
Package cluster is a generated GoMock package.
|
Package cluster is a generated GoMock package. |
Package dynamicconfig is a generated GoMock package.
|
Package dynamicconfig is a generated GoMock package. |
Package log is a generated GoMock package.
|
Package log is a generated GoMock package. |
Package membership is a generated GoMock package.
|
Package membership is a generated GoMock package. |
ringpop
Package ringpop provides a service-based membership monitor
|
Package ringpop provides a service-based membership monitor |
Package metrics is a generated GoMock package.
|
Package metrics is a generated GoMock package. |
Package namespace is a generated GoMock package.
|
Package namespace is a generated GoMock package. |
Package persistence is a generated GoMock package.
|
Package persistence is a generated GoMock package. |
mock
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |
nosql/nosqlplugin/cassandra/gocql
Package gocql is a generated GoMock package.
|
Package gocql is a generated GoMock package. |
visibility
Package visibility is a generated GoMock package.
|
Package visibility is a generated GoMock package. |
visibility/manager
Package manager is a generated GoMock package.
|
Package manager is a generated GoMock package. |
visibility/store
Package store is a generated GoMock package.
|
Package store is a generated GoMock package. |
visibility/store/elasticsearch
Package elasticsearch is a generated GoMock package.
|
Package elasticsearch is a generated GoMock package. |
visibility/store/elasticsearch/client
Package client is a generated GoMock package.
|
Package client is a generated GoMock package. |
visibility/store/query
Package query is inspired and partially copied from by github.com/cch123/elasticsql.
|
Package query is inspired and partially copied from by github.com/cch123/elasticsql. |
Package quotas is a generated GoMock package.
|
Package quotas is a generated GoMock package. |
Package resolver is a generated GoMock package.
|
Package resolver is a generated GoMock package. |
Package routing provides utilities to define a number of [Route] instances, which can be...
|
Package routing provides utilities to define a number of [Route] instances, which can be... |
interceptor
Package interceptor is a generated GoMock package.
|
Package interceptor is a generated GoMock package. |
Package sdk is a generated GoMock package.
|
Package sdk is a generated GoMock package. |
Package searchattribute is a generated GoMock package.
|
Package searchattribute is a generated GoMock package. |
Package tasks is a generated GoMock package.
|
Package tasks is a generated GoMock package. |
fakedata
Package fakedata provides utilities for generating random data for testing.
|
Package fakedata provides utilities for generating random data for testing. |
mocksdk
Package mocksdk is a generated GoMock package.
|
Package mocksdk is a generated GoMock package. |
protoassert
Assert wraps testify's require package with useful helpers
|
Assert wraps testify's require package with useful helpers |
protomock
Proto-type adapters for the mock library
|
Proto-type adapters for the mock library |
util contains small standalone utility functions.
|
util contains small standalone utility functions. |
Package xdc is a generated GoMock package.
|
Package xdc is a generated GoMock package. |