Chromium Code Reviews| Index: filter/txnBuf/context.go |
| diff --git a/filter/txnBuf/context.go b/filter/txnBuf/context.go |
| index b044328820e4a32b1c987f72c0e554b63831e732..47f1471d946539f6ff712b8da37c93227fe66c1c 100644 |
| --- a/filter/txnBuf/context.go |
| +++ b/filter/txnBuf/context.go |
| @@ -45,3 +45,17 @@ func memoryCorruption(err error) { |
| panic(err) |
| } |
| } |
| + |
| +// GetNoTxn allows you to to escape the buffered transaction (if any), and get |
| +// a non-transactional handle to the datastore. This does not invalidate the |
| +// currently buffered transaction, but it also does not see any effects of it. |
|
dnj (Google)
2016/06/02 04:10:27
nit: "currently-buffered"
iannucci
2016/06/02 22:32:21
Done.
|
| +// |
| +// TODO(iannucci): This is messy, but mostly because the way that transactions |
| +// work is messy. Fixing luci/gae#issues/23 would help though, because it means |
| +// we could make transactionality recorded by a single index in the context |
| +// instead of relying on function nesting. |
| +func GetNoTxn(c context.Context) ds.Interface { |
| + c = context.WithValue(c, dsTxnBufParent, nil) |
| + c = context.WithValue(c, dsTxnBufHaveLock, nil) |
|
dnj (Google)
2016/06/02 04:10:27
Havelock? http://expanse.wikia.com/wiki/Dmitri_Hav
|
| + return ds.GetNoTxn(c) |
| +} |