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

Side by Side Diff: impl/prod/raw_datastore.go

Issue 1358063003: Add Kind/StringID/IntID back to Key. (Closed) Base URL: https://github.com/luci/gae.git@add_allocate_ids
Patch Set: Created 5 years, 3 months 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 49 func (d rdsImpl) AllocateIDs(incomplete *ds.Key, n int) (start int64, err error) {
50 par, err := dsF2R(d, incomplete.Parent()) 50 par, err := dsF2R(d, incomplete.Parent())
51 if err != nil { 51 if err != nil {
52 return 52 return
53 } 53 }
54 54
55 » start, _, err = datastore.AllocateIDs(d, incomplete.Last().Kind, par, n) 55 » start, _, err = datastore.AllocateIDs(d, incomplete.Kind(), par, n)
56 return 56 return
57 } 57 }
58 58
59 func (d rdsImpl) DeleteMulti(ks []*ds.Key, cb ds.DeleteMultiCB) error { 59 func (d rdsImpl) DeleteMulti(ks []*ds.Key, cb ds.DeleteMultiCB) error {
60 keys, err := dsMF2R(d, ks) 60 keys, err := dsMF2R(d, ks)
61 if err == nil { 61 if err == nil {
62 err = datastore.DeleteMulti(d, keys) 62 err = datastore.DeleteMulti(d, keys)
63 } 63 }
64 return idxCallbacker(err, len(ks), func(_ int, err error) { 64 return idxCallbacker(err, len(ks), func(_ int, err error) {
65 cb(err) 65 cb(err)
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 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 {
211 ropts := (*datastore.TransactionOptions)(opts) 211 ropts := (*datastore.TransactionOptions)(opts)
212 return datastore.RunInTransaction(d, f, ropts) 212 return datastore.RunInTransaction(d, f, ropts)
213 } 213 }
214 214
215 func (d rdsImpl) Testable() ds.Testable { 215 func (d rdsImpl) Testable() ds.Testable {
216 return nil 216 return nil
217 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698