Skip to content

Commit 22435a7

Browse files
authored
Add doc links throughout our user-facing APIs (temporalio#1239)
Backfill doc links throughout our user-facing APIs. I didn't touch the internal package as those aren't supposed to be for external consumption. While here I cleaned up a few things, like adding links to referenced code samples and removing a doc comment in a spot where they're unsupported; you can't add links in the comments on interface methods or struct members.
1 parent f1d6480 commit 22435a7

File tree

10 files changed

+107
-108
lines changed

10 files changed

+107
-108
lines changed

activity/doc.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ the Temporal managed service.
102102
}
103103
104104
When the Activity times out due to a missed heartbeat, the last value of the details (progress in the above sample) is
105-
returned from the workflow.ExecuteActivity function as the details field of TimeoutError with TimeoutType_HEARTBEAT.
105+
returned from the [workflow.ExecuteActivity] function as the details field of [temporal.TimeoutError] with TimeoutType_HEARTBEAT.
106106
107107
It is also possible to heartbeat an Activity from an external source:
108108
@@ -113,7 +113,7 @@ It is also possible to heartbeat an Activity from an external source:
113113
err := client.RecordActivityHeartbeat(ctx, taskToken, details)
114114
115115
It expects an additional parameter, "taskToken", which is the value of the binary "TaskToken" field of the
116-
"ActivityInfo" struct retrieved inside the Activity (GetActivityInfo(ctx).TaskToken). "details" is the serializable
116+
[activity.Info] retrieved inside the Activity (GetActivityInfo(ctx).TaskToken). "details" is the serializable
117117
payload containing progress information.
118118
119119
# Activity Cancellation

client/client.go

+6-11
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
//go:generate mockgen -copyright_file ../LICENSE -package client -source client.go -destination client_mock.go
2626

2727
// Package client is used by external programs to communicate with Temporal service.
28+
//
2829
// NOTE: DO NOT USE THIS API INSIDE OF ANY WORKFLOW CODE!!!
2930
package client
3031

@@ -401,15 +402,13 @@ type (
401402
// - "(WorkflowID = 'wid1' or (WorkflowType = 'type2' and WorkflowID = 'wid2'))".
402403
// - "CloseTime between '2019-08-27T15:04:05+00:00' and '2019-08-28T15:04:05+00:00'".
403404
// - to list only open workflow use "CloseTime is null"
404-
// For supported operations on different server versions see [Visibility].
405+
// For supported operations on different server versions see https://docs.temporal.io/visibility.
405406
// Retrieved workflow executions are sorted by StartTime in descending order when list open workflow,
406407
// and sorted by CloseTime in descending order for other queries.
407408
// The errors it can return:
408409
// - serviceerror.InvalidArgument
409410
// - serviceerror.Internal
410411
// - serviceerror.Unavailable
411-
//
412-
// [Visibility]: https://docs.temporal.io/visibility
413412
ListWorkflow(ctx context.Context, request *workflowservice.ListWorkflowExecutionsRequest) (*workflowservice.ListWorkflowExecutionsResponse, error)
414413

415414
// ListArchivedWorkflow gets archived workflow executions based on query. This API will return BadRequest if Temporal
@@ -424,27 +423,23 @@ type (
424423

425424
// ScanWorkflow gets workflow executions based on query. The query is basically the SQL WHERE clause
426425
// (see ListWorkflow for query examples).
427-
// For supported operations on different server versions see [Visibility].
426+
// For supported operations on different server versions see https://docs.temporal.io/visibility.
428427
// ScanWorkflow should be used when retrieving large amount of workflows and order is not needed.
429428
// It will use more resources than ListWorkflow, but will be several times faster
430429
// when retrieving millions of workflows.
431430
// The errors it can return:
432431
// - serviceerror.InvalidArgument
433432
// - serviceerror.Internal
434433
// - serviceerror.Unavailable
435-
//
436-
// [Visibility]: https://docs.temporal.io/visibility
437434
ScanWorkflow(ctx context.Context, request *workflowservice.ScanWorkflowExecutionsRequest) (*workflowservice.ScanWorkflowExecutionsResponse, error)
438435

439436
// CountWorkflow gets number of workflow executions based on query. The query is basically the SQL WHERE clause
440437
// (see ListWorkflow for query examples).
441-
// For supported operations on different server versions see [Visibility].
438+
// For supported operations on different server versions see https://docs.temporal.io/visibility.
442439
// The errors it can return:
443440
// - serviceerror.InvalidArgument
444441
// - serviceerror.Internal
445442
// - serviceerror.Unavailable
446-
//
447-
// [Visibility]: https://docs.temporal.io/visibility
448443
CountWorkflow(ctx context.Context, request *workflowservice.CountWorkflowExecutionsRequest) (*workflowservice.CountWorkflowExecutionsResponse, error)
449444

450445
// GetSearchAttributes returns valid search attributes keys and value types.
@@ -678,7 +673,7 @@ var (
678673
_ internal.NamespaceClient = NamespaceClient(nil)
679674
)
680675

681-
// NewValue creates a new converter.EncodedValue which can be used to decode binary data returned by Temporal. For example:
676+
// NewValue creates a new [converter.EncodedValue] which can be used to decode binary data returned by Temporal. For example:
682677
// User had Activity.RecordHeartbeat(ctx, "my-heartbeat") and then got response from calling Client.DescribeWorkflowExecution.
683678
// The response contains binary field PendingActivityInfo.HeartbeatDetails,
684679
// which can be decoded by using:
@@ -689,7 +684,7 @@ func NewValue(data *commonpb.Payloads) converter.EncodedValue {
689684
return internal.NewValue(data)
690685
}
691686

692-
// NewValues creates a new converter.EncodedValues which can be used to decode binary data returned by Temporal. For example:
687+
// NewValues creates a new [converter.EncodedValues] which can be used to decode binary data returned by Temporal. For example:
693688
// User had Activity.RecordHeartbeat(ctx, "my-heartbeat", 123) and then got response from calling Client.DescribeWorkflowExecution.
694689
// The response contains binary field PendingActivityInfo.HeartbeatDetails,
695690
// which can be decoded by using:

contrib/tally/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func NewMetricsHandler(scope tally.Scope) client.MetricsHandler {
4848
}
4949

5050
// ScopeFromHandler returns the underlying scope of the handler. Callers may
51-
// need to check workflow.IsReplaying(ctx) to avoid recording metrics during
51+
// need to check [workflow.IsReplaying] to avoid recording metrics during
5252
// replay. If this handler was not created via this package, [github.com/uber-go/tally.NoopScope] is
5353
// returned.
5454
//

interceptor/interceptor.go

+24-24
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ import (
3737
// calls will be intercepted by it. If an implementation of this interceptor is
3838
// provided via worker options, all worker calls will be intercepted by it.
3939
//
40-
// All implementations of this should embed InterceptorBase but are not required
40+
// All implementations of this should embed [InterceptorBase] but are not required
4141
// to.
4242
type Interceptor = internal.Interceptor
4343

4444
// InterceptorBase is a default implementation of Interceptor meant for
45-
// embedding. It simply embeds ClientInterceptorBase and WorkerInterceptorBase.
45+
// embedding. It simply embeds [ClientInterceptorBase] and [WorkerInterceptorBase].
4646
type InterceptorBase = internal.InterceptorBase
4747

4848
// WorkerInterceptor is an interface for all calls that can be intercepted
@@ -55,9 +55,9 @@ type InterceptorBase = internal.InterceptorBase
5555
// changes.
5656
type WorkerInterceptor = internal.WorkerInterceptor
5757

58-
// WorkerInterceptorBase is a default implementation of WorkerInterceptor that
59-
// simply instantiates ActivityInboundInterceptorBase or
60-
// WorkflowInboundInterceptorBase when called to intercept activities or
58+
// WorkerInterceptorBase is a default implementation of [WorkerInterceptor] that
59+
// simply instantiates [ActivityInboundInterceptorBase] or
60+
// [WorkflowInboundInterceptorBase] when called to intercept activities or
6161
// workflows respectively.
6262
//
6363
// This must be embedded into all WorkerInterceptor implementations to safely
@@ -69,15 +69,15 @@ type WorkerInterceptorBase = internal.WorkerInterceptorBase
6969
// activity calls, can change the outbound interceptor in Init before the next
7070
// call in the chain.
7171
//
72-
// All implementations must embed ActivityInboundInterceptorBase to safely
72+
// All implementations must embed [ActivityInboundInterceptorBase] to safely
7373
// handle future changes.
7474
type ActivityInboundInterceptor = internal.ActivityInboundInterceptor
7575

7676
// ActivityInboundInterceptorBase is a default implementation of
77-
// ActivityInboundInterceptor that forwards calls to the next inbound
77+
// [ActivityInboundInterceptor] that forwards calls to the next inbound
7878
// interceptor and uses an ActivityOutboundInterceptorBase on Init.
7979
//
80-
// This must be embedded into all ActivityInboundInterceptor implementations to
80+
// This must be embedded into all [ActivityInboundInterceptor] implementations to
8181
// safely handle future changes.
8282
type ActivityInboundInterceptorBase = internal.ActivityInboundInterceptorBase
8383

@@ -87,12 +87,12 @@ type ExecuteActivityInput = internal.ExecuteActivityInput
8787
// ActivityOutboundInterceptor is an interface for all activity calls
8888
// originating from the SDK.
8989
//
90-
// All implementations must embed ActivityOutboundInterceptorBase to safely
90+
// All implementations must embed [ActivityOutboundInterceptorBase] to safely
9191
// handle future changes.
9292
type ActivityOutboundInterceptor = internal.ActivityOutboundInterceptor
9393

9494
// ActivityOutboundInterceptorBase is a default implementation of
95-
// ActivityOutboundInterceptor that forwards calls to the next outbound
95+
// [ActivityOutboundInterceptor] that forwards calls to the next outbound
9696
// interceptor.
9797
//
9898
// This must be embedded into all ActivityOutboundInterceptor implementations to
@@ -104,15 +104,15 @@ type ActivityOutboundInterceptorBase = internal.ActivityOutboundInterceptorBase
104104
// workflow calls, can change the outbound interceptor in Init before the next
105105
// call in the chain.
106106
//
107-
// All implementations must embed WorkflowInboundInterceptorBase to safely
107+
// All implementations must embed [WorkflowInboundInterceptorBase] to safely
108108
// handle future changes.
109109
type WorkflowInboundInterceptor = internal.WorkflowInboundInterceptor
110110

111111
// WorkflowInboundInterceptorBase is a default implementation of
112-
// WorkflowInboundInterceptor that forwards calls to the next inbound
112+
// [WorkflowInboundInterceptor] that forwards calls to the next inbound
113113
// interceptor and uses an WorkflowOutboundInterceptorBase on Init.
114114
//
115-
// This must be embedded into all WorkflowInboundInterceptor implementations to
115+
// This must be embedded into all [WorkflowInboundInterceptor] implementations to
116116
// safely handle future changes.
117117
type WorkflowInboundInterceptorBase = internal.WorkflowInboundInterceptorBase
118118

@@ -134,47 +134,47 @@ type UpdateInput = internal.UpdateInput
134134
// WorkflowOutboundInterceptor is an interface for all workflow calls
135135
// originating from the SDK.
136136
//
137-
// All implementations must embed WorkflowOutboundInterceptorBase to safely
137+
// All implementations must embed [WorkflowOutboundInterceptorBase] to safely
138138
// handle future changes.
139139
type WorkflowOutboundInterceptor = internal.WorkflowOutboundInterceptor
140140

141141
// WorkflowOutboundInterceptorBase is a default implementation of
142-
// WorkflowOutboundInterceptor that forwards calls to the next outbound
142+
// [WorkflowOutboundInterceptor] that forwards calls to the next outbound
143143
// interceptor.
144144
//
145-
// This must be embedded into all WorkflowOutboundInterceptor implementations to
145+
// This must be embedded into all [WorkflowOutboundInterceptor] implementations to
146146
// safely handle future changes.
147147
type WorkflowOutboundInterceptorBase = internal.WorkflowOutboundInterceptorBase
148148

149-
// ClientInterceptor for providing a ClientOutboundInterceptor to intercept
149+
// ClientInterceptor for providing a [ClientOutboundInterceptor] to intercept
150150
// certain workflow-specific client calls from the SDK. If an implementation of
151151
// this is provided via client or worker options, certain client calls will be
152152
// intercepted by it.
153153
//
154-
// All implementations must embed ClientInterceptorBase to safely handle future
154+
// All implementations must embed [ClientInterceptorBase] to safely handle future
155155
// changes.
156156
type ClientInterceptor = internal.ClientInterceptor
157157

158-
// ClientInterceptorBase is a default implementation of ClientInterceptor that
159-
// simply instantiates ClientOutboundInterceptorBase when called to intercept
158+
// ClientInterceptorBase is a default implementation of [ClientInterceptor] that
159+
// simply instantiates [ClientOutboundInterceptorBase] when called to intercept
160160
// the client.
161161
//
162-
// This must be embedded into all ClientInterceptor implementations to safely
162+
// This must be embedded into all [ClientInterceptor] implementations to safely
163163
// handle future changes.
164164
type ClientInterceptorBase = internal.ClientInterceptorBase
165165

166166
// ClientOutboundInterceptor is an interface for certain workflow-specific calls
167167
// originating from the SDK.
168168
//
169-
// All implementations must embed ClientOutboundInterceptorBase to safely handle
169+
// All implementations must embed [ClientOutboundInterceptorBase] to safely handle
170170
// future changes.
171171
type ClientOutboundInterceptor = internal.ClientOutboundInterceptor
172172

173173
// ClientOutboundInterceptorBase is a default implementation of
174-
// ClientOutboundInterceptor that forwards calls to the next outbound
174+
// [ClientOutboundInterceptor] that forwards calls to the next outbound
175175
// interceptor.
176176
//
177-
// This must be embedded into all ActivityInboundInterceptor implementations to
177+
// This must be embedded into all [ClientOutboundInterceptor] implementations to
178178
// safely handle future changes.
179179
type ClientOutboundInterceptorBase = internal.ClientOutboundInterceptorBase
180180

interceptor/tracing_interceptor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ type TracerOptions struct {
100100
// never be nil.
101101
//
102102
// This is used internally to set the span on contexts not natively supported
103-
// by tracing systems such as workflow.Context.
103+
// by tracing systems such as [workflow.Context].
104104
SpanContextKey interface{}
105105

106106
// HeaderKey is the key name on the Temporal header to serialize the span to.

temporal/doc.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The root temporal package contains common data structures. The subpackages are:
4747
activity code.
4848
- testsuite - unit testing framework for activity and workflow testing
4949
50-
How Temporal works
50+
# How Temporal works
5151
5252
The Temporal hosted service brokers and persists events generated during workflow execution. Worker nodes owned and
5353
operated by customers execute the coordination and task logic. To facilitate the implementation of worker nodes Temporal
@@ -56,7 +56,7 @@ provides a client-side library for the Go language.
5656
In Temporal, you can code the logical flow of events separately as a workflow and code business logic as activities. The
5757
workflow identifies the activities and sequences them, while an activity executes the logic.
5858
59-
Key Features
59+
# Key Features
6060
6161
Dynamic workflow execution graphs - Determine the workflow execution graphs at runtime based on the data you are
6262
processing. Temporal does not pre-compute the execution graphs at compile time or at workflow start time. Therefore, you

worker/worker.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ type (
7878
// WorkflowRegistry exposes workflow registration functions to consumers.
7979
WorkflowRegistry interface {
8080
// RegisterWorkflow - registers a workflow function with the worker.
81-
// A workflow takes a workflow.Context and input and returns a (result, error) or just error.
81+
// A workflow takes a [workflow.Context] and input and returns a (result, error) or just error.
8282
// Examples:
8383
// func sampleWorkflow(ctx workflow.Context, input []byte) (result []byte, err error)
8484
// func sampleWorkflow(ctx workflow.Context, arg1 int, arg2 string) (result []byte, err error)
@@ -155,7 +155,7 @@ type (
155155
// For example if a workflow failed in production then its history can be downloaded through UI or CLI
156156
// and replayed in a debugger as many times as necessary.
157157
// Use this class to create unit tests that check if workflow changes are backwards compatible.
158-
// It is important to maintain backwards compatibility through use of workflow.GetVersion
158+
// It is important to maintain backwards compatibility through use of [workflow.GetVersion]
159159
// to ensure that new deployments are not going to break open workflows.
160160
WorkflowReplayer interface {
161161
// RegisterWorkflow registers workflow that is going to be replayed
@@ -206,7 +206,7 @@ type (
206206

207207
// WorkflowPanicPolicy is used for configuring how worker deals with workflow
208208
// code panicking which includes non backwards compatible changes to the workflow code without appropriate
209-
// versioning (see workflow.GetVersion).
209+
// versioning (see [workflow.GetVersion]).
210210
// The default behavior is to block workflow execution until the problem is fixed.
211211
WorkflowPanicPolicy = internal.WorkflowPanicPolicy
212212

workflow/deterministic_wrappers.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import (
3333
type (
3434

3535
// Channel must be used instead of a native go channel by workflow code.
36-
// Use workflow.NewChannel(ctx) method to create a Channel instance.
37-
// Channel extends both ReadChannel and SendChannel. Prefer using one of these interfaces
36+
// Use [workflow.NewChannel] to create a Channel instance.
37+
// Channel extends both [ReceiveChannel] and [SendChannel]. Prefer using one of these interfaces
3838
// to share a Channel with consumers or producers.
3939
Channel = internal.Channel
4040

@@ -45,14 +45,14 @@ type (
4545
SendChannel = internal.SendChannel
4646

4747
// Selector must be used instead of native go select by workflow code.
48-
// Use workflow.NewSelector(ctx) method to create a Selector instance.
48+
// Use [workflow.NewSelector] method to create a Selector instance.
4949
Selector = internal.Selector
5050

5151
// Future represents the result of an asynchronous computation.
5252
Future = internal.Future
5353

5454
// Settable is used to set value or error on a future.
55-
// See more: workflow.NewFuture(ctx).
55+
// See more: [workflow.NewFuture].
5656
Settable = internal.Settable
5757

5858
// WaitGroup is used to wait for a collection of

0 commit comments

Comments
 (0)