diff --git a/.gitignore b/.gitignore index 286ea8088..80b5fe6d1 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ go.work.sum *~ internal/cmd/build/*.sqlite* .claude +doclink diff --git a/internal/activity.go b/internal/activity.go index d13e6c9df..89b0a1866 100644 --- a/internal/activity.go +++ b/internal/activity.go @@ -18,6 +18,7 @@ type ( // // Exposed as: [go.temporal.io/sdk/activity.Type] ActivityType struct { + // Name is the name of the activity type. Name string } @@ -25,7 +26,9 @@ type ( // // Exposed as: [go.temporal.io/sdk/activity.Info] ActivityInfo struct { + // TaskToken is the token that identifies the activity task. TaskToken []byte + // WorkflowType is the type of the workflow that started this activity. WorkflowType *WorkflowType // Namespace of the workflow that started this activity. Empty if this activity was not started by a workflow. // If present, the value is always the same as Namespace since workflows can only run activities in their own @@ -36,19 +39,32 @@ type ( // Execution details of the workflow that started this activity. All fields are empty if this activity was not // started by a workflow. WorkflowExecution WorkflowExecution + // ActivityID is the ID of the activity. ActivityID string - ActivityRunID string // Run ID of the activity. Empty if the activity was started by a workflow. + // ActivityRunID is the run ID of the activity. Empty if the activity was started by a workflow. + ActivityRunID string + // ActivityType is the type of the activity. ActivityType ActivityType + // TaskQueue is the name of the task queue that the activity needs to be scheduled on. TaskQueue string - Namespace string // Namespace of this activity. - HeartbeatTimeout time.Duration // Maximum time between heartbeats. 0 means no heartbeat needed. - ScheduleToCloseTimeout time.Duration // Schedule to close timeout set by the activity options. - StartToCloseTimeout time.Duration // Start to close timeout set by the activity options. - ScheduledTime time.Time // Time of activity scheduled by a workflow - StartedTime time.Time // Time of activity start - Deadline time.Time // Time of activity timeout - Attempt int32 // Attempt starts from 1, and increased by 1 for every retry if retry policy is specified. - IsLocalActivity bool // true if it is a local activity + // Namespace is the namespace of this activity. + Namespace string + // HeartbeatTimeout is the maximum time between heartbeats. 0 means no heartbeat needed. + HeartbeatTimeout time.Duration + // ScheduleToCloseTimeout is the schedule to close timeout set by the activity options. + ScheduleToCloseTimeout time.Duration + // StartToCloseTimeout is the start to close timeout set by the activity options. + StartToCloseTimeout time.Duration + // ScheduledTime is the time when the activity was scheduled by a workflow. + ScheduledTime time.Time + // StartedTime is the time when the activity started. + StartedTime time.Time + // Deadline is the time of activity timeout. + Deadline time.Time + // Attempt starts from 1, and increased by 1 for every retry if retry policy is specified. + Attempt int32 + // IsLocalActivity is true if it is a local activity. + IsLocalActivity bool // Priority settings that control relative ordering of task processing when activity tasks are backed up in a queue. // If no priority is set, the default value is the zero value. // @@ -73,6 +89,7 @@ type ( // ambiguity between string names and function references. Also users should // always use this string name when executing this activity. Name string + // DisableAlreadyRegisteredCheck disables the check for already registered activities. DisableAlreadyRegisteredCheck bool // When registering a struct with activities, skip functions that are not valid activities. If false, diff --git a/internal/cmd/tools/doclink/doclink.go b/internal/cmd/tools/doclink/doclink.go index ea57440b3..ec3a88b82 100644 --- a/internal/cmd/tools/doclink/doclink.go +++ b/internal/cmd/tools/doclink/doclink.go @@ -127,6 +127,11 @@ func run() error { if err != nil { return fmt.Errorf("error while parsing internal files: %v", err) } + + err = checkInternalDocs(path, file, publicToInternal) + if err != nil { + return fmt.Errorf("error while checking internal docs: %v", err) + } } return nil }) @@ -587,3 +592,53 @@ func isValidDefinitionWithMatch(line, private string, inGroup string, insideStru } return false } + +func checkInternalDocs(path string, file *os.File, pairs map[string]map[string]string) error { + fs := token.NewFileSet() + + // Reset file pointer to start + _, err := file.Seek(0, 0) + if err != nil { + return fmt.Errorf("failed to seek: %v", err) + } + + node, err := parser.ParseFile(fs, path, file, parser.ParseComments) + if err != nil { + return fmt.Errorf("failed to parse file %s: %v", path, err) + } + + exposedTypes := make(map[string]bool) + for _, pair := range pairs { + for _, private := range pair { + exposedTypes[private] = true + } + } + + ast.Inspect(node, func(n ast.Node) bool { + if genDecl, ok := n.(*ast.GenDecl); ok && genDecl.Tok == token.TYPE { + for _, spec := range genDecl.Specs { + if typeSpec, ok := spec.(*ast.TypeSpec); ok { + if !exposedTypes[typeSpec.Name.Name] { + continue + } + if structType, ok := typeSpec.Type.(*ast.StructType); ok { + for _, field := range structType.Fields.List { + if len(field.Names) == 0 { + // Skip anonymous/embedded fields + continue + } + for _, name := range field.Names { + if ast.IsExported(name.Name) && field.Doc == nil { + changesNeeded = true + fmt.Printf("Missing doc for exposed struct %s field %s in %s\n", typeSpec.Name.Name, name.Name, path) + } + } + } + } + } + } + } + return true + }) + return nil +} diff --git a/internal/error.go b/internal/error.go index bfabb811d..8ee24009c 100644 --- a/internal/error.go +++ b/internal/error.go @@ -193,11 +193,17 @@ type ( // Exposed as: [go.temporal.io/sdk/workflow.ContinueAsNewError] ContinueAsNewError struct { // params *ExecuteWorkflowParams + // WorkflowType is the type of the workflow. WorkflowType *WorkflowType + // Input is the arguments for the continued workflow execution. Input *commonpb.Payloads + // Header is the header of the workflow. Header *commonpb.Header + // TaskQueueName is the task queue that the workflow is running on. TaskQueueName string + // WorkflowRunTimeout is the timeout for a single run of the workflow execution. WorkflowRunTimeout time.Duration + // WorkflowTaskTimeout is the maximum execution time of a single Workflow Task. WorkflowTaskTimeout time.Duration // Deprecated: WorkflowExecutionTimeout is deprecated and is never set or diff --git a/internal/interceptor.go b/internal/interceptor.go index dbccfb945..0fb383b5b 100644 --- a/internal/interceptor.go +++ b/internal/interceptor.go @@ -61,6 +61,7 @@ type ActivityInboundInterceptor interface { // // Exposed as: [go.temporal.io/sdk/interceptor.ExecuteActivityInput] type ExecuteActivityInput struct { + // Args are the arguments of the activity. Args []interface{} } @@ -140,6 +141,7 @@ type WorkflowInboundInterceptor interface { // // Exposed as: [go.temporal.io/sdk/interceptor.ExecuteWorkflowInput] type ExecuteWorkflowInput struct { + // Args are the arguments of the workflow. Args []interface{} } @@ -147,6 +149,7 @@ type ExecuteWorkflowInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.HandleSignalInput] type HandleSignalInput struct { + // SignalName is the name of the signal. SignalName string // Arg is the signal argument. It is presented as a primitive payload since // the type needed for decode is not available at the time of interception. @@ -157,7 +160,9 @@ type HandleSignalInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.UpdateInput] type UpdateInput struct { + // Name is the name of the update. Name string + // Args are the arguments of the update. Args []interface{} } @@ -165,7 +170,9 @@ type UpdateInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.HandleQueryInput] type HandleQueryInput struct { + // QueryType is the type of the query. QueryType string + // Args are the arguments of the query. Args []interface{} } @@ -458,18 +465,27 @@ type ClientOutboundInterceptor interface { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientUpdateWorkflowInput] type ClientUpdateWorkflowInput struct { + // UpdateID is the ID of the update. UpdateID string + // WorkflowID is the ID of the workflow to send the update to. WorkflowID string + // UpdateName is the name of the update. UpdateName string + // Args are the arguments of the update. Args []interface{} + // RunID is the run ID of the target workflow execution. RunID string + // FirstExecutionRunID is the run ID of the first execution of the target workflow. FirstExecutionRunID string + // WaitForStage is the stage to wait for. WaitForStage WorkflowUpdateStage } // Exposed as: [go.temporal.io/sdk/interceptor.ClientUpdateWithStartWorkflowInput] type ClientUpdateWithStartWorkflowInput struct { + // UpdateOptions are the options for the update. UpdateOptions *UpdateWorkflowOptions + // StartWorkflowOperation is the operation to start the workflow. StartWorkflowOperation WithStartWorkflowOperation } @@ -493,6 +509,7 @@ type ClientPollWorkflowUpdateOutput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ScheduleClientCreateInput] type ScheduleClientCreateInput struct { + // Options are the options for creating the schedule. Options *ScheduleOptions } @@ -501,8 +518,11 @@ type ScheduleClientCreateInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientExecuteWorkflowInput] type ClientExecuteWorkflowInput struct { + // Options are the options for starting the workflow. Options *StartWorkflowOptions + // WorkflowType is the type of the workflow. WorkflowType string + // Args are the arguments of the workflow. Args []interface{} } @@ -511,9 +531,13 @@ type ClientExecuteWorkflowInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientSignalWorkflowInput] type ClientSignalWorkflowInput struct { + // WorkflowID is the ID of the workflow to signal. WorkflowID string + // RunID is the run ID of the workflow to signal. RunID string + // SignalName is the name of the signal. SignalName string + // Arg is the signal argument. Arg interface{} } @@ -522,10 +546,15 @@ type ClientSignalWorkflowInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientSignalWithStartWorkflowInput] type ClientSignalWithStartWorkflowInput struct { + // SignalName is the name of the signal. SignalName string + // SignalArg is the signal argument. SignalArg interface{} + // Options are the options for starting the workflow. Options *StartWorkflowOptions + // WorkflowType is the type of the workflow. WorkflowType string + // Args are the arguments of the workflow. Args []interface{} } @@ -534,7 +563,9 @@ type ClientSignalWithStartWorkflowInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientCancelWorkflowInput] type ClientCancelWorkflowInput struct { + // WorkflowID is the ID of the workflow to cancel. WorkflowID string + // RunID is the run ID of the workflow to cancel. RunID string } @@ -543,9 +574,13 @@ type ClientCancelWorkflowInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientTerminateWorkflowInput] type ClientTerminateWorkflowInput struct { + // WorkflowID is the ID of the workflow to terminate. WorkflowID string + // RunID is the run ID of the workflow to terminate. RunID string + // Reason is the reason for termination. Reason string + // Details are the details of termination. Details []interface{} } @@ -554,10 +589,15 @@ type ClientTerminateWorkflowInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientQueryWorkflowInput] type ClientQueryWorkflowInput struct { + // WorkflowID is the ID of the workflow to query. WorkflowID string + // RunID is the run ID of the workflow to query. RunID string + // QueryType is the type of the query. QueryType string + // Args are the arguments of the query. Args []interface{} + // QueryRejectCondition is the query reject condition. QueryRejectCondition enumspb.QueryRejectCondition } @@ -566,7 +606,9 @@ type ClientQueryWorkflowInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientDescribeWorkflowInput] type ClientDescribeWorkflowInput struct { + // WorkflowID is the ID of the workflow to describe. WorkflowID string + // RunID is the run ID of the workflow to describe. RunID string } @@ -575,6 +617,7 @@ type ClientDescribeWorkflowInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientDescribeWorkflowOutput] type ClientDescribeWorkflowOutput struct { + // Response is the response. Response *WorkflowExecutionDescription } @@ -585,8 +628,11 @@ type ClientDescribeWorkflowOutput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientExecuteActivityInput] type ClientExecuteActivityInput struct { + // Options are the options for starting the activity. Options *ClientStartActivityOptions + // ActivityType is the type of the activity. ActivityType string + // Args are the arguments of the activity. Args []interface{} } @@ -597,7 +643,9 @@ type ClientExecuteActivityInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientGetActivityHandleInput] type ClientGetActivityHandleInput struct { + // ActivityID is the ID of the activity. ActivityID string + // RunID is the run ID of the activity to get the handle for. RunID string } @@ -608,8 +656,11 @@ type ClientGetActivityHandleInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientCancelActivityInput] type ClientCancelActivityInput struct { + // ActivityID is the ID of the activity. ActivityID string + // RunID is the run ID of the activity to cancel. RunID string + // Reason is the reason for cancellation. Reason string } @@ -620,8 +671,11 @@ type ClientCancelActivityInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientTerminateActivityInput] type ClientTerminateActivityInput struct { + // ActivityID is the ID of the activity. ActivityID string + // RunID is the run ID of the activity to terminate. RunID string + // Reason is the reason for termination. Reason string } @@ -632,7 +686,9 @@ type ClientTerminateActivityInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientDescribeActivityInput] type ClientDescribeActivityInput struct { + // ActivityID is the ID of the activity. ActivityID string + // RunID is the run ID of the activity to describe. RunID string } @@ -643,6 +699,7 @@ type ClientDescribeActivityInput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientDescribeActivityOutput] type ClientDescribeActivityOutput struct { + // Description is the description of the activity. Description *ClientActivityExecutionDescription } @@ -653,7 +710,9 @@ type ClientDescribeActivityOutput struct { // // Exposed as: [go.temporal.io/sdk/interceptor.ClientPollActivityResultInput] type ClientPollActivityResultInput struct { + // ActivityID is the ID of the activity. ActivityID string + // RunID is the run ID of the activity to poll results for. RunID string } @@ -714,7 +773,9 @@ type NexusOperationOutboundInterceptor interface { // // Note: Experimental type NexusStartOperationInput struct { + // Input is the input to the operation. Input any + // Options are the options for starting the operation. Options nexus.StartOperationOptions } @@ -724,6 +785,8 @@ type NexusStartOperationInput struct { // // Note: Experimental type NexusCancelOperationInput struct { + // Token is the token for the operation to cancel. Token string + // Options are the options for cancelling the operation. Options nexus.CancelOperationOptions } diff --git a/internal/interceptor_base.go b/internal/interceptor_base.go index c1ae31044..f43aef503 100644 --- a/internal/interceptor_base.go +++ b/internal/interceptor_base.go @@ -15,7 +15,9 @@ import ( // // Exposed as: [go.temporal.io/sdk/interceptor.InterceptorBase] type InterceptorBase struct { + // ClientInterceptorBase is the base implementation of ClientInterceptor. ClientInterceptorBase + // WorkerInterceptorBase is the base implementation of WorkerInterceptor. WorkerInterceptorBase } @@ -57,6 +59,7 @@ func (*WorkerInterceptorBase) mustEmbedWorkerInterceptorBase() {} // // Exposed as: [go.temporal.io/sdk/interceptor.ActivityInboundInterceptorBase] type ActivityInboundInterceptorBase struct { + // Next is the next interceptor in the chain. Next ActivityInboundInterceptor } @@ -84,6 +87,7 @@ func (*ActivityInboundInterceptorBase) mustEmbedActivityInboundInterceptorBase() // // Exposed as: [go.temporal.io/sdk/interceptor.ActivityOutboundInterceptorBase] type ActivityOutboundInterceptorBase struct { + // Next is the next interceptor in the chain. Next ActivityOutboundInterceptor } @@ -142,6 +146,7 @@ func (*ActivityOutboundInterceptorBase) mustEmbedActivityOutboundInterceptorBase // // Exposed as: [go.temporal.io/sdk/interceptor.WorkflowInboundInterceptorBase] type WorkflowInboundInterceptorBase struct { + // Next is the next interceptor in the chain. Next WorkflowInboundInterceptor } @@ -186,6 +191,7 @@ func (*WorkflowInboundInterceptorBase) mustEmbedWorkflowInboundInterceptorBase() // // Exposed as: [go.temporal.io/sdk/interceptor.WorkflowOutboundInterceptorBase] type WorkflowOutboundInterceptorBase struct { + // Next is the next interceptor in the chain. Next WorkflowOutboundInterceptor } @@ -498,6 +504,7 @@ func (*ClientInterceptorBase) mustEmbedClientInterceptorBase() {} // // Exposed as: [go.temporal.io/sdk/interceptor.ClientOutboundInterceptorBase] type ClientOutboundInterceptorBase struct { + // Next is the next interceptor in the chain. Next ClientOutboundInterceptor } @@ -642,6 +649,7 @@ func (*ClientOutboundInterceptorBase) mustEmbedClientOutboundInterceptorBase() { // // Note: Experimental type NexusOperationInboundInterceptorBase struct { + // Next is the next interceptor in the chain. Next NexusOperationInboundInterceptor } @@ -670,6 +678,7 @@ var _ NexusOperationInboundInterceptor = &NexusOperationInboundInterceptorBase{} // // Note: Experimental type NexusOperationOutboundInterceptorBase struct { + // Next is the next interceptor in the chain. Next NexusOperationOutboundInterceptor } diff --git a/internal/plugin.go b/internal/plugin.go index 4c57e9b56..405386060 100644 --- a/internal/plugin.go +++ b/internal/plugin.go @@ -305,8 +305,11 @@ type WorkerPluginReplayWorkflowOptions struct { // All fields below are coalesced from overloads. No guarantees are made // about their values. Logger log.Logger + // WorkflowServiceClient is the client used to communicate with the Temporal Server. WorkflowServiceClient workflowservice.WorkflowServiceClient + // Namespace is the namespace for the replay. Namespace string + // OriginalExecution is the original workflow execution being replayed. OriginalExecution WorkflowExecution } diff --git a/internal/resource_tuner.go b/internal/resource_tuner.go index 34f199b38..3493b9101 100644 --- a/internal/resource_tuner.go +++ b/internal/resource_tuner.go @@ -32,6 +32,7 @@ type SysInfoProvider interface { // // Exposed as: [go.temporal.io/sdk/worker.SysInfoContext] type SysInfoContext struct { + // Logger is the logger to use for the SysInfoContext calls. Logger log.Logger } @@ -237,7 +238,7 @@ func (r *ResourceBasedSlotSupplier) SysInfoProvider() SysInfoProvider { // ResourceControllerOptions contains configurable parameters for a ResourceController. // It is recommended to use DefaultResourceControllerOptions to create a ResourceControllerOptions -// and only modify the mem/cpu target percent fields. +// and only modify the mem/CPU target percent fields. // // Exposed as: [go.temporal.io/sdk/worker.ResourceControllerOptions] type ResourceControllerOptions struct { @@ -250,14 +251,22 @@ type ResourceControllerOptions struct { // InfoSupplier is the supplier that the controller will use to get system resources. InfoSupplier SysInfoProvider + // MemOutputThreshold is the memory output threshold limit. MemOutputThreshold float64 + // CpuOutputThreshold is the CPU output threshold limit. CpuOutputThreshold float64 + // MemPGain is the memory Proportional gain limit threshold. MemPGain float64 + // MemIGain is the memory Integral gain limit threshold. MemIGain float64 + // MemDGain is the memory Derivative gain limit threshold. MemDGain float64 + // CpuPGain is the CPU Proportional gain limit threshold. CpuPGain float64 + // CpuIGain is the CPU Integral gain limit threshold. CpuIGain float64 + // CpuDGain is the CPU Derivative gain limit threshold. CpuDGain float64 } diff --git a/internal/session.go b/internal/session.go index 264fc858d..02dcefdc4 100644 --- a/internal/session.go +++ b/internal/session.go @@ -22,8 +22,11 @@ type ( // // Exposed as: [go.temporal.io/sdk/workflow.SessionInfo] SessionInfo struct { + // SessionID is the unique identifier for the session. SessionID string + // HostName is the host executing the session. HostName string + // SessionState is the current state of the session. SessionState SessionState resourceID string // hide from user for now taskqueue string // resource specific taskqueue @@ -42,8 +45,11 @@ type ( // // Exposed as: [go.temporal.io/sdk/workflow.SessionOptions] SessionOptions struct { + // ExecutionTimeout specifies the maximum amount of time the session can run. ExecutionTimeout time.Duration + // CreationTimeout specifies how long session creation can take before returning an error. CreationTimeout time.Duration + // HeartbeatTimeout specifies the heartbeat timeout. If heartbeat is not received by server within the timeout, the session will be declared as failed. HeartbeatTimeout time.Duration } diff --git a/internal/worker_version_sets.go b/internal/worker_version_sets.go index adf1037ed..cd0f5d46e 100644 --- a/internal/worker_version_sets.go +++ b/internal/worker_version_sets.go @@ -99,8 +99,9 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.UpdateWorkerBuildIdCompatibilityOptions] UpdateWorkerBuildIdCompatibilityOptions struct { - // The task queue to update the version sets of. + // TaskQueue is the task queue to update the version sets of. TaskQueue string + // Operation is the operation to perform. Operation UpdateBuildIDOp } @@ -115,26 +116,36 @@ type ( UpdateBuildIDOp interface { targetedBuildId() string } + // BuildIDOpAddNewIDInNewDefaultSet is an operation to add a new build ID into a new default set. // // Exposed as: [go.temporal.io/sdk/client.BuildIDOpAddNewIDInNewDefaultSet] BuildIDOpAddNewIDInNewDefaultSet struct { + // BuildID is the build ID to add. BuildID string } + // BuildIDOpAddNewCompatibleVersion is an operation to add a new build ID into an existing compatible set. // // Exposed as: [go.temporal.io/sdk/client.BuildIDOpAddNewCompatibleVersion] BuildIDOpAddNewCompatibleVersion struct { + // BuildID is the build ID to add. BuildID string + // ExistingCompatibleBuildID is an existing build ID in the target set. ExistingCompatibleBuildID string + // MakeSetDefault designates the target set as the default set if true. MakeSetDefault bool } + // BuildIDOpPromoteSet is an operation to promote a compatible set to default. // // Exposed as: [go.temporal.io/sdk/client.BuildIDOpPromoteSet] BuildIDOpPromoteSet struct { + // BuildID is a build ID in the target set. BuildID string } + // BuildIDOpPromoteIDWithinSet is an operation to promote a build ID to the default in its set. // // Exposed as: [go.temporal.io/sdk/client.BuildIDOpPromoteIDWithinSet] BuildIDOpPromoteIDWithinSet struct { + // BuildID is the build ID to promote. BuildID string } ) @@ -181,9 +192,13 @@ func (uw *UpdateWorkerBuildIdCompatibilityOptions) validateAndConvertToProto() ( return req, nil } +// GetWorkerBuildIdCompatibilityOptions is the input to Client.GetWorkerBuildIdCompatibility. +// // Exposed as: [go.temporal.io/sdk/client.GetWorkerBuildIdCompatibilityOptions] type GetWorkerBuildIdCompatibilityOptions struct { + // TaskQueue is the task queue to query. TaskQueue string + // MaxSets is the maximum number of sets to return. MaxSets int } @@ -230,6 +245,7 @@ type TaskQueueReachability struct { // // Exposed as: [go.temporal.io/sdk/client.WorkerBuildIDVersionSets] type WorkerBuildIDVersionSets struct { + // Sets is a list of compatible version sets. Sets []*CompatibleVersionSet } diff --git a/internal/worker_versioning_rules.go b/internal/worker_versioning_rules.go index c2683ca63..ac4f64e6b 100644 --- a/internal/worker_versioning_rules.go +++ b/internal/worker_versioning_rules.go @@ -51,12 +51,13 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.VersioningAssignmentRuleWithTimestamp] VersioningAssignmentRuleWithTimestamp struct { + // Rule is the assignment rule. Rule VersioningAssignmentRule - // The time when the server created this rule. + // CreateTime is the time when the server created this rule. CreateTime time.Time } - // VersioningAssignmentRule is a BuildID redirect rule for a task queue. + // VersioningRedirectRule is a BuildID redirect rule for a task queue. // It changes the behavior of currently running workflows and new ones. // // Deprecated: Build-id based versioning is deprecated in favor of worker deployment based versioning and will be removed soon. @@ -65,7 +66,9 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.VersioningRedirectRule] VersioningRedirectRule struct { + // SourceBuildID is the source BuildID. SourceBuildID string + // TargetBuildID is the target BuildID. TargetBuildID string } @@ -77,8 +80,9 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.VersioningRedirectRuleWithTimestamp] VersioningRedirectRuleWithTimestamp struct { + // Rule is the redirect rule. Rule VersioningRedirectRule - // The time when the server created this rule. + // CreateTime is the time when the server created this rule. CreateTime time.Time } @@ -103,10 +107,11 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.UpdateWorkerVersioningRulesOptions] UpdateWorkerVersioningRulesOptions struct { - // The task queue to update the versioning rules of. + // TaskQueue is the task queue to update the versioning rules of. TaskQueue string - // A conflict token to serialize updates. + // ConflictToken is a conflict token to serialize updates. ConflictToken VersioningConflictToken + // Operation is the operation to perform. Operation VersioningOperation } @@ -141,7 +146,9 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.VersioningOperationInsertAssignmentRule] VersioningOperationInsertAssignmentRule struct { + // RuleIndex is the index to insert the rule at. RuleIndex int32 + // Rule is the rule to insert. Rule VersioningAssignmentRule } @@ -157,8 +164,11 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.VersioningOperationReplaceAssignmentRule] VersioningOperationReplaceAssignmentRule struct { + // RuleIndex is the index to replace the rule at. RuleIndex int32 + // Rule is the rule to replace. Rule VersioningAssignmentRule + // Force bypasses the unconditional rule validation if true. Force bool } @@ -174,7 +184,9 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.VersioningOperationDeleteAssignmentRule] VersioningOperationDeleteAssignmentRule struct { + // RuleIndex is the index to delete the rule at. RuleIndex int32 + // Force bypasses the unconditional rule validation if true. Force bool } @@ -188,6 +200,7 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.VersioningOperationAddRedirectRule] VersioningOperationAddRedirectRule struct { + // Rule is the rule to add. Rule VersioningRedirectRule } @@ -200,6 +213,7 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.VersioningOperationReplaceRedirectRule] VersioningOperationReplaceRedirectRule struct { + // Rule is the rule to replace. Rule VersioningRedirectRule } @@ -212,6 +226,7 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.VersioningOperationDeleteRedirectRule] VersioningOperationDeleteRedirectRule struct { + // SourceBuildID is the source build ID to delete. SourceBuildID string } @@ -235,7 +250,9 @@ type ( // // Exposed as: [go.temporal.io/sdk/client.VersioningOperationCommitBuildID] VersioningOperationCommitBuildID struct { + // TargetBuildID is the target build ID to commit. TargetBuildID string + // Force bypasses the zero pollers validation if true. Force bool } ) @@ -357,8 +374,11 @@ func (gw *GetWorkerVersioningOptions) validateAndConvertToProto(namespace string // // Exposed as: [go.temporal.io/sdk/client.WorkerVersioningRules] type WorkerVersioningRules struct { + // AssignmentRules is the list of assignment rules. AssignmentRules []*VersioningAssignmentRuleWithTimestamp + // RedirectRules is the list of redirect rules. RedirectRules []*VersioningRedirectRuleWithTimestamp + // ConflictToken is the current conflict token. ConflictToken VersioningConflictToken } diff --git a/internal/workflow.go b/internal/workflow.go index e29ece31a..86e71a45f 100644 --- a/internal/workflow.go +++ b/internal/workflow.go @@ -376,6 +376,7 @@ type ( // // Exposed as: [go.temporal.io/sdk/workflow.Type] WorkflowType struct { + // Name is the name of the workflow type. Name string } @@ -383,7 +384,9 @@ type ( // // Exposed as: [go.temporal.io/sdk/workflow.Execution] WorkflowExecution struct { + // ID is the identifier of the workflow execution. ID string + // RunID is the run identifier of the workflow execution. RunID string } @@ -537,6 +540,7 @@ type ( // always use this string name when executing this workflow from a client or // inside a workflow as a child workflow. Name string + // DisableAlreadyRegisteredCheck disables the check for already registered workflows. DisableAlreadyRegisteredCheck bool // Optional: Provides a Versioning Behavior to workflows of this type. It is required // when WorkerOptions does not specify [DeploymentOptions.DefaultVersioningBehavior], @@ -548,6 +552,7 @@ type ( // // Exposed as: [go.temporal.io/sdk/workflow.LoadDynamicRuntimeOptionsDetails] LoadDynamicRuntimeOptionsDetails struct { + // WorkflowType is the type of the workflow. WorkflowType WorkflowType } @@ -1404,32 +1409,46 @@ func (wc *workflowEnvironmentInterceptor) ExecuteChildWorkflow(ctx Context, chil // // Exposed as: [go.temporal.io/sdk/workflow.Info] type WorkflowInfo struct { + // WorkflowExecution is the execution of the workflow. WorkflowExecution WorkflowExecution // The original runID before resetting. Using it instead of current runID can make workflow decision deterministic after reset. See also FirstRunId OriginalRunID string // The very first original RunId of the current Workflow Execution preserved along the chain of ContinueAsNew, Retry, Cron and Reset. Identifies the whole Runs chain of Workflow Execution. FirstRunID string + // WorkflowType is the type of the workflow. WorkflowType WorkflowType + // TaskQueueName is the name of the task queue. TaskQueueName string + // WorkflowExecutionTimeout is the timeout for the workflow execution. WorkflowExecutionTimeout time.Duration + // WorkflowRunTimeout is the timeout for the workflow run. WorkflowRunTimeout time.Duration + // WorkflowTaskTimeout is the timeout for the workflow task. WorkflowTaskTimeout time.Duration + // Namespace is the namespace of the workflow. Namespace string - Attempt int32 // Attempt starts from 1 and increased by 1 for every retry if retry policy is specified. + // Attempt starts from 1 and increased by 1 for every retry if retry policy is specified. + Attempt int32 // Time of the workflow start. // workflow.Now at the beginning of a workflow can return a later time if the Workflow Worker was down. WorkflowStartTime time.Time lastCompletionResult *commonpb.Payloads lastFailure *failurepb.Failure + // CronSchedule is the cron schedule for the workflow. CronSchedule string + // ContinuedExecutionRunID is the run ID of the continued execution. ContinuedExecutionRunID string + // ParentWorkflowNamespace is the namespace of the parent workflow. ParentWorkflowNamespace string + // ParentWorkflowExecution is the execution of the parent workflow. ParentWorkflowExecution *WorkflowExecution // RootWorkflowExecution is the first workflow execution in the chain of workflows. If a workflow is itself a root workflow, then this field is nil. RootWorkflowExecution *WorkflowExecution - Memo *commonpb.Memo // Value can be decoded using data converter (defaultDataConverter, or custom one if set). + // Memo can be decoded using data converter (defaultDataConverter, or custom one if set). + Memo *commonpb.Memo // Deprecated: use [Workflow.GetTypedSearchAttributes] instead. - SearchAttributes *commonpb.SearchAttributes // Value can be decoded using defaultDataConverter. + SearchAttributes *commonpb.SearchAttributes + // RetryPolicy is the retry policy of the workflow. RetryPolicy *RetryPolicy // Priority settings that control relative ordering of task processing when workflow tasks are backed up in a queue. // If no priority is set, the default value is the zero value. diff --git a/internal/workflow_testsuite.go b/internal/workflow_testsuite.go index 3d15a2c59..55247cd34 100644 --- a/internal/workflow_testsuite.go +++ b/internal/workflow_testsuite.go @@ -77,8 +77,11 @@ type ( // // Exposed as: [go.temporal.io/sdk/testsuite.TestUpdateCallback] TestUpdateCallback struct { + // OnAccept is called when the update is accepted. OnAccept func() + // OnReject is called when the update is rejected. OnReject func(error) + // OnComplete is called when the update completes. OnComplete func(interface{}, error) } )