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

Unified Diff: impl/memory/datastore.go

Issue 1357343002: Add missing AllocateIDs API. (Closed) Base URL: https://github.com/luci/gae.git@master
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 side-by-side diff with in-line comments
Download patch
Index: impl/memory/datastore.go
diff --git a/impl/memory/datastore.go b/impl/memory/datastore.go
index 5ca321b66498c2269da173818c22654c8304fa3c..62c9a99825b8b045c832d76958bc1c816d827563 100644
--- a/impl/memory/datastore.go
+++ b/impl/memory/datastore.go
@@ -40,6 +40,11 @@ type dsImpl struct {
var _ ds.RawInterface = (*dsImpl)(nil)
+func (d *dsImpl) AllocateIDs(incomplete *ds.Key, n int) (int64, error) {
+ start := d.data.allocateIDs(incomplete, n)
+ return start, nil
+}
+
func (d *dsImpl) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMultiCB) error {
d.data.putMulti(keys, vals, cb)
return nil
@@ -108,6 +113,11 @@ type txnDsImpl struct {
var _ ds.RawInterface = (*txnDsImpl)(nil)
+func (d *txnDsImpl) AllocateIDs(incomplete *ds.Key, n int) (int64, error) {
+ start := d.data.parent.allocateIDs(incomplete, n)
+ return start, nil
+}
+
func (d *txnDsImpl) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMultiCB) error {
return d.data.run(func() error {
d.data.putMulti(keys, vals, cb)

Powered by Google App Engine
This is Rietveld 408576698