| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package txnBuf | 5 package txnBuf |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "sort" | 9 "sort" |
| 10 | 10 |
| 11 "github.com/luci/gae/impl/memory" | 11 "github.com/luci/gae/impl/memory" |
| 12 ds "github.com/luci/gae/service/datastore" | 12 ds "github.com/luci/gae/service/datastore" |
| 13 "github.com/luci/gae/service/datastore/serialize" | 13 "github.com/luci/gae/service/datastore/serialize" |
| 14 » "github.com/luci/luci-go/common/stringset" | 14 » "github.com/luci/luci-go/common/data/stringset" |
| 15 ) | 15 ) |
| 16 | 16 |
| 17 // queryToIter takes a FinalizedQuery and returns an iterator function which | 17 // queryToIter takes a FinalizedQuery and returns an iterator function which |
| 18 // will produce either *items or errors. | 18 // will produce either *items or errors. |
| 19 // | 19 // |
| 20 // - d is the raw datastore to run this query on | 20 // - d is the raw datastore to run this query on |
| 21 // - filter is a function which will return true if the given key should be | 21 // - filter is a function which will return true if the given key should be |
| 22 // excluded from the result set. | 22 // excluded from the result set. |
| 23 func queryToIter(stopChan chan struct{}, fq *ds.FinalizedQuery, d ds.RawInterfac
e) func() (*item, error) { | 23 func queryToIter(stopChan chan struct{}, fq *ds.FinalizedQuery, d ds.RawInterfac
e) func() (*item, error) { |
| 24 c := make(chan *item) | 24 c := make(chan *item) |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } | 289 } |
| 290 if !foundOne { | 290 if !foundOne { |
| 291 return nil, nil | 291 return nil, nil |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 if end != nil && bytes.Compare(soFar, end) >= 0 { | 294 if end != nil && bytes.Compare(soFar, end) >= 0 { |
| 295 return nil, nil | 295 return nil, nil |
| 296 } | 296 } |
| 297 return soFar, ps["__key__"][0] | 297 return soFar, ps["__key__"][0] |
| 298 } | 298 } |
| OLD | NEW |