Skip to content

Commit a4b2ecd

Browse files
committed
Fix metadata
Signed-off-by: joshvanl <[email protected]>
1 parent 41dd2ec commit a4b2ecd

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

workflow/api.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import (
44
"time"
55

66
"github.com/dapr/durabletask-go/api"
7-
"github.com/dapr/durabletask-go/api/protos"
8-
"github.com/dapr/kit/ptr"
97
"google.golang.org/protobuf/types/known/wrapperspb"
108
)
119

@@ -16,7 +14,7 @@ type TerminateOptions api.TerminateOptions
1614
type PurgeOptions api.PurgeOptions
1715
type RerunOptions api.RerunOptions
1816

19-
type WorkflowMetadata protos.OrchestrationMetadata
17+
type WorkflowMetadata WorkflowState
2018

2119
// WithInstanceID configures an explicit workflow instance ID. If not
2220
// specified, a random UUID value will be used for the workflow instance ID.
@@ -87,11 +85,11 @@ func WithRecursivePurge(recursive bool) PurgeOptions {
8785
}
8886

8987
func WorkflowMetadataIsRunning(o *WorkflowMetadata) bool {
90-
return api.OrchestrationMetadataIsComplete(ptr.Of(protos.OrchestrationMetadata(*o)))
88+
return api.OrchestrationMetadataIsComplete(o.Metadata)
9189
}
9290

9391
func WorkflowMetadataIsComplete(o *WorkflowMetadata) bool {
94-
return api.OrchestrationMetadataIsComplete(ptr.Of(protos.OrchestrationMetadata(*o)))
92+
return api.OrchestrationMetadataIsComplete(o.Metadata)
9593
}
9694

9795
func WithRerunInput(input any) RerunOptions {

workflow/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (c *Client) FetchWorkflowMetadata(ctx context.Context, id string, opts ...F
5353
oops[i] = api.FetchOrchestrationMetadataOptions(o)
5454
}
5555
meta, err := c.thgc.FetchOrchestrationMetadata(ctx, api.InstanceID(id), oops...)
56-
return (*WorkflowMetadata)(meta), err
56+
return &WorkflowMetadata{Metadata: meta}, err
5757
}
5858

5959
// WaitForWorkflowStart waits for an workflow to start running and returns an
@@ -68,7 +68,7 @@ func (c *Client) WaitForWorkflowStart(ctx context.Context, id string, opts ...Fe
6868
oops[i] = api.FetchOrchestrationMetadataOptions(o)
6969
}
7070
meta, err := c.thgc.WaitForOrchestrationStart(ctx, api.InstanceID(id), oops...)
71-
return (*WorkflowMetadata)(meta), err
71+
return &WorkflowMetadata{meta}, err
7272
}
7373

7474
// WaitForWorkflowCompletion waits for an workflow to complete and returns an
@@ -83,7 +83,7 @@ func (c *Client) WaitForWorkflowCompletion(ctx context.Context, id string, opts
8383
oops[i] = api.FetchOrchestrationMetadataOptions(o)
8484
}
8585
meta, err := c.thgc.WaitForOrchestrationCompletion(ctx, api.InstanceID(id), oops...)
86-
return (*WorkflowMetadata)(meta), err
86+
return &WorkflowMetadata{meta}, err
8787
}
8888

8989
// TerminateWorkflow terminates a running workflow by causing it to stop

workflow/state.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package workflow
22

33
import (
44
"github.com/dapr/durabletask-go/api"
5-
"github.com/dapr/durabletask-go/api/protos"
5+
"github.com/dapr/durabletask-go/backend"
66
)
77

88
type Status int
@@ -60,7 +60,7 @@ func (s Status) RuntimeStatus() api.OrchestrationStatus {
6060
}
6161

6262
type WorkflowState struct {
63-
Metadata protos.OrchestrationMetadata
63+
Metadata *backend.OrchestrationMetadata
6464
}
6565

6666
// RuntimeStatus returns the status from a workflow state.

0 commit comments

Comments
 (0)