Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1059)

Side by Side Diff: impl/memory/gkvlite_iter.go

Issue 1844183003: Don't filter "Stop" error in raw interface. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Count filter doesn't count Stop as error. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « impl/memory/datastore_query_execution_test.go ('k') | impl/memory/gkvlite_iter_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 memory 5 package memory
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "sync" 9 "sync"
10 10
11 "github.com/luci/gae/service/datastore"
12 "github.com/luci/gae/service/datastore/serialize" 11 "github.com/luci/gae/service/datastore/serialize"
13 "github.com/luci/gkvlite" 12 "github.com/luci/gkvlite"
14 ) 13 )
15 14
16 type iterDefinition struct { 15 type iterDefinition struct {
17 // The collection to iterate over 16 // The collection to iterate over
18 c *memCollection 17 c *memCollection
19 18
20 // The prefix to always assert for every row. A nil prefix matches every row. 19 // The prefix to always assert for every row. A nil prefix matches every row.
21 prefix []byte 20 prefix []byte
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 92 }
94 } 93 }
95 if stop { 94 if stop {
96 return nil 95 return nil
97 } 96 }
98 if restart { 97 if restart {
99 continue 98 continue
100 } 99 }
101 100
102 if err := cb(suffix); err != nil { 101 if err := cb(suffix); err != nil {
103 if err == datastore.Stop {
104 return nil
105 }
106 return err 102 return err
107 } 103 }
108 suffix = nil 104 suffix = nil
109 skip = -1 105 skip = -1
110 } 106 }
111 } 107 }
112 108
113 type cmd struct { 109 type cmd struct {
114 targ []byte 110 targ []byte
115 cb func(*gkvlite.Item) 111 cb func(*gkvlite.Item)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 t.ch <- &cmd{targ, func(i *gkvlite.Item) { 207 t.ch <- &cmd{targ, func(i *gkvlite.Item) {
212 defer close(waiter) 208 defer close(waiter)
213 209
214 if i == nil { 210 if i == nil {
215 t.stop() 211 t.stop()
216 } 212 }
217 cb(i) 213 cb(i)
218 }} 214 }}
219 <-waiter 215 <-waiter
220 } 216 }
OLDNEW
« no previous file with comments | « impl/memory/datastore_query_execution_test.go ('k') | impl/memory/gkvlite_iter_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698