diff --git a/go.mod b/go.mod index 2613b890..4238a388 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/google/uuid v1.6.0 github.com/microsoft/durabletask-go v0.5.0 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.64.0 + google.golang.org/grpc v1.65.0 google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index e6b856cf..cd8f26cc 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ github.com/dapr/dapr v1.14.0-rc.2 h1:wuXninZLTyokeztCinVIVAc9mpVYJS8QyxecPCLdlY8 github.com/dapr/dapr v1.14.0-rc.2/go.mod h1:uZMuD9K7y+LKSsQUoSAvv1Yn8Cim9X/9ZQ9XuTobyP8= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s= -github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= +github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -73,8 +73,8 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d h1:k3zyW3BYYR30e8v3x0bTDdE9vpYFjZHK+HcyqkrppWk= google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/workflow/client.go b/workflow/client.go index 37fa3e42..9a9a053f 100644 --- a/workflow/client.go +++ b/workflow/client.go @@ -27,7 +27,7 @@ import ( dapr "github.com/dapr/go-sdk/client" ) -type client struct { +type Client struct { taskHubClient *durabletaskclient.TaskHubGrpcClient } @@ -95,11 +95,11 @@ func WithDaprClient(input dapr.Client) clientOption { // TODO: Implement mocks // NewClient returns a workflow client. -func NewClient(opts ...clientOption) (client, error) { +func NewClient(opts ...clientOption) (*Client, error) { options := new(clientOptions) for _, configure := range opts { if err := configure(options); err != nil { - return client{}, fmt.Errorf("failed to load options: %v", err) + return &Client{}, fmt.Errorf("failed to load options: %v", err) } } var daprClient dapr.Client @@ -110,18 +110,18 @@ func NewClient(opts ...clientOption) (client, error) { daprClient = options.daprClient } if err != nil { - return client{}, fmt.Errorf("failed to initialise dapr.Client: %v", err) + return &Client{}, fmt.Errorf("failed to initialise dapr.Client: %v", err) } taskHubClient := durabletaskclient.NewTaskHubGrpcClient(daprClient.GrpcClientConn(), backend.DefaultLogger()) - return client{ + return &Client{ taskHubClient: taskHubClient, }, nil } // ScheduleNewWorkflow will start a workflow and return the ID and/or error. -func (c *client) ScheduleNewWorkflow(ctx context.Context, workflow string, opts ...api.NewOrchestrationOptions) (id string, err error) { +func (c *Client) ScheduleNewWorkflow(ctx context.Context, workflow string, opts ...api.NewOrchestrationOptions) (id string, err error) { if workflow == "" { return "", errors.New("no workflow specified") } @@ -130,7 +130,7 @@ func (c *client) ScheduleNewWorkflow(ctx context.Context, workflow string, opts } // FetchWorkflowMetadata will return the metadata for a given workflow InstanceID and/or error. -func (c *client) FetchWorkflowMetadata(ctx context.Context, id string, opts ...api.FetchOrchestrationMetadataOptions) (*Metadata, error) { +func (c *Client) FetchWorkflowMetadata(ctx context.Context, id string, opts ...api.FetchOrchestrationMetadataOptions) (*Metadata, error) { if id == "" { return nil, errors.New("no workflow id specified") } @@ -143,7 +143,7 @@ func (c *client) FetchWorkflowMetadata(ctx context.Context, id string, opts ...a } // WaitForWorkflowStart will wait for a given workflow to start and return metadata and/or an error. -func (c *client) WaitForWorkflowStart(ctx context.Context, id string, opts ...api.FetchOrchestrationMetadataOptions) (*Metadata, error) { +func (c *Client) WaitForWorkflowStart(ctx context.Context, id string, opts ...api.FetchOrchestrationMetadataOptions) (*Metadata, error) { if id == "" { return nil, errors.New("no workflow id specified") } @@ -156,7 +156,7 @@ func (c *client) WaitForWorkflowStart(ctx context.Context, id string, opts ...ap } // WaitForWorkflowCompletion will block pending the completion of a specified workflow and return the metadata and/or error. -func (c *client) WaitForWorkflowCompletion(ctx context.Context, id string, opts ...api.FetchOrchestrationMetadataOptions) (*Metadata, error) { +func (c *Client) WaitForWorkflowCompletion(ctx context.Context, id string, opts ...api.FetchOrchestrationMetadataOptions) (*Metadata, error) { if id == "" { return nil, errors.New("no workflow id specified") } @@ -169,7 +169,7 @@ func (c *client) WaitForWorkflowCompletion(ctx context.Context, id string, opts } // TerminateWorkflow will stop a given workflow and return an error output. -func (c *client) TerminateWorkflow(ctx context.Context, id string, opts ...api.TerminateOptions) error { +func (c *Client) TerminateWorkflow(ctx context.Context, id string, opts ...api.TerminateOptions) error { if id == "" { return errors.New("no workflow id specified") } @@ -177,7 +177,7 @@ func (c *client) TerminateWorkflow(ctx context.Context, id string, opts ...api.T } // RaiseEvent will raise an event on a given workflow and return an error output. -func (c *client) RaiseEvent(ctx context.Context, id, eventName string, opts ...api.RaiseEventOptions) error { +func (c *Client) RaiseEvent(ctx context.Context, id, eventName string, opts ...api.RaiseEventOptions) error { if id == "" { return errors.New("no workflow id specified") } @@ -188,7 +188,7 @@ func (c *client) RaiseEvent(ctx context.Context, id, eventName string, opts ...a } // SuspendWorkflow will pause a given workflow and return an error output. -func (c *client) SuspendWorkflow(ctx context.Context, id, reason string) error { +func (c *Client) SuspendWorkflow(ctx context.Context, id, reason string) error { if id == "" { return errors.New("no workflow id specified") } @@ -196,7 +196,7 @@ func (c *client) SuspendWorkflow(ctx context.Context, id, reason string) error { } // ResumeWorkflow will resume a suspended workflow and return an error output. -func (c *client) ResumeWorkflow(ctx context.Context, id, reason string) error { +func (c *Client) ResumeWorkflow(ctx context.Context, id, reason string) error { if id == "" { return errors.New("no workflow id specified") } @@ -205,7 +205,7 @@ func (c *client) ResumeWorkflow(ctx context.Context, id, reason string) error { // PurgeWorkflow will purge a given workflow and return an error output. // NOTE: The workflow must be in a terminated or completed state. -func (c *client) PurgeWorkflow(ctx context.Context, id string) error { +func (c *Client) PurgeWorkflow(ctx context.Context, id string) error { if id == "" { return errors.New("no workflow id specified") } diff --git a/workflow/client_test.go b/workflow/client_test.go index 4e3647d8..ee6ce64e 100644 --- a/workflow/client_test.go +++ b/workflow/client_test.go @@ -49,7 +49,7 @@ func returnClientOptions(opts ...clientOption) clientOptions { } func TestClientMethods(t *testing.T) { - testClient := client{ + testClient := Client{ taskHubClient: nil, } ctx := context.Background()