Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: impl/memory/context.go

Issue 1259593005: Add 'user friendly' datastore API. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: 100% coverage of new code Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698