Skip to content

Commit 5349aae

Browse files
authored
Merge pull request #246 from cschleiden/external-backend
Remove internal package usage from `Backend` interface
2 parents 3dfa9c2 + c49a2c2 commit 5349aae

File tree

119 files changed

+391
-375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+391
-375
lines changed

activitytester/activitytester.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"context"
55
"log/slog"
66

7+
"github.com/cschleiden/go-workflows/core"
78
"github.com/cschleiden/go-workflows/internal/activity"
8-
"github.com/cschleiden/go-workflows/internal/core"
99
)
1010

1111
func WithActivityTestState(ctx context.Context, activityID, instanceID string, logger *slog.Logger) context.Context {

backend/backend.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import (
55
"errors"
66
"log/slog"
77

8-
"github.com/cschleiden/go-workflows/internal/contextpropagation"
9-
"github.com/cschleiden/go-workflows/internal/converter"
10-
core "github.com/cschleiden/go-workflows/internal/core"
11-
"github.com/cschleiden/go-workflows/internal/history"
12-
"github.com/cschleiden/go-workflows/internal/task"
8+
"github.com/cschleiden/go-workflows/backend/history"
9+
"github.com/cschleiden/go-workflows/contextpropagation"
10+
"github.com/cschleiden/go-workflows/converter"
11+
"github.com/cschleiden/go-workflows/core"
1312
"github.com/cschleiden/go-workflows/metrics"
1413
"github.com/cschleiden/go-workflows/workflow"
1514
"go.opentelemetry.io/otel/trace"
@@ -45,7 +44,7 @@ type Backend interface {
4544
SignalWorkflow(ctx context.Context, instanceID string, event *history.Event) error
4645

4746
// GetWorkflowTask returns a pending workflow task or nil if there are no pending workflow executions
48-
GetWorkflowTask(ctx context.Context) (*task.Workflow, error)
47+
GetWorkflowTask(ctx context.Context) (*WorkflowTask, error)
4948

5049
// ExtendWorkflowTask extends the lock of a workflow task
5150
ExtendWorkflowTask(ctx context.Context, taskID string, instance *core.WorkflowInstance) error
@@ -56,11 +55,11 @@ type Backend interface {
5655
// which will be added to the workflow instance history. workflowEvents are new events for the
5756
// completed or other workflow instances.
5857
CompleteWorkflowTask(
59-
ctx context.Context, task *task.Workflow, instance *workflow.Instance, state core.WorkflowInstanceState,
58+
ctx context.Context, task *WorkflowTask, instance *workflow.Instance, state core.WorkflowInstanceState,
6059
executedEvents, activityEvents, timerEvents []*history.Event, workflowEvents []history.WorkflowEvent) error
6160

6261
// GetActivityTask returns a pending activity task or nil if there are no pending activities
63-
GetActivityTask(ctx context.Context) (*task.Activity, error)
62+
GetActivityTask(ctx context.Context) (*ActivityTask, error)
6463

6564
// CompleteActivityTask completes an activity task retrieved using GetActivityTask
6665
CompleteActivityTask(ctx context.Context, instance *workflow.Instance, activityID string, event *history.Event) error
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package history
22

33
import (
4-
"github.com/cschleiden/go-workflows/internal/core"
4+
"github.com/cschleiden/go-workflows/backend/metadata"
55
"github.com/cschleiden/go-workflows/internal/payload"
66
)
77

@@ -10,5 +10,5 @@ type ActivityScheduledAttributes struct {
1010

1111
Inputs []payload.Payload `json:"inputs,omitempty"`
1212

13-
Metadata *core.WorkflowMetadata `json:"metadata,omitempty"`
13+
Metadata *metadata.WorkflowMetadata `json:"metadata,omitempty"`
1414
}

internal/history/grouping.go renamed to backend/history/grouping.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package history
22

3-
import "github.com/cschleiden/go-workflows/internal/core"
3+
import "github.com/cschleiden/go-workflows/core"
44

55
func EventsByWorkflowInstance(events []WorkflowEvent) map[core.WorkflowInstance][]WorkflowEvent {
66
groupedEvents := make(map[core.WorkflowInstance][]WorkflowEvent)

internal/history/grouping_test.go renamed to backend/history/grouping_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"testing"
55
"time"
66

7-
"github.com/cschleiden/go-workflows/internal/core"
7+
"github.com/cschleiden/go-workflows/core"
88
"github.com/google/uuid"
99
"github.com/stretchr/testify/require"
1010
)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)