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

Side by Side Diff: impl/memory/datastore.go

Issue 2007123002: datastore: Update AllocateIDs to take keys. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Rebase, comments. Created 4 years, 6 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
« no previous file with comments | « impl/dummy/dummy.go ('k') | impl/memory/datastore_data.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 LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package memory 5 package memory
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "fmt" 9 "fmt"
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // dsImpl exists solely to bind the current c to the datastore data. 75 // dsImpl exists solely to bind the current c to the datastore data.
76 type dsImpl struct { 76 type dsImpl struct {
77 data *dataStoreData 77 data *dataStoreData
78 ns string 78 ns string
79 hasNS bool 79 hasNS bool
80 c context.Context 80 c context.Context
81 } 81 }
82 82
83 var _ ds.RawInterface = (*dsImpl)(nil) 83 var _ ds.RawInterface = (*dsImpl)(nil)
84 84
85 func (d *dsImpl) AllocateIDs(incomplete *ds.Key, n int) (int64, error) { 85 func (d *dsImpl) AllocateIDs(keys []*ds.Key, cb ds.NewKeyCB) error {
86 » return d.data.allocateIDs(incomplete, n) 86 » return d.data.allocateIDs(keys, cb)
87 } 87 }
88 88
89 func (d *dsImpl) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMultiC B) error { 89 func (d *dsImpl) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.NewKeyCB) error {
90 d.data.putMulti(keys, vals, cb) 90 d.data.putMulti(keys, vals, cb)
91 return nil 91 return nil
92 } 92 }
93 93
94 func (d *dsImpl) GetMulti(keys []*ds.Key, _meta ds.MultiMetaGetter, cb ds.GetMul tiCB) error { 94 func (d *dsImpl) GetMulti(keys []*ds.Key, _meta ds.MultiMetaGetter, cb ds.GetMul tiCB) error {
95 return d.data.getMulti(keys, cb) 95 return d.data.getMulti(keys, cb)
96 } 96 }
97 97
98 func (d *dsImpl) DeleteMulti(keys []*ds.Key, cb ds.DeleteMultiCB) error { 98 func (d *dsImpl) DeleteMulti(keys []*ds.Key, cb ds.DeleteMultiCB) error {
99 d.data.delMulti(keys, cb) 99 d.data.delMulti(keys, cb)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 ////////////////////////////////// txnDsImpl /////////////////////////////////// 181 ////////////////////////////////// txnDsImpl ///////////////////////////////////
182 182
183 type txnDsImpl struct { 183 type txnDsImpl struct {
184 data *txnDataStoreData 184 data *txnDataStoreData
185 ns string 185 ns string
186 hasNS bool 186 hasNS bool
187 } 187 }
188 188
189 var _ ds.RawInterface = (*txnDsImpl)(nil) 189 var _ ds.RawInterface = (*txnDsImpl)(nil)
190 190
191 func (d *txnDsImpl) AllocateIDs(incomplete *ds.Key, n int) (int64, error) { 191 func (d *txnDsImpl) AllocateIDs(keys []*ds.Key, cb ds.NewKeyCB) error {
192 » return d.data.parent.allocateIDs(incomplete, n) 192 » return d.data.parent.allocateIDs(keys, cb)
193 } 193 }
194 194
195 func (d *txnDsImpl) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMul tiCB) error { 195 func (d *txnDsImpl) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.NewKey CB) error {
196 return d.data.run(func() error { 196 return d.data.run(func() error {
197 d.data.putMulti(keys, vals, cb) 197 d.data.putMulti(keys, vals, cb)
198 return nil 198 return nil
199 }) 199 })
200 } 200 }
201 201
202 func (d *txnDsImpl) GetMulti(keys []*ds.Key, _meta ds.MultiMetaGetter, cb ds.Get MultiCB) error { 202 func (d *txnDsImpl) GetMulti(keys []*ds.Key, _meta ds.MultiMetaGetter, cb ds.Get MultiCB) error {
203 return d.data.run(func() error { 203 return d.data.run(func() error {
204 return d.data.getMulti(keys, cb) 204 return d.data.getMulti(keys, cb)
205 }) 205 })
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if ns == "" && hasNS { 252 if ns == "" && hasNS {
253 // The user has set an empty namespace. Datastore does not suppo rt this 253 // The user has set an empty namespace. Datastore does not suppo rt this
254 // for queries. 254 // for queries.
255 // 255 //
256 // Bug on file is: 256 // Bug on file is:
257 // https://code.google.com/p/googleappengine/issues/detail?id=12 914 257 // https://code.google.com/p/googleappengine/issues/detail?id=12 914
258 return errors.New("namespace may not be present and empty") 258 return errors.New("namespace may not be present and empty")
259 } 259 }
260 return nil 260 return nil
261 } 261 }
OLDNEW
« no previous file with comments | « impl/dummy/dummy.go ('k') | impl/memory/datastore_data.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698