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

Side by Side Diff: impl/prod/raw_datastore.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 unified diff | Download patch
« no previous file with comments | « impl/prod/everything_test.go ('k') | service/datastore/checkfilter_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 prod 5 package prod
6 6
7 import ( 7 import (
8 ds "github.com/luci/gae/service/datastore" 8 ds "github.com/luci/gae/service/datastore"
9 "github.com/luci/gae/service/info" 9 "github.com/luci/gae/service/info"
10 "github.com/luci/luci-go/common/errors" 10 "github.com/luci/luci-go/common/errors"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 tf := typeFilter{} 210 tf := typeFilter{}
211 for { 211 for {
212 k, err := t.Next(&tf) 212 k, err := t.Next(&tf)
213 if err == datastore.Done { 213 if err == datastore.Done {
214 return nil 214 return nil
215 } 215 }
216 if err != nil { 216 if err != nil {
217 return err 217 return err
218 } 218 }
219 » » if !cb(dsR2F(k), tf.pm, cfunc) { 219 » » if err := cb(dsR2F(k), tf.pm, cfunc); err != nil {
220 » » » return nil 220 » » » if err == ds.Stop {
221 » » » » return nil
222 » » » }
223 » » » return err
221 } 224 }
222 } 225 }
223 } 226 }
224 227
225 func (d rdsImpl) Count(fq *ds.FinalizedQuery) (int64, error) { 228 func (d rdsImpl) Count(fq *ds.FinalizedQuery) (int64, error) {
226 q, err := d.fixQuery(fq) 229 q, err := d.fixQuery(fq)
227 if err != nil { 230 if err != nil {
228 return 0, err 231 return 0, err
229 } 232 }
230 ret, err := q.Count(d.aeCtx) 233 ret, err := q.Count(d.aeCtx)
231 return int64(ret), err 234 return int64(ret), err
232 } 235 }
233 236
234 func (d rdsImpl) RunInTransaction(f func(c context.Context) error, opts *ds.Tran sactionOptions) error { 237 func (d rdsImpl) RunInTransaction(f func(c context.Context) error, opts *ds.Tran sactionOptions) error {
235 ropts := (*datastore.TransactionOptions)(opts) 238 ropts := (*datastore.TransactionOptions)(opts)
236 return datastore.RunInTransaction(d.aeCtx, func(c context.Context) error { 239 return datastore.RunInTransaction(d.aeCtx, func(c context.Context) error {
237 return f(context.WithValue(d.userCtx, prodContextKey, c)) 240 return f(context.WithValue(d.userCtx, prodContextKey, c))
238 }, ropts) 241 }, ropts)
239 } 242 }
240 243
241 func (d rdsImpl) Testable() ds.Testable { 244 func (d rdsImpl) Testable() ds.Testable {
242 return nil 245 return nil
243 } 246 }
OLDNEW
« no previous file with comments | « impl/prod/everything_test.go ('k') | service/datastore/checkfilter_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698