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

Side by Side Diff: filter/txnBuf/ds_txn.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 | « filter/featureBreaker/rds.go ('k') | filter/txnBuf/state.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 txnBuf 5 package txnBuf
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/luci-go/common/errors" 9 "github.com/luci/luci-go/common/errors"
10 "golang.org/x/net/context" 10 "golang.org/x/net/context"
(...skipping 14 matching lines...) Expand all
25 state *txnBufState 25 state *txnBufState
26 haveLock bool 26 haveLock bool
27 } 27 }
28 28
29 var _ ds.RawInterface = (*dsTxnBuf)(nil) 29 var _ ds.RawInterface = (*dsTxnBuf)(nil)
30 30
31 func (d *dsTxnBuf) DecodeCursor(s string) (ds.Cursor, error) { 31 func (d *dsTxnBuf) DecodeCursor(s string) (ds.Cursor, error) {
32 return d.state.parentDS.DecodeCursor(s) 32 return d.state.parentDS.DecodeCursor(s)
33 } 33 }
34 34
35 func (d *dsTxnBuf) AllocateIDs(incomplete *ds.Key, n int) (start int64, err erro r) { 35 func (d *dsTxnBuf) AllocateIDs(keys []*ds.Key, cb ds.NewKeyCB) error {
36 » return d.state.parentDS.AllocateIDs(incomplete, n) 36 » return d.state.parentDS.AllocateIDs(keys, cb)
37 } 37 }
38 38
39 func (d *dsTxnBuf) GetMulti(keys []*ds.Key, metas ds.MultiMetaGetter, cb ds.GetM ultiCB) error { 39 func (d *dsTxnBuf) GetMulti(keys []*ds.Key, metas ds.MultiMetaGetter, cb ds.GetM ultiCB) error {
40 return d.state.getMulti(keys, metas, cb, d.haveLock) 40 return d.state.getMulti(keys, metas, cb, d.haveLock)
41 } 41 }
42 42
43 func (d *dsTxnBuf) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMult iCB) error { 43 func (d *dsTxnBuf) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.NewKeyC B) error {
44 return d.state.putMulti(keys, vals, cb, d.haveLock) 44 return d.state.putMulti(keys, vals, cb, d.haveLock)
45 } 45 }
46 46
47 func (d *dsTxnBuf) DeleteMulti(keys []*ds.Key, cb ds.DeleteMultiCB) error { 47 func (d *dsTxnBuf) DeleteMulti(keys []*ds.Key, cb ds.DeleteMultiCB) error {
48 return d.state.deleteMulti(keys, cb, d.haveLock) 48 return d.state.deleteMulti(keys, cb, d.haveLock)
49 } 49 }
50 50
51 func (d *dsTxnBuf) Count(fq *ds.FinalizedQuery) (count int64, err error) { 51 func (d *dsTxnBuf) Count(fq *ds.FinalizedQuery) (count int64, err error) {
52 // Unfortunately there's no fast-path here. We literally have to run the 52 // Unfortunately there's no fast-path here. We literally have to run the
53 // query and count. Fortunately we can optimize to count keys if it's no t 53 // query and count. Fortunately we can optimize to count keys if it's no t
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if !d.haveLock { 112 if !d.haveLock {
113 d.state.Lock() 113 d.state.Lock()
114 defer d.state.Unlock() 114 defer d.state.Unlock()
115 } 115 }
116 return withTxnBuf(d.ic, cb, opts) 116 return withTxnBuf(d.ic, cb, opts)
117 } 117 }
118 118
119 func (d *dsTxnBuf) Testable() ds.Testable { 119 func (d *dsTxnBuf) Testable() ds.Testable {
120 return d.state.parentDS.Testable() 120 return d.state.parentDS.Testable()
121 } 121 }
OLDNEW
« no previous file with comments | « filter/featureBreaker/rds.go ('k') | filter/txnBuf/state.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698