| 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 memory | 5 package memory |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "errors" | 8 "errors" |
| 9 "sync" | 9 "sync" |
| 10 | 10 |
| 11 » rds "github.com/luci/gae/service/rawdatastore" | 11 » rds "github.com/luci/gae/service/datastore" |
| 12 "golang.org/x/net/context" | 12 "golang.org/x/net/context" |
| 13 ) | 13 ) |
| 14 | 14 |
| 15 type memContextObj interface { | 15 type memContextObj interface { |
| 16 sync.Locker | 16 sync.Locker |
| 17 canApplyTxn(m memContextObj) bool | 17 canApplyTxn(m memContextObj) bool |
| 18 applyTxn(c context.Context, m memContextObj) | 18 applyTxn(c context.Context, m memContextObj) |
| 19 | 19 |
| 20 endTxn() | 20 endTxn() |
| 21 mkTxn(*rds.TransactionOptions) memContextObj | 21 mkTxn(*rds.TransactionOptions) memContextObj |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 txnMC.Lock() | 151 txnMC.Lock() |
| 152 defer txnMC.Unlock() | 152 defer txnMC.Unlock() |
| 153 | 153 |
| 154 if curMC.canApplyTxn(txnMC) { | 154 if curMC.canApplyTxn(txnMC) { |
| 155 curMC.applyTxn(d.c, txnMC) | 155 curMC.applyTxn(d.c, txnMC) |
| 156 } else { | 156 } else { |
| 157 return rds.ErrConcurrentTransaction | 157 return rds.ErrConcurrentTransaction |
| 158 } | 158 } |
| 159 return nil | 159 return nil |
| 160 } | 160 } |
| OLD | NEW |