Skip to content

Commit 407d251

Browse files
committed
simplified doc
1 parent 3f37082 commit 407d251

File tree

2 files changed

+18
-34
lines changed

2 files changed

+18
-34
lines changed

test/integration_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,20 @@ import (
3131
"testing"
3232
"time"
3333

34-
"go.uber.org/cadence/test/replaytests"
35-
34+
"github.com/opentracing/opentracing-go/mocktracer"
3635
"github.com/pborman/uuid"
3736
"github.com/stretchr/testify/require"
3837
"github.com/stretchr/testify/suite"
3938
"github.com/uber-go/tally"
4039
"go.uber.org/goleak"
4140
"go.uber.org/zap/zaptest"
4241

43-
"github.com/opentracing/opentracing-go/mocktracer"
44-
4542
"go.uber.org/cadence"
4643
"go.uber.org/cadence/.gen/go/shared"
4744
"go.uber.org/cadence/client"
4845
"go.uber.org/cadence/interceptors"
4946
"go.uber.org/cadence/internal"
47+
"go.uber.org/cadence/test/replaytests"
5048
"go.uber.org/cadence/worker"
5149
"go.uber.org/cadence/workflow"
5250
)

test/replaytests/versioned_workflow.go

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ const (
3838
VersionWorkflowVersionV4
3939
VersionWorkflowVersionV5
4040
VersionWorkflowVersionV6
41-
)
4241

43-
// MaxVersionWorkflowVersion is the maximum version of the VersionedWorkflow.
44-
// Update this constant when adding new versions to the workflow.
45-
const MaxVersionWorkflowVersion = VersionWorkflowVersionV6
42+
// MaxVersionWorkflowVersion is the maximum version of the VersionedWorkflow.
43+
// Update this constant when adding new versions to the workflow.
44+
MaxVersionWorkflowVersion = VersionWorkflowVersionV6
45+
)
4646

47-
// VersionedWorkflowV1 is the first version of the workflow, and it supports only DefaultVersion.
48-
// It supports workflow executions started by this version VersionedWorkflowV1
49-
// and VersionedWorkflowV2, as all of them will have the change ID set to DefaultVersion.
47+
// VersionedWorkflowV1 is the first version of the workflow, supports only DefaultVersion.
48+
// All workflows started by this version will have the change ID set to DefaultVersion.
5049
func VersionedWorkflowV1(ctx workflow.Context, _ string) (string, error) {
5150
ctx = workflow.WithActivityOptions(ctx, activityOptions)
5251

@@ -59,12 +58,8 @@ func VersionedWorkflowV1(ctx workflow.Context, _ string) (string, error) {
5958
return result, nil
6059
}
6160

62-
// VersionedWorkflowV2 is the second version of the workflow. It supports DefaultVersion and Version 1.
61+
// VersionedWorkflowV2 is the second version of the workflow, supports DefaultVersion and 1
6362
// All workflows started by this version will have the change ID set to DefaultVersion.
64-
// It supports workflow executions started by VersionedWorkflowV1 and VersionedWorkflowV2,
65-
// as all of them will have the change ID set to DefaultVersion.
66-
// It also supports workflow executions started by VersionedWorkflowV3 and VersionedWorkflowV4
67-
// because the code supports execution of Version 1 of the workflow.
6863
func VersionedWorkflowV2(ctx workflow.Context, _ string) (string, error) {
6964
ctx = workflow.WithActivityOptions(ctx, activityOptions)
7065

@@ -84,12 +79,8 @@ func VersionedWorkflowV2(ctx workflow.Context, _ string) (string, error) {
8479
return result, nil
8580
}
8681

87-
// VersionedWorkflowV3 is the third version of the workflow. It supports DefaultVersion and Version 1 as well.
88-
// However, all workflows started by this version will have the change ID set to Version 1.
89-
// It supports workflow executions started by VersionedWorkflowV1 and VersionedWorkflowV2,
90-
// as all of them will have the change ID set to DefaultVersion, and it supports them.
91-
// It also supports workflow executions started by VersionedWorkflowV3 and VersionedWorkflowV4,
92-
// because the code supports execution of Version 1 of the workflow.
82+
// VersionedWorkflowV3 is the third version of the workflow, supports DefaultVersion and 1
83+
// All workflows started by this version will have the change ID set to 1.
9384
func VersionedWorkflowV3(ctx workflow.Context, _ string) (string, error) {
9485
ctx = workflow.WithActivityOptions(ctx, activityOptions)
9586

@@ -109,10 +100,8 @@ func VersionedWorkflowV3(ctx workflow.Context, _ string) (string, error) {
109100
return result, nil
110101
}
111102

112-
// VersionedWorkflowV4 is the fourth version of the workflow. It supports only Version 1.
113-
// All workflows started by this version will have the change ID set to Version 1.
114-
// It supports workflow executions started by VersionedWorkflowV3 and VersionedWorkflowV4,
115-
// as all of them will have the change ID set to Version 1.
103+
// VersionedWorkflowV4 is the fourth version of the workflow, supports only version 1
104+
// All workflows started by this version will have the change ID set to 1.
116105
func VersionedWorkflowV4(ctx workflow.Context, _ string) (string, error) {
117106
ctx = workflow.WithActivityOptions(ctx, activityOptions)
118107

@@ -127,10 +116,8 @@ func VersionedWorkflowV4(ctx workflow.Context, _ string) (string, error) {
127116
return result, nil
128117
}
129118

130-
// VersionedWorkflowV5 is the fifth version of the workflow. It supports Version 1 and 2.
131-
// All workflows started by this version will have the change ID set to Version 1.
132-
// It supports workflow executions started by VersionedWorkflowV3, VersionedWorkflowV4,
133-
// VersionedWorkflowV5, VersionedWorkflowV6
119+
// VersionedWorkflowV5 is the fifth version of the workflow, supports versions 1 and 2
120+
// All workflows started by this version will have the change ID set to 1.
134121
func VersionedWorkflowV5(ctx workflow.Context, _ string) (string, error) {
135122
ctx = workflow.WithActivityOptions(ctx, activityOptions)
136123

@@ -150,10 +137,8 @@ func VersionedWorkflowV5(ctx workflow.Context, _ string) (string, error) {
150137
return result, nil
151138
}
152139

153-
// VersionedWorkflowV6 is the sixth version of the workflow. It supports Version 1 and 2.
154-
// All workflows started by this version will have the change ID set to Version 2.
155-
// It supports workflow executions started by VersionedWorkflowV3, VersionedWorkflowV4,
156-
// VersionedWorkflowV5, VersionedWorkflowV6
140+
// VersionedWorkflowV6 is the sixth version of the workflow, supports versions 1 and 2
141+
// All workflows started by this version will have the change ID set to 2.
157142
func VersionedWorkflowV6(ctx workflow.Context, _ string) (string, error) {
158143
ctx = workflow.WithActivityOptions(ctx, activityOptions)
159144

@@ -188,6 +173,7 @@ func BazActivity(_ context.Context, _ string) (string, error) {
188173
return "baz", nil
189174
}
190175

176+
// SetupWorkerForVersionedWorkflow registers the versioned workflow and its activities
191177
func SetupWorkerForVersionedWorkflow(version VersionWorkflowVersion, w worker.Registry) {
192178
switch version {
193179
case VersionWorkflowVersionV1:

0 commit comments

Comments
 (0)