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

Unified Diff: filter/dscache/context.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Lightning talk licenses. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « filter/dsQueryBatch/filter_test.go ('k') | filter/dscache/ds.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: filter/dscache/context.go
diff --git a/filter/dscache/context.go b/filter/dscache/context.go
index 8d2ae3b9a7f7dbdf1e85fff04c2328bf40b5996b..245c81e789783a57a044fcdb4e6ca32d03e20daf 100644
--- a/filter/dscache/context.go
+++ b/filter/dscache/context.go
@@ -6,9 +6,9 @@ package dscache
import (
ds "github.com/luci/gae/service/datastore"
- "github.com/luci/gae/service/info"
- mc "github.com/luci/gae/service/memcache"
+
"github.com/luci/luci-go/common/data/rand/mathrand"
+
"golang.org/x/net/context"
)
@@ -44,23 +44,21 @@ func FilterRDS(c context.Context, shardsForKey func(*ds.Key) int) context.Contex
// Unlike FilterRDS it doesn't check GlobalConfig via IsGloballyEnabled call,
// assuming caller already knows whether filter should be applied or not.
func AlwaysFilterRDS(c context.Context, shardsForKey func(*ds.Key) int) context.Context {
- return ds.AddRawFilters(c, func(c context.Context, ds ds.RawInterface) ds.RawInterface {
- i := info.Get(c)
- ns, _ := i.GetNamespace()
+ return ds.AddRawFilters(c, func(c context.Context, rds ds.RawInterface) ds.RawInterface {
+ kc := ds.GetKeyContext(c)
sc := &supportContext{
- i.AppID(),
- ns,
+ kc.AppID,
+ kc.Namespace,
c,
- mc.Get(c),
mathrand.Get(c),
shardsForKey,
}
v := c.Value(dsTxnCacheKey)
if v == nil {
- return &dsCache{ds, sc}
+ return &dsCache{rds, sc}
}
- return &dsTxnCache{ds, v.(*dsTxnState), sc}
+ return &dsTxnCache{rds, v.(*dsTxnState), sc}
})
}
« no previous file with comments | « filter/dsQueryBatch/filter_test.go ('k') | filter/dscache/ds.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698