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

Side by Side Diff: go/src/infra/gae/libs/gae/memory/globalinfo.go

Issue 1234343006: Some miscellaneous fixes: (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 5 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 "golang.org/x/net/context" 8 "golang.org/x/net/context"
9 9
10 "infra/gae/libs/gae" 10 "infra/gae/libs/gae"
(...skipping 15 matching lines...) Expand all
26 return &giImpl{dummy.GI(), curGID(ic), ic} 26 return &giImpl{dummy.GI(), curGID(ic), ic}
27 }) 27 })
28 } 28 }
29 29
30 // globalAppID is the 'AppID' of everythin returned from this memory 30 // globalAppID is the 'AppID' of everythin returned from this memory
31 // implementation (DSKeys, GlobalInfo, etc.). There's no way to modify this 31 // implementation (DSKeys, GlobalInfo, etc.). There's no way to modify this
32 // value through the API, and there are a couple bits of code where it's hard to 32 // value through the API, and there are a couple bits of code where it's hard to
33 // route this value through to without making the internal APIs really complex. 33 // route this value through to without making the internal APIs really complex.
34 const globalAppID = "dev~app" 34 const globalAppID = "dev~app"
35 35
36 type globalInfoData struct{ namespace string } 36 type globalInfoData struct {
37 » gae.BrokenFeatures
38
39 » namespace string
40 }
37 41
38 type giImpl struct { 42 type giImpl struct {
39 gae.GlobalInfo 43 gae.GlobalInfo
40 » data *globalInfoData 44 » *globalInfoData
41 » c context.Context 45 » c context.Context
42 } 46 }
43 47
44 var _ = gae.GlobalInfo((*giImpl)(nil)) 48 var _ = gae.GlobalInfo((*giImpl)(nil))
45 49
46 func (gi *giImpl) Namespace(ns string) (context.Context, error) { 50 func (gi *giImpl) Namespace(ns string) (ret context.Context, err error) {
47 » return context.WithValue(gi.c, giContextKey, &globalInfoData{ns}), nil 51 » err = gi.RunIfNotBroken(func() error {
52 » » ret = context.WithValue(gi.c, giContextKey, &globalInfoData{
53 » » » curGID(gi.c).BrokenFeatures,
54 » » » ns,
55 » » })
56 » » return nil
57 » })
58 » return
48 } 59 }
49 60
50 func (gi *giImpl) AppID() string { 61 func (gi *giImpl) AppID() string {
51 return globalAppID 62 return globalAppID
52 } 63 }
OLDNEW
« no previous file with comments | « go/src/infra/gae/libs/gae/memory/context.go ('k') | go/src/infra/gae/libs/gae/memory/taskqueue_data.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698