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

Side by Side Diff: filter/txnBuf/context.go

Issue 1309803004: Add transaction buffer filter. (Closed) Base URL: https://github.com/luci/gae.git@add_query_support
Patch Set: one more test Created 5 years, 2 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
« no previous file with comments | « no previous file | filter/txnBuf/doc.go » ('j') | filter/txnBuf/ds_txn.go » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package txnBuf
6
7 import (
8 "golang.org/x/net/context"
9
10 ds "github.com/luci/gae/service/datastore"
11 "github.com/luci/gae/service/info"
12 )
13
14 type key int
15
16 var (
17 dsTxnBufParent key
18 )
19
20 // FilterRDS installs a counter datastore filter in the context.
21 func FilterRDS(c context.Context) context.Context {
22 // TODO(riannucci): allow the specification of the set of roots to limit this
23 // transaction to, transitively.
24 return ds.AddRawFilters(c, func(c context.Context, RawDatastore ds.RawIn terface) ds.RawInterface {
Vadim Sh. 2015/09/28 18:52:56 rawDatastore I was very confused trying to figure
iannucci 2015/09/29 03:21:37 derp. Done.
25 if par, _ := c.Value(dsTxnBufParent).(*txnBufState); par != nil {
26 return &dsTxnBuf{RawDatastore, c, par}
27 }
28 return &dsBuf{RawDatastore, info.Get(c).GetNamespace()}
29 })
30 }
31
32 // impossible is a marker function to indicate that the given error is an
33 // impossible state, due to conditions outside of the function.
34 func impossible(err error) {
35 if err != nil {
36 panic(err)
37 }
38 }
39
40 // memoryCorruption is a marker function to indicate that given error is
41 // actually due to corrupted memory to make it easier to read the code.
42 func memoryCorruption(err error) {
43 if err != nil {
44 panic(err)
45 }
46 }
OLDNEW
« no previous file with comments | « no previous file | filter/txnBuf/doc.go » ('j') | filter/txnBuf/ds_txn.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698