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

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

Issue 1916463004: impl/memory: Disallow empty namespace. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Rbase. Created 4 years, 8 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 | « filter/count/gi.go ('k') | filter/txnBuf/state.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 dscache 5 package dscache
6 6
7 import ( 7 import (
8 ds "github.com/luci/gae/service/datastore" 8 ds "github.com/luci/gae/service/datastore"
9 "github.com/luci/gae/service/info" 9 "github.com/luci/gae/service/info"
10 mc "github.com/luci/gae/service/memcache" 10 mc "github.com/luci/gae/service/memcache"
(...skipping 28 matching lines...) Expand all
39 return AlwaysFilterRDS(c, shardsForKey) 39 return AlwaysFilterRDS(c, shardsForKey)
40 } 40 }
41 41
42 // AlwaysFilterRDS installs a caching RawDatastore filter in the context. 42 // AlwaysFilterRDS installs a caching RawDatastore filter in the context.
43 // 43 //
44 // Unlike FilterRDS it doesn't check GlobalConfig via IsGloballyEnabled call, 44 // Unlike FilterRDS it doesn't check GlobalConfig via IsGloballyEnabled call,
45 // assuming caller already knows whether filter should be applied or not. 45 // assuming caller already knows whether filter should be applied or not.
46 func AlwaysFilterRDS(c context.Context, shardsForKey func(*ds.Key) int) context. Context { 46 func AlwaysFilterRDS(c context.Context, shardsForKey func(*ds.Key) int) context. Context {
47 return ds.AddRawFilters(c, func(c context.Context, ds ds.RawInterface) d s.RawInterface { 47 return ds.AddRawFilters(c, func(c context.Context, ds ds.RawInterface) d s.RawInterface {
48 i := info.Get(c) 48 i := info.Get(c)
49 ns, _ := i.GetNamespace()
49 50
50 sc := &supportContext{ 51 sc := &supportContext{
51 i.AppID(), 52 i.AppID(),
52 » » » i.GetNamespace(), 53 » » » ns,
53 c, 54 c,
54 mc.Get(c), 55 mc.Get(c),
55 mathrand.Get(c), 56 mathrand.Get(c),
56 shardsForKey, 57 shardsForKey,
57 } 58 }
58 59
59 v := c.Value(dsTxnCacheKey) 60 v := c.Value(dsTxnCacheKey)
60 if v == nil { 61 if v == nil {
61 return &dsCache{ds, sc} 62 return &dsCache{ds, sc}
62 } 63 }
63 return &dsTxnCache{ds, v.(*dsTxnState), sc} 64 return &dsTxnCache{ds, v.(*dsTxnState), sc}
64 }) 65 })
65 } 66 }
OLDNEW
« no previous file with comments | « filter/count/gi.go ('k') | filter/txnBuf/state.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698