| 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 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  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 err := cb(dsR2F(k), tf.pm, cfunc); err != nil { |  219                 if err := cb(dsR2F(k), tf.pm, cfunc); err != nil { | 
|  220                         if err == ds.Stop { |  | 
|  221                                 return nil |  | 
|  222                         } |  | 
|  223                         return err |  220                         return err | 
|  224                 } |  221                 } | 
|  225         } |  222         } | 
|  226 } |  223 } | 
|  227  |  224  | 
|  228 func (d rdsImpl) Count(fq *ds.FinalizedQuery) (int64, error) { |  225 func (d rdsImpl) Count(fq *ds.FinalizedQuery) (int64, error) { | 
|  229         q, err := d.fixQuery(fq) |  226         q, err := d.fixQuery(fq) | 
|  230         if err != nil { |  227         if err != nil { | 
|  231                 return 0, err |  228                 return 0, err | 
|  232         } |  229         } | 
|  233         ret, err := q.Count(d.aeCtx) |  230         ret, err := q.Count(d.aeCtx) | 
|  234         return int64(ret), err |  231         return int64(ret), err | 
|  235 } |  232 } | 
|  236  |  233  | 
|  237 func (d rdsImpl) RunInTransaction(f func(c context.Context) error, opts *ds.Tran
     sactionOptions) error { |  234 func (d rdsImpl) RunInTransaction(f func(c context.Context) error, opts *ds.Tran
     sactionOptions) error { | 
|  238         ropts := (*datastore.TransactionOptions)(opts) |  235         ropts := (*datastore.TransactionOptions)(opts) | 
|  239         return datastore.RunInTransaction(d.aeCtx, func(c context.Context) error
      { |  236         return datastore.RunInTransaction(d.aeCtx, func(c context.Context) error
      { | 
|  240                 return f(context.WithValue(d.userCtx, prodContextKey, c)) |  237                 return f(context.WithValue(d.userCtx, prodContextKey, c)) | 
|  241         }, ropts) |  238         }, ropts) | 
|  242 } |  239 } | 
|  243  |  240  | 
|  244 func (d rdsImpl) Testable() ds.Testable { |  241 func (d rdsImpl) Testable() ds.Testable { | 
|  245         return nil |  242         return nil | 
|  246 } |  243 } | 
| OLD | NEW |