Skip to content

Commit 2ab3420

Browse files
authored
update durabletask ref (dapr#666)
* update durabletask ref Signed-off-by: Fabian Martinez <[email protected]> * lint Signed-off-by: Fabian Martinez <[email protected]> --------- Signed-off-by: Fabian Martinez <[email protected]>
1 parent 495a389 commit 2ab3420

File tree

8 files changed

+38
-35
lines changed

8 files changed

+38
-35
lines changed

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.23.3
44

55
require (
66
github.com/dapr/dapr v1.15.0-rc.1
7-
github.com/dapr/durabletask-go v0.5.1-0.20241127212625-4232880fd198
7+
github.com/dapr/durabletask-go v0.5.1-0.20241216172832-16da3e7c3530
88
github.com/go-chi/chi/v5 v5.1.0
99
github.com/golang/mock v1.6.0
1010
github.com/google/uuid v1.6.0
@@ -19,7 +19,6 @@ require (
1919
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2020
github.com/go-logr/logr v1.4.2 // indirect
2121
github.com/go-logr/stdr v1.2.2 // indirect
22-
github.com/golang/protobuf v1.5.4 // indirect
2322
github.com/kr/text v0.2.0 // indirect
2423
github.com/marusama/semaphore/v2 v2.5.0 // indirect
2524
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyY
33
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
44
github.com/dapr/dapr v1.15.0-rc.1 h1:7JP3zSannxQwV27A9pPR2b/DSNmgcSjJOhRDwM4eFpQ=
55
github.com/dapr/dapr v1.15.0-rc.1/go.mod h1:SycZrBWgfmog+C5T4p0X6VIpnREQ3xajrYxdih+gn9w=
6-
github.com/dapr/durabletask-go v0.5.1-0.20241127212625-4232880fd198 h1:vTq9HmTXow4iVb/1dO4qVZhK7XC5KlwbLl2iNIE23Qc=
7-
github.com/dapr/durabletask-go v0.5.1-0.20241127212625-4232880fd198/go.mod h1:C4ykYCSNv1k2C4wvZv11h2ClkE/qsXw0tv6idOWVmDc=
6+
github.com/dapr/durabletask-go v0.5.1-0.20241216172832-16da3e7c3530 h1:bfTcj9ewG6vYqV2Xm9fSGzXlLN5IzpeeBUUgoNiqcOg=
7+
github.com/dapr/durabletask-go v0.5.1-0.20241216172832-16da3e7c3530/go.mod h1:C4ykYCSNv1k2C4wvZv11h2ClkE/qsXw0tv6idOWVmDc=
88
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
99
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1010
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=

workflow/client.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"time"
2222

2323
"google.golang.org/grpc"
24+
"google.golang.org/protobuf/types/known/wrapperspb"
2425

2526
"github.com/dapr/durabletask-go/api"
2627
"github.com/dapr/durabletask-go/backend"
@@ -61,7 +62,7 @@ func WithInput(input any) api.NewOrchestrationOptions {
6162

6263
// WithRawInput is an option to pass a byte slice as an input when scheduling a new workflow.
6364
func WithRawInput(input string) api.NewOrchestrationOptions {
64-
return api.WithRawInput(input)
65+
return api.WithRawInput(wrapperspb.String(input))
6566
}
6667

6768
// WithStartTime is an option to set the start time when scheduling a new workflow.
@@ -88,7 +89,7 @@ func WithEventPayload(data any) api.RaiseEventOptions {
8889

8990
// WithRawEventData is an option to send a byte slice with an event to a workflow.
9091
func WithRawEventData(data string) api.RaiseEventOptions {
91-
return api.WithRawEventData(data)
92+
return api.WithRawEventData(wrapperspb.String(data))
9293
}
9394

9495
// WithOutput is an option to define an output when terminating a workflow.
@@ -98,7 +99,7 @@ func WithOutput(data any) api.TerminateOptions {
9899

99100
// WithRawOutput is an option to define a byte slice to output when terminating a workflow.
100101
func WithRawOutput(data string) api.TerminateOptions {
101-
return api.WithRawOutput(data)
102+
return api.WithRawOutput(wrapperspb.String(data))
102103
}
103104

104105
// WithRecursiveTerminate configures whether to terminate all sub-workflows created by the target workflow.

workflow/context.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (wfc *WorkflowContext) CallActivity(activity interface{}, opts ...callActiv
6868
}
6969
}
7070

71-
return wfc.orchestrationContext.CallActivity(activity, task.WithRawActivityInput(options.rawInput.GetValue()), task.WithActivityRetryPolicy(options.getRetryPolicy()))
71+
return wfc.orchestrationContext.CallActivity(activity, task.WithRawActivityInput(options.rawInput), task.WithActivityRetryPolicy(options.getRetryPolicy()))
7272
}
7373

7474
// CallChildWorkflow returns a completable task for a given workflow.
@@ -84,9 +84,9 @@ func (wfc *WorkflowContext) CallChildWorkflow(workflow interface{}, opts ...call
8484
}
8585
}
8686
if options.instanceID != "" {
87-
return wfc.orchestrationContext.CallSubOrchestrator(workflow, task.WithRawSubOrchestratorInput(options.rawInput.GetValue()), task.WithSubOrchestrationInstanceID(options.instanceID), task.WithSubOrchestrationRetryPolicy(options.getRetryPolicy()))
87+
return wfc.orchestrationContext.CallSubOrchestrator(workflow, task.WithRawSubOrchestratorInput(options.rawInput), task.WithSubOrchestrationInstanceID(options.instanceID), task.WithSubOrchestrationRetryPolicy(options.getRetryPolicy()))
8888
}
89-
return wfc.orchestrationContext.CallSubOrchestrator(workflow, task.WithRawSubOrchestratorInput(options.rawInput.GetValue()), task.WithSubOrchestrationRetryPolicy(options.getRetryPolicy()))
89+
return wfc.orchestrationContext.CallSubOrchestrator(workflow, task.WithRawSubOrchestratorInput(options.rawInput), task.WithSubOrchestrationRetryPolicy(options.getRetryPolicy()))
9090
}
9191

9292
// CreateTimer returns a completable task that blocks for a given duration.

workflow/state.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ limitations under the License.
1414
*/
1515
package workflow
1616

17-
import "github.com/dapr/durabletask-go/api"
17+
import (
18+
"github.com/dapr/durabletask-go/api"
19+
"github.com/dapr/durabletask-go/api/protos"
20+
)
1821

1922
type Status int
2023

@@ -71,12 +74,12 @@ func (s Status) RuntimeStatus() api.OrchestrationStatus {
7174
}
7275

7376
type WorkflowState struct {
74-
Metadata api.OrchestrationMetadata
77+
Metadata protos.OrchestrationMetadata
7578
}
7679

7780
// RuntimeStatus returns the status from a workflow state.
7881
func (wfs *WorkflowState) RuntimeStatus() Status {
79-
s := Status(wfs.Metadata.RuntimeStatus.Number())
82+
s := Status(wfs.Metadata.GetRuntimeStatus().Number())
8083
return s
8184
}
8285

workflow/state_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import (
1919

2020
"github.com/stretchr/testify/assert"
2121

22-
"github.com/dapr/durabletask-go/api"
22+
"github.com/dapr/durabletask-go/api/protos"
2323
)
2424

2525
func TestString(t *testing.T) {
26-
wfState := WorkflowState{Metadata: api.OrchestrationMetadata{RuntimeStatus: 0}}
26+
wfState := WorkflowState{Metadata: protos.OrchestrationMetadata{RuntimeStatus: 0}}
2727

2828
t.Run("test running", func(t *testing.T) {
2929
s := wfState.RuntimeStatus()

workflow/workflow.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020

2121
"google.golang.org/protobuf/types/known/wrapperspb"
2222

23-
"github.com/dapr/durabletask-go/api"
23+
"github.com/dapr/durabletask-go/api/protos"
2424
"github.com/dapr/durabletask-go/task"
2525
)
2626

@@ -44,29 +44,29 @@ type FailureDetails struct {
4444
IsNonRetriable bool `json:"IsNonRetriable"`
4545
}
4646

47-
func convertMetadata(orchestrationMetadata *api.OrchestrationMetadata) *Metadata {
47+
func convertMetadata(orchestrationMetadata *protos.OrchestrationMetadata) *Metadata {
4848
metadata := Metadata{
49-
InstanceID: string(orchestrationMetadata.InstanceID),
50-
Name: orchestrationMetadata.Name,
51-
RuntimeStatus: Status(orchestrationMetadata.RuntimeStatus.Number()),
52-
CreatedAt: orchestrationMetadata.CreatedAt,
53-
LastUpdatedAt: orchestrationMetadata.LastUpdatedAt,
54-
SerializedInput: orchestrationMetadata.SerializedInput,
55-
SerializedOutput: orchestrationMetadata.SerializedOutput,
56-
SerializedCustomStatus: orchestrationMetadata.SerializedCustomStatus,
49+
InstanceID: orchestrationMetadata.GetInstanceId(),
50+
Name: orchestrationMetadata.GetName(),
51+
RuntimeStatus: Status(orchestrationMetadata.GetRuntimeStatus().Number()),
52+
CreatedAt: orchestrationMetadata.GetCreatedAt().AsTime(),
53+
LastUpdatedAt: orchestrationMetadata.GetLastUpdatedAt().AsTime(),
54+
SerializedInput: orchestrationMetadata.GetInput().GetValue(),
55+
SerializedOutput: orchestrationMetadata.GetOutput().GetValue(),
56+
SerializedCustomStatus: orchestrationMetadata.GetCustomStatus().GetValue(),
5757
}
58-
if orchestrationMetadata.FailureDetails != nil {
58+
if orchestrationMetadata.GetFailureDetails() != nil {
5959
metadata.FailureDetails = &FailureDetails{
60-
Type: orchestrationMetadata.FailureDetails.GetErrorType(),
61-
Message: orchestrationMetadata.FailureDetails.GetErrorMessage(),
62-
StackTrace: orchestrationMetadata.FailureDetails.GetStackTrace().GetValue(),
63-
IsNonRetriable: orchestrationMetadata.FailureDetails.GetIsNonRetriable(),
60+
Type: orchestrationMetadata.GetFailureDetails().GetErrorType(),
61+
Message: orchestrationMetadata.GetFailureDetails().GetErrorMessage(),
62+
StackTrace: orchestrationMetadata.GetFailureDetails().GetStackTrace().GetValue(),
63+
IsNonRetriable: orchestrationMetadata.GetFailureDetails().GetIsNonRetriable(),
6464
}
6565

66-
if orchestrationMetadata.FailureDetails.GetInnerFailure() != nil {
66+
if orchestrationMetadata.GetFailureDetails().GetInnerFailure() != nil {
6767
var root *FailureDetails
6868
current := root
69-
failure := orchestrationMetadata.FailureDetails.GetInnerFailure()
69+
failure := orchestrationMetadata.GetFailureDetails().GetInnerFailure()
7070
for {
7171
current.Type = failure.GetErrorType()
7272
current.Message = failure.GetErrorMessage()

workflow/workflow_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import (
66

77
"github.com/stretchr/testify/assert"
88

9-
"github.com/dapr/durabletask-go/api"
9+
"github.com/dapr/durabletask-go/api/protos"
1010
"github.com/dapr/durabletask-go/task"
1111
)
1212

1313
func TestConvertMetadata(t *testing.T) {
1414
t.Run("convert metadata", func(t *testing.T) {
15-
rawMetadata := &api.OrchestrationMetadata{
16-
InstanceID: api.InstanceID("test"),
15+
rawMetadata := &protos.OrchestrationMetadata{
16+
InstanceId: "test",
1717
}
1818
metadata := convertMetadata(rawMetadata)
1919
assert.NotEmpty(t, metadata)

0 commit comments

Comments
 (0)