OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // 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 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 if distinct != nil { | 228 if distinct != nil { |
229 // NOTE: We know that toUse will not be used after this
point for | 229 // NOTE: We know that toUse will not be used after this
point for |
230 // comparison purposes, so re-use its cmpRow property fo
r our distinct | 230 // comparison purposes, so re-use its cmpRow property fo
r our distinct |
231 // filter here. | 231 // filter here. |
232 toUse.cmpRow = "" | 232 toUse.cmpRow = "" |
233 if !distinct.Add(toUse.getCmpRow(nil, nil, distinctOrder
)) { | 233 if !distinct.Add(toUse.getCmpRow(nil, nil, distinctOrder
)) { |
234 continue | 234 continue |
235 } | 235 } |
236 } | 236 } |
237 if err := cb(toUse.key, toUse.data); err != nil { | 237 if err := cb(toUse.key, toUse.data); err != nil { |
238 if err == ds.Stop { | |
239 return nil | |
240 } | |
241 return err | 238 return err |
242 } | 239 } |
243 } | 240 } |
244 | 241 |
245 return nil | 242 return nil |
246 } | 243 } |
247 | 244 |
248 // toComparableString computes the byte-sortable 'order' string for the given | 245 // toComparableString computes the byte-sortable 'order' string for the given |
249 // key/PropertyMap. | 246 // key/PropertyMap. |
250 // | 247 // |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 289 } |
293 if !foundOne { | 290 if !foundOne { |
294 return nil, nil | 291 return nil, nil |
295 } | 292 } |
296 } | 293 } |
297 if end != nil && bytes.Compare(soFar, end) >= 0 { | 294 if end != nil && bytes.Compare(soFar, end) >= 0 { |
298 return nil, nil | 295 return nil, nil |
299 } | 296 } |
300 return soFar, ps["__key__"][0] | 297 return soFar, ps["__key__"][0] |
301 } | 298 } |
OLD | NEW |