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 ds "github.com/luci/gae/service/datastore" | 11 ds "github.com/luci/gae/service/datastore" |
12 "golang.org/x/net/context" | 12 "golang.org/x/net/context" |
13 ) | 13 ) |
14 | 14 |
15 var serializationDeterministic = false | |
dnj
2015/08/28 16:37:54
:D
iannucci
2015/08/28 19:48:55
Yep, just for tests. This doesn't affect anything
| |
16 | |
15 type memContextObj interface { | 17 type memContextObj interface { |
16 sync.Locker | 18 sync.Locker |
17 canApplyTxn(m memContextObj) bool | 19 canApplyTxn(m memContextObj) bool |
18 applyTxn(c context.Context, m memContextObj) | 20 applyTxn(c context.Context, m memContextObj) |
19 | 21 |
20 endTxn() | 22 endTxn() |
21 mkTxn(*ds.TransactionOptions) memContextObj | 23 mkTxn(*ds.TransactionOptions) memContextObj |
22 } | 24 } |
23 | 25 |
24 type memContext []memContextObj | 26 type memContext []memContextObj |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 txnMC.Lock() | 153 txnMC.Lock() |
152 defer txnMC.Unlock() | 154 defer txnMC.Unlock() |
153 | 155 |
154 if curMC.canApplyTxn(txnMC) { | 156 if curMC.canApplyTxn(txnMC) { |
155 curMC.applyTxn(d.c, txnMC) | 157 curMC.applyTxn(d.c, txnMC) |
156 } else { | 158 } else { |
157 return ds.ErrConcurrentTransaction | 159 return ds.ErrConcurrentTransaction |
158 } | 160 } |
159 return nil | 161 return nil |
160 } | 162 } |
OLD | NEW |