@@ -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.
5049func 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.
6863func 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.
9384func 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.
116105func 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.
134121func 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.
157142func 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
191177func SetupWorkerForVersionedWorkflow (version VersionWorkflowVersion , w worker.Registry ) {
192178 switch version {
193179 case VersionWorkflowVersionV1 :
0 commit comments