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

Unified Diff: service/datastore/checkfilter.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: service/datastore/checkfilter.go
diff --git a/service/datastore/checkfilter.go b/service/datastore/checkfilter.go
index ff4fbb7d68898d76adcd2d4cc430f33efd07b8c7..6018a60a3dd0d9956ec31c13120b25fde16d3a1c 100644
--- a/service/datastore/checkfilter.go
+++ b/service/datastore/checkfilter.go
@@ -19,6 +19,16 @@ type checkFilter struct {
ns string
}
+func (tcf *checkFilter) AllocateIDs(incomplete *Key, n int) (start int64, err error) {
+ if n <= 0 {
+ return 0, fmt.Errorf("datastore: invalid `n` parameter in AllocateIDs: %d", n)
+ }
+ if !incomplete.PartialValid(tcf.aid, tcf.ns) {
+ return 0, ErrInvalidKey
+ }
+ return tcf.RawInterface.AllocateIDs(incomplete, n)
+}
+
func (tcf *checkFilter) RunInTransaction(f func(c context.Context) error, opts *TransactionOptions) error {
if f == nil {
return fmt.Errorf("datastore: RunInTransaction function is nil")

Powered by Google App Engine
This is Rietveld 408576698