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

Unified Diff: service/datastore/interface.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 | « service/datastore/errors.go ('k') | service/datastore/propertytype_string.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/interface.go
diff --git a/service/datastore/interface.go b/service/datastore/interface.go
index 440ea36541c7f5d4b143605262a1dccf8887d4f4..f2909e45a62f1820f595ed55d8d57be3c80c1a44 100644
--- a/service/datastore/interface.go
+++ b/service/datastore/interface.go
@@ -96,14 +96,24 @@ type Interface interface {
// retrieved item.
//
// cb is a callback function whose signature is
- // func(obj TYPE, getCursor CursorCB) bool
+ // func(obj TYPE[, getCursor CursorCB]) [error]
//
// Where TYPE is one of:
// - S or *S where S is a struct
// - P or *P where *P is a concrete type implementing PropertyLoadSaver
// - *Key (implies a keys-only query)
//
- // Run stops on the first error encountered.
+ // If the error is omitted from the signature, this will run until the query
+ // returns all its results, or has an error/times out.
+ //
+ // If error is in the signature, the query will continue as long as the
+ // callback returns nil. If it returns `Stop`, the query will stop and Run
+ // will return nil. Otherwise, the query will stop and Run will return the
+ // user's error.
+ //
+ // Run may also stop on the first datastore error encountered, which can occur
+ // due to flakiness, timeout, etc. If it encounters such an error, it will
+ // be returned.
Run(q *Query, cb interface{}) error
// Count executes the given query and returns the number of entries which
« no previous file with comments | « service/datastore/errors.go ('k') | service/datastore/propertytype_string.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698