Skip to content

Commit 24aa630

Browse files
authored
Merge pull request #31 from famarting/support-loadbalance-2
Support loadbalance of durable task clients over multiple backends
2 parents 5c264ed + 6b610fc commit 24aa630

File tree

13 files changed

+599
-226
lines changed

13 files changed

+599
-226
lines changed

api/orchestration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var (
1818
ErrNoFailures = errors.New("orchestration did not report failure details")
1919
ErrDuplicateInstance = errors.New("orchestration instance already exists")
2020
ErrIgnoreInstance = errors.New("ignore creating orchestration instance")
21+
ErrTaskCancelled = errors.New("task was cancelled")
2122

2223
EmptyInstanceID = InstanceID("")
2324
)

backend/backend.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,28 @@ type Backend interface {
126126
// [api.ErrInstanceNotFound] is returned if the specified orchestration instance doesn't exist.
127127
// [api.ErrNotCompleted] is returned if the specified orchestration instance is still running.
128128
PurgeOrchestrationState(context.Context, api.InstanceID) error
129+
130+
// CompleteOrchestratorTask completes the orchestrator task by saving the updated runtime state to durable storage.
131+
CompleteOrchestratorTask(context.Context, *protos.OrchestratorResponse) error
132+
133+
// CancelOrchestratorTask cancels the orchestrator task so instances of WaitForOrchestratorCompletion will return an error.
134+
CancelOrchestratorTask(context.Context, api.InstanceID) error
135+
136+
// WaitForOrchestratorCompletion blocks until the orchestrator completes and returns the final response.
137+
//
138+
// [api.ErrTaskCancelled] is returned if the task was cancelled.
139+
WaitForOrchestratorCompletion(context.Context, *protos.OrchestratorRequest) (*protos.OrchestratorResponse, error)
140+
141+
// CompleteActivityTask completes the activity task by saving the updated runtime state to durable storage.
142+
CompleteActivityTask(context.Context, *protos.ActivityResponse) error
143+
144+
// CancelActivityTask cancels the activity task so instances of WaitForActivityCompletion will return an error.
145+
CancelActivityTask(context.Context, api.InstanceID, int32) error
146+
147+
// WaitForActivityCompletion blocks until the activity completes and returns the final response.
148+
//
149+
// [api.ErrTaskCancelled] is returned if the task was cancelled.
150+
WaitForActivityCompletion(context.Context, *protos.ActivityRequest) (*protos.ActivityResponse, error)
129151
}
130152

131153
// MarshalHistoryEvent serializes the [HistoryEvent] into a protobuf byte array.

0 commit comments

Comments
 (0)