@@ -9,12 +9,8 @@ import (
99 "go.uber.org/cadence/internal"
1010)
1111
12- type BatchFuture interface {
13- internal.Future
14- GetFutures () []internal.Future
15- }
16-
17- type batchFutureImpl struct {
12+ // BatchFutureImpl is an implementation of BatchFuture
13+ type BatchFutureImpl struct {
1814 futures []internal.Future
1915 settables []internal.Settable
2016 factories []func (ctx internal.Context ) internal.Future
@@ -24,7 +20,7 @@ type batchFutureImpl struct {
2420 wg internal.WaitGroup
2521}
2622
27- func NewBatchFuture (ctx internal.Context , batchSize int , factories []func (ctx internal.Context ) internal.Future ) (BatchFuture , error ) {
23+ func NewBatchFuture (ctx internal.Context , batchSize int , factories []func (ctx internal.Context ) internal.Future ) (* BatchFutureImpl , error ) {
2824 var futures []internal.Future
2925 var settables []internal.Settable
3026 for range factories {
@@ -33,7 +29,7 @@ func NewBatchFuture(ctx internal.Context, batchSize int, factories []func(ctx in
3329 settables = append (settables , settable )
3430 }
3531
36- batchFuture := & batchFutureImpl {
32+ batchFuture := & BatchFutureImpl {
3733 futures : futures ,
3834 settables : settables ,
3935 factories : factories ,
@@ -45,11 +41,11 @@ func NewBatchFuture(ctx internal.Context, batchSize int, factories []func(ctx in
4541 return batchFuture , nil
4642}
4743
48- func (b * batchFutureImpl ) GetFutures () []internal.Future {
44+ func (b * BatchFutureImpl ) GetFutures () []internal.Future {
4945 return b .futures
5046}
5147
52- func (b * batchFutureImpl ) start (ctx internal.Context ) {
48+ func (b * BatchFutureImpl ) start (ctx internal.Context ) {
5349
5450 buffered := internal .NewBufferedChannel (ctx , b .batchSize ) // buffered channel to limit the number of concurrent futures
5551 channel := internal .NewNamedChannel (ctx , "batch-future-channel" )
@@ -91,7 +87,7 @@ func (b *batchFutureImpl) start(ctx internal.Context) {
9187 })
9288}
9389
94- func (b * batchFutureImpl ) IsReady () bool {
90+ func (b * BatchFutureImpl ) IsReady () bool {
9591 for _ , future := range b .futures {
9692 if ! future .IsReady () {
9793 return false
@@ -105,7 +101,7 @@ func (b *batchFutureImpl) IsReady() bool {
105101// If valuePtr is a pointer to a slice, the slice will be resized to the length of the futures. Each element of the slice will be assigned with the underlying Future.Get() and thus behaves the same way.
106102// If valuePtr is nil, no assignment will be made.
107103// If error occurs, values will be set on successful futures and the errors of failed futures will be returned.
108- func (b * batchFutureImpl ) Get (ctx internal.Context , valuePtr interface {}) error {
104+ func (b * BatchFutureImpl ) Get (ctx internal.Context , valuePtr interface {}) error {
109105 // No assignment if valuePtr is nil
110106 if valuePtr == nil {
111107 b .wg .Wait (ctx )
0 commit comments