Skip to content

Commit 525ff6a

Browse files
committed
add options to PurgeWorkflow
Signed-off-by: Fabian Martinez <[email protected]>
1 parent 9bc7d82 commit 525ff6a

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/go-chi/chi/v5 v5.1.0
88
github.com/golang/mock v1.6.0
99
github.com/google/uuid v1.6.0
10-
github.com/microsoft/durabletask-go v0.5.0
10+
github.com/microsoft/durabletask-go v0.5.1-0.20241014200046-fac9dd959f4d
1111
github.com/stretchr/testify v1.9.0
1212
google.golang.org/grpc v1.65.0
1313
google.golang.org/protobuf v1.34.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
2828
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
2929
github.com/marusama/semaphore/v2 v2.5.0 h1:o/1QJD9DBYOWRnDhPwDVAXQn6mQYD0gZaS1Tpx6DJGM=
3030
github.com/marusama/semaphore/v2 v2.5.0/go.mod h1:z9nMiNUekt/LTpTUQdpp+4sJeYqUGpwMHfW0Z8V8fnQ=
31-
github.com/microsoft/durabletask-go v0.5.0 h1:4DWBgg05wnkV/VwakaiPqZ4cARvATP74ZQJFcXVMC18=
32-
github.com/microsoft/durabletask-go v0.5.0/go.mod h1:goe2gmMgLptCijMDQ7JsekaR86KjPUG64V9JDXvKBhE=
31+
github.com/microsoft/durabletask-go v0.5.1-0.20241014200046-fac9dd959f4d h1:Phnx8/wPd9BM6RPIjlqNl8kAaFjtU+Sdw9CzmZd8Wsw=
32+
github.com/microsoft/durabletask-go v0.5.1-0.20241014200046-fac9dd959f4d/go.mod h1:goe2gmMgLptCijMDQ7JsekaR86KjPUG64V9JDXvKBhE=
3333
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
3434
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
3535
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=

workflow/client.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ func WithRawOutput(data string) api.TerminateOptions {
7878
return api.WithRawOutput(data)
7979
}
8080

81+
// WithRecursiveTerminate configures whether to terminate all sub-workflows created by the target workflow.
82+
func WithRecursiveTerminate(recursive bool) api.TerminateOptions {
83+
return api.WithRecursiveTerminate(recursive)
84+
}
85+
86+
// WithRecursivePurge configures whether to purge all sub-workflows created by the target workflow.
87+
func WithRecursivePurge(recursive bool) api.PurgeOptions {
88+
return api.WithRecursivePurge(recursive)
89+
}
90+
8191
type clientOption func(*clientOptions) error
8292

8393
type clientOptions struct {
@@ -205,9 +215,10 @@ func (c *Client) ResumeWorkflow(ctx context.Context, id, reason string) error {
205215

206216
// PurgeWorkflow will purge a given workflow and return an error output.
207217
// NOTE: The workflow must be in a terminated or completed state.
208-
func (c *Client) PurgeWorkflow(ctx context.Context, id string) error {
218+
// TODO missing upstream support for api.PurgeOptions
219+
func (c *Client) PurgeWorkflow(ctx context.Context, id string, opts ...api.PurgeOptions) error {
209220
if id == "" {
210221
return errors.New("no workflow id specified")
211222
}
212-
return c.taskHubClient.PurgeOrchestrationState(ctx, api.InstanceID(id))
223+
return c.taskHubClient.PurgeOrchestrationState(ctx, api.InstanceID(id), opts...)
213224
}

0 commit comments

Comments
 (0)