Skip to content

Commit cae5564

Browse files
authored
move NewBatchFuture API to stable workflow package (#1459)
Signed-off-by: Shijie Sheng <liouvetren@gmail.com> Detailed Description Move NewBatchFuture API out of X package. Impact Analysis Backward Compatibility: breaking for x package users. This is expected since it's experimental feature Forward Compatibility: not applicable since it's a pure client side feature Testing Plan Unit Tests: Yes but not for this pure package change particularly. Persistence Tests: no applicable Integration Tests: we have Compatibility Tests: it's an intended breaking change Rollout Plan What is the rollout plan? Existing users will need to make code changes after upgrading it. Does the order of deployment matter? No Is it safe to rollback? Does the order of rollback matter? Yes. No Is there a kill switch to mitigate the impact immediately? Not needed
1 parent 2737bd0 commit cae5564

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

x/batch.go renamed to workflow/batch.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
package x
1+
package workflow
22

33
import (
44
"go.uber.org/cadence/internal/batch"
5-
"go.uber.org/cadence/workflow"
65
)
76

8-
var _ workflow.Future = (BatchFuture)(nil) // to ensure it's compatible
7+
var _ Future = (BatchFuture)(nil) // to ensure it's compatible
98

109
// BatchFuture wraps a collection of futures, and provides some convenience methods for dealing with them in bulk.
1110
type BatchFuture interface {
@@ -22,10 +21,10 @@ type BatchFuture interface {
2221
// exposed normally, but multiple ones are bundled in the same way as errors.Join.
2322
// For consistency when checking individual errors, consider using `multierr.Errors(err)` in all cases,
2423
// or `GetFutures()[i].Get(ctx, nil)` to get the original errors at each index.
25-
Get(ctx workflow.Context, valuePtr interface{}) error
24+
Get(ctx Context, valuePtr interface{}) error
2625
// GetFutures returns a slice of all the wrapped futures.
2726
// This slice MUST NOT be modified, but the individual futures can be used normally.
28-
GetFutures() []workflow.Future
27+
GetFutures() []Future
2928
}
3029

3130
// NewBatchFuture creates a bounded-concurrency helper for doing bulk work in your workflow.
@@ -35,6 +34,6 @@ type BatchFuture interface {
3534
//
3635
// When NewBatchFuture is called, futures created by the factories will be started concurrently until the concurrency limit (batchSize) is reached.
3736
// The remaining factories will be queued and started as previous futures complete, maintaining the specified concurrency level.
38-
func NewBatchFuture(ctx workflow.Context, batchSize int, factories []func(ctx workflow.Context) workflow.Future) (BatchFuture, error) {
37+
func NewBatchFuture(ctx Context, batchSize int, factories []func(ctx Context) Future) (BatchFuture, error) {
3938
return batch.NewBatchFuture(ctx, batchSize, factories)
4039
}

0 commit comments

Comments
 (0)