Skip to content

Commit 0dbca94

Browse files
committed
remove ResultBuilder
1 parent 1676d10 commit 0dbca94

File tree

1 file changed

+0
-52
lines changed

1 file changed

+0
-52
lines changed

query/query.go

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package query
33
import (
44
"context"
55
"fmt"
6-
"sync"
76
"time"
87
)
98

@@ -201,57 +200,6 @@ func (r *results) Done() <-chan struct{} {
201200
return r.closed
202201
}
203202

204-
// ResultBuilder is what implementors use to construct results
205-
// Implementors of datastores and their clients must respect the
206-
// Process of the Request:
207-
//
208-
// - clients must call r.Process().Close() on an early exit, so
209-
// implementations can reclaim resources.
210-
// - if the Entries are read to completion (channel closed), Process
211-
// should be closed automatically.
212-
// - datastores must respect <-Process.Closing(), which intermediates
213-
// an early close signal from the client.
214-
type ResultBuilder struct {
215-
Query Query
216-
Output chan Result
217-
218-
ctx context.Context
219-
cancel context.CancelFunc
220-
closed chan struct{}
221-
wg sync.WaitGroup
222-
}
223-
224-
// Results returns a Results to to this builder.
225-
func (rb *ResultBuilder) Results() Results {
226-
return &results{
227-
query: rb.Query,
228-
res: rb.Output,
229-
230-
cancel: rb.cancel,
231-
closed: rb.closed,
232-
}
233-
}
234-
235-
func NewResultBuilder(q Query) *ResultBuilder {
236-
bufSize := NormalBufSize
237-
if q.KeysOnly {
238-
bufSize = KeysOnlyBufSize
239-
}
240-
b := &ResultBuilder{
241-
Query: q,
242-
Output: make(chan Result, bufSize),
243-
closed: make(chan struct{}),
244-
}
245-
246-
b.ctx, b.cancel = context.WithCancel(context.Background())
247-
context.AfterFunc(b.ctx, func() {
248-
b.wg.Wait()
249-
close(b.Output)
250-
close(b.closed)
251-
})
252-
return b
253-
}
254-
255203
// ResultsWithContext returns a Results object with the results generated by
256204
// the passed proc function called in a separate goroutine.
257205
func ResultsWithContext(q Query, proc func(context.Context, chan<- Result)) Results {

0 commit comments

Comments
 (0)