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

Side by Side Diff: filter/count/rds.go

Issue 2007123002: datastore: Update AllocateIDs to take keys. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Add empty arg/key short-circuits for other varidic methods. 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 | « no previous file | filter/featureBreaker/rds.go » ('j') | impl/memory/datastore_data.go » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 count 5 package count
6 6
7 import ( 7 import (
8 "golang.org/x/net/context" 8 "golang.org/x/net/context"
9 9
10 ds "github.com/luci/gae/service/datastore" 10 ds "github.com/luci/gae/service/datastore"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 type dsCounter struct { 25 type dsCounter struct {
26 c *DSCounter 26 c *DSCounter
27 27
28 ds ds.RawInterface 28 ds ds.RawInterface
29 } 29 }
30 30
31 var _ ds.RawInterface = (*dsCounter)(nil) 31 var _ ds.RawInterface = (*dsCounter)(nil)
32 32
33 func (r *dsCounter) AllocateIDs(incomplete *ds.Key, n int) (int64, error) { 33 func (r *dsCounter) AllocateIDs(keys []*ds.Key, cb ds.PutMultiCB) error {
34 » start, err := r.ds.AllocateIDs(incomplete, n) 34 » return r.c.AllocateIDs.up(r.ds.AllocateIDs(keys, cb))
35 » return start, r.c.AllocateIDs.up(err)
36 } 35 }
37 36
38 func (r *dsCounter) DecodeCursor(s string) (ds.Cursor, error) { 37 func (r *dsCounter) DecodeCursor(s string) (ds.Cursor, error) {
39 cursor, err := r.ds.DecodeCursor(s) 38 cursor, err := r.ds.DecodeCursor(s)
40 return cursor, r.c.DecodeCursor.up(err) 39 return cursor, r.c.DecodeCursor.up(err)
41 } 40 }
42 41
43 func (r *dsCounter) Run(q *ds.FinalizedQuery, cb ds.RawRunCB) error { 42 func (r *dsCounter) Run(q *ds.FinalizedQuery, cb ds.RawRunCB) error {
44 return r.c.Run.upFilterStop(r.ds.Run(q, cb)) 43 return r.c.Run.upFilterStop(r.ds.Run(q, cb))
45 } 44 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // datastore.Stop will pass through this function, but, unlike other error 80 // datastore.Stop will pass through this function, but, unlike other error
82 // codes, will be counted as a success. 81 // codes, will be counted as a success.
83 func (e *Entry) upFilterStop(err error) error { 82 func (e *Entry) upFilterStop(err error) error {
84 upErr := err 83 upErr := err
85 if upErr == ds.Stop { 84 if upErr == ds.Stop {
86 upErr = nil 85 upErr = nil
87 } 86 }
88 e.up(upErr) 87 e.up(upErr)
89 return err 88 return err
90 } 89 }
OLDNEW
« no previous file with comments | « no previous file | filter/featureBreaker/rds.go » ('j') | impl/memory/datastore_data.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698