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

Side by Side Diff: impl/prod/info.go

Issue 1871943003: Add Info Testable interface, implement for memory. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Fall through in filter. 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 | « impl/memory/info_test.go ('k') | service/info/interface.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 prod 5 package prod
6 6
7 import ( 7 import (
8 "time" 8 "time"
9 9
10 "github.com/luci/gae/service/info" 10 "github.com/luci/gae/service/info"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 func (g giImpl) ServiceAccount() (string, error) { 104 func (g giImpl) ServiceAccount() (string, error) {
105 return appengine.ServiceAccount(g.aeCtx) 105 return appengine.ServiceAccount(g.aeCtx)
106 } 106 }
107 func (g giImpl) SignBytes(bytes []byte) (keyName string, signature []byte, err e rror) { 107 func (g giImpl) SignBytes(bytes []byte) (keyName string, signature []byte, err e rror) {
108 return appengine.SignBytes(g.aeCtx, bytes) 108 return appengine.SignBytes(g.aeCtx, bytes)
109 } 109 }
110 func (g giImpl) VersionID() string { 110 func (g giImpl) VersionID() string {
111 return appengine.VersionID(g.aeCtx) 111 return appengine.VersionID(g.aeCtx)
112 } 112 }
113 113
114 func (g giImpl) Testable() info.Testable {
115 return nil
116 }
117
114 type infoProbeCache struct { 118 type infoProbeCache struct {
115 namespace string 119 namespace string
116 fqaid string 120 fqaid string
117 } 121 }
118 122
119 func probe(aeCtx context.Context) *infoProbeCache { 123 func probe(aeCtx context.Context) *infoProbeCache {
120 probeKey := datastore.NewKey(aeCtx, "Kind", "id", 0, nil) 124 probeKey := datastore.NewKey(aeCtx, "Kind", "id", 0, nil)
121 return &infoProbeCache{ 125 return &infoProbeCache{
122 namespace: probeKey.Namespace(), 126 namespace: probeKey.Namespace(),
123 fqaid: probeKey.AppID(), 127 fqaid: probeKey.AppID(),
124 } 128 }
125 } 129 }
126 130
127 func getProbeCache(c context.Context) *infoProbeCache { 131 func getProbeCache(c context.Context) *infoProbeCache {
128 if pc, ok := c.Value(probeCacheKey).(*infoProbeCache); ok { 132 if pc, ok := c.Value(probeCacheKey).(*infoProbeCache); ok {
129 return pc 133 return pc
130 } 134 }
131 return nil 135 return nil
132 } 136 }
133 137
134 func withProbeCache(c context.Context, pc *infoProbeCache) context.Context { 138 func withProbeCache(c context.Context, pc *infoProbeCache) context.Context {
135 return context.WithValue(c, probeCacheKey, pc) 139 return context.WithValue(c, probeCacheKey, pc)
136 } 140 }
OLDNEW
« no previous file with comments | « impl/memory/info_test.go ('k') | service/info/interface.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698