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

Unified Diff: impl/memory/datastore.go

Issue 1929423002: filter/txnBuf: Use fully-qualified App ID. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Use public methods for defining Info service in tests. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/memory/context.go ('k') | impl/memory/datastore_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/datastore.go
diff --git a/impl/memory/datastore.go b/impl/memory/datastore.go
index 8337626889763d8cdcbfc32b629da7960f70a55e..46c32e9864a55063d5b04555b2b4ac1e47c379c2 100644
--- a/impl/memory/datastore.go
+++ b/impl/memory/datastore.go
@@ -52,23 +52,22 @@ func useRDS(c context.Context) context.Context {
// * DisableSpecialEntities(true)
//
// These settings can of course be changed by using the Testable() interface.
-func NewDatastore(aid, ns string) (ds.Interface, error) {
- ctx := UseWithAppID(context.Background(), aid)
-
- if ns != "" {
- var err error
- ctx, err = info.Get(ctx).Namespace(ns)
- if err != nil {
- return nil, err
- }
- }
+func NewDatastore(inf info.Interface) ds.Interface {
+ fqAppID := inf.FullyQualifiedAppID()
+ ns, hasNS := inf.GetNamespace()
+
+ memctx := newMemContext(fqAppID)
- ret := ds.Get(ctx)
+ dsCtx := info.Set(context.Background(), inf)
+ rds := &dsImpl{memctx.Get(memContextDSIdx).(*dataStoreData), ns, hasNS, dsCtx}
+
+ ret := ds.Get(ds.SetRaw(dsCtx, rds))
t := ret.Testable()
t.AutoIndex(true)
t.Consistent(true)
t.DisableSpecialEntities(true)
- return ret, nil
+
+ return ret
}
//////////////////////////////////// dsImpl ////////////////////////////////////
« no previous file with comments | « impl/memory/context.go ('k') | impl/memory/datastore_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698