| 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         "golang.org/x/net/context" |   10         "golang.org/x/net/context" | 
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  124                         k = dsR2F(rkeys[idx]) |  124                         k = dsR2F(rkeys[idx]) | 
|  125                 } |  125                 } | 
|  126                 cb(k, err) |  126                 cb(k, err) | 
|  127         }) |  127         }) | 
|  128 } |  128 } | 
|  129  |  129  | 
|  130 func (d rdsImpl) NewQuery(kind string) ds.Query { |  130 func (d rdsImpl) NewQuery(kind string) ds.Query { | 
|  131         return queryImpl{datastore.NewQuery(kind)} |  131         return queryImpl{datastore.NewQuery(kind)} | 
|  132 } |  132 } | 
|  133  |  133  | 
 |  134 func (d rdsImpl) DecodeCursor(s string) (ds.Cursor, error) { | 
 |  135         return datastore.DecodeCursor(s) | 
 |  136 } | 
 |  137  | 
|  134 func (d rdsImpl) Run(q ds.Query, cb ds.RawRunCB) error { |  138 func (d rdsImpl) Run(q ds.Query, cb ds.RawRunCB) error { | 
|  135         tf := typeFilter{} |  139         tf := typeFilter{} | 
|  136         t := q.(queryImpl).Query.Run(d) |  140         t := q.(queryImpl).Query.Run(d) | 
|  137         cfunc := func() (ds.Cursor, error) { |  141         cfunc := func() (ds.Cursor, error) { | 
|  138                 return t.Cursor() |  142                 return t.Cursor() | 
|  139         } |  143         } | 
|  140         for { |  144         for { | 
|  141                 k, err := t.Next(&tf) |  145                 k, err := t.Next(&tf) | 
|  142                 if err == datastore.Done { |  146                 if err == datastore.Done { | 
|  143                         return nil |  147                         return nil | 
|  144                 } |  148                 } | 
|  145                 if err != nil { |  149                 if err != nil { | 
|  146                         return err |  150                         return err | 
|  147                 } |  151                 } | 
|  148                 if !cb(dsR2F(k), tf.pm, cfunc) { |  152                 if !cb(dsR2F(k), tf.pm, cfunc) { | 
|  149                         return nil |  153                         return nil | 
|  150                 } |  154                 } | 
|  151         } |  155         } | 
|  152 } |  156 } | 
|  153  |  157  | 
|  154 func (d rdsImpl) RunInTransaction(f func(c context.Context) error, opts *ds.Tran
     sactionOptions) error { |  158 func (d rdsImpl) RunInTransaction(f func(c context.Context) error, opts *ds.Tran
     sactionOptions) error { | 
|  155         ropts := (*datastore.TransactionOptions)(opts) |  159         ropts := (*datastore.TransactionOptions)(opts) | 
|  156         return datastore.RunInTransaction(d, f, ropts) |  160         return datastore.RunInTransaction(d, f, ropts) | 
|  157 } |  161 } | 
|  158  |  162  | 
|  159 func (d rdsImpl) Testable() ds.Testable { |  163 func (d rdsImpl) Testable() ds.Testable { | 
|  160         return nil |  164         return nil | 
|  161 } |  165 } | 
| OLD | NEW |