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 28 matching lines...) Expand all Loading... |
39 me, ok := err.(errors.MultiError) | 39 me, ok := err.(errors.MultiError) |
40 if ok { | 40 if ok { |
41 for i, err := range me { | 41 for i, err := range me { |
42 cb(i, err) | 42 cb(i, err) |
43 } | 43 } |
44 return nil | 44 return nil |
45 } | 45 } |
46 return err | 46 return err |
47 } | 47 } |
48 | 48 |
| 49 func (d rdsImpl) AllocateIDs(incomplete *ds.Key, n int) (start int64, err error)
{ |
| 50 par, err := dsF2R(d, incomplete.Parent()) |
| 51 if err != nil { |
| 52 return |
| 53 } |
| 54 |
| 55 start, _, err = datastore.AllocateIDs(d, incomplete.Last().Kind, par, n) |
| 56 return |
| 57 } |
| 58 |
49 func (d rdsImpl) DeleteMulti(ks []*ds.Key, cb ds.DeleteMultiCB) error { | 59 func (d rdsImpl) DeleteMulti(ks []*ds.Key, cb ds.DeleteMultiCB) error { |
50 keys, err := dsMF2R(d, ks) | 60 keys, err := dsMF2R(d, ks) |
51 if err == nil { | 61 if err == nil { |
52 err = datastore.DeleteMulti(d, keys) | 62 err = datastore.DeleteMulti(d, keys) |
53 } | 63 } |
54 return idxCallbacker(err, len(ks), func(_ int, err error) { | 64 return idxCallbacker(err, len(ks), func(_ int, err error) { |
55 cb(err) | 65 cb(err) |
56 }) | 66 }) |
57 } | 67 } |
58 | 68 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 208 } |
199 | 209 |
200 func (d rdsImpl) RunInTransaction(f func(c context.Context) error, opts *ds.Tran
sactionOptions) error { | 210 func (d rdsImpl) RunInTransaction(f func(c context.Context) error, opts *ds.Tran
sactionOptions) error { |
201 ropts := (*datastore.TransactionOptions)(opts) | 211 ropts := (*datastore.TransactionOptions)(opts) |
202 return datastore.RunInTransaction(d, f, ropts) | 212 return datastore.RunInTransaction(d, f, ropts) |
203 } | 213 } |
204 | 214 |
205 func (d rdsImpl) Testable() ds.Testable { | 215 func (d rdsImpl) Testable() ds.Testable { |
206 return nil | 216 return nil |
207 } | 217 } |
OLD | NEW |