| OLD | NEW |
| 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 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 Loading... |
| 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.PutMultiCB) 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.PutMult
iCB) 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 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |