| OLD | NEW |
| 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 dscache | 5 package dscache |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "time" | 8 "time" |
| 9 | 9 |
| 10 ds "github.com/luci/gae/service/datastore" | 10 ds "github.com/luci/gae/service/datastore" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 var _ ds.RawInterface = (*dsCache)(nil) | 23 var _ ds.RawInterface = (*dsCache)(nil) |
| 24 | 24 |
| 25 func (d *dsCache) DeleteMulti(keys []*ds.Key, cb ds.DeleteMultiCB) error { | 25 func (d *dsCache) DeleteMulti(keys []*ds.Key, cb ds.DeleteMultiCB) error { |
| 26 return d.mutation(keys, func() error { | 26 return d.mutation(keys, func() error { |
| 27 return d.RawInterface.DeleteMulti(keys, cb) | 27 return d.RawInterface.DeleteMulti(keys, cb) |
| 28 }) | 28 }) |
| 29 } | 29 } |
| 30 | 30 |
| 31 func (d *dsCache) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMulti
CB) error { | 31 func (d *dsCache) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.NewKeyCB
) error { |
| 32 return d.mutation(keys, func() error { | 32 return d.mutation(keys, func() error { |
| 33 return d.RawInterface.PutMulti(keys, vals, cb) | 33 return d.RawInterface.PutMulti(keys, vals, cb) |
| 34 }) | 34 }) |
| 35 } | 35 } |
| 36 | 36 |
| 37 func (d *dsCache) GetMulti(keys []*ds.Key, metas ds.MultiMetaGetter, cb ds.GetMu
ltiCB) error { | 37 func (d *dsCache) GetMulti(keys []*ds.Key, metas ds.MultiMetaGetter, cb ds.GetMu
ltiCB) error { |
| 38 lockItems, nonce := d.mkRandLockItems(keys, metas) | 38 lockItems, nonce := d.mkRandLockItems(keys, metas) |
| 39 if len(lockItems) == 0 { | 39 if len(lockItems) == 0 { |
| 40 return d.RawInterface.GetMulti(keys, metas, cb) | 40 return d.RawInterface.GetMulti(keys, metas, cb) |
| 41 } | 41 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if err == nil { | 135 if err == nil { |
| 136 err = txnState.apply(d.supportContext) | 136 err = txnState.apply(d.supportContext) |
| 137 } | 137 } |
| 138 return err | 138 return err |
| 139 }, opts) | 139 }, opts) |
| 140 if err == nil { | 140 if err == nil { |
| 141 txnState.release(d.supportContext) | 141 txnState.release(d.supportContext) |
| 142 } | 142 } |
| 143 return err | 143 return err |
| 144 } | 144 } |
| OLD | NEW |