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

Unified Diff: impl/memory/gkvlite_iter.go

Issue 1521823003: Clean up callback interfaces. (Closed) Base URL: https://github.com/luci/gae.git@extra
Patch Set: fixins Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/memory/datastore_test.go ('k') | impl/memory/gkvlite_iter_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/gkvlite_iter.go
diff --git a/impl/memory/gkvlite_iter.go b/impl/memory/gkvlite_iter.go
index 2d2419c26db0659a10a83a66865cad65231ba321..0569d1412e18a49637efc25800986e7e7394fd5f 100644
--- a/impl/memory/gkvlite_iter.go
+++ b/impl/memory/gkvlite_iter.go
@@ -8,6 +8,7 @@ import (
"bytes"
"sync"
+ "github.com/luci/gae/service/datastore"
"github.com/luci/gae/service/datastore/serialize"
"github.com/luci/gkvlite"
)
@@ -37,9 +38,9 @@ type iterDefinition struct {
end []byte
}
-func multiIterate(defs []*iterDefinition, cb func(suffix []byte) bool) {
+func multiIterate(defs []*iterDefinition, cb func(suffix []byte) error) error {
if len(defs) == 0 {
- return
+ return nil
}
ts := make([]*iterator, len(defs))
@@ -92,14 +93,17 @@ func multiIterate(defs []*iterDefinition, cb func(suffix []byte) bool) {
}
}
if stop {
- return
+ return nil
}
if restart {
continue
}
- if !cb(suffix) {
- return
+ if err := cb(suffix); err != nil {
+ if err == datastore.Stop {
+ return nil
+ }
+ return err
}
suffix = nil
skip = -1
« no previous file with comments | « impl/memory/datastore_test.go ('k') | impl/memory/gkvlite_iter_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698