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

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

Issue 1243323002: Refactor a bit. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix golint 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
« no previous file with comments | « impl/prod/doc.go ('k') | impl/prod/memcache.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" 10 » "github.com/luci/gae/service/info"
11 "golang.org/x/net/context" 11 "golang.org/x/net/context"
12 "google.golang.org/appengine" 12 "google.golang.org/appengine"
13 ) 13 )
14 14
15 // useGI adds a gae.GlobalInfo implementation to context, accessible 15 // useGI adds a gae.GlobalInfo implementation to context, accessible
16 // by gae.GetGI(c) 16 // by gae.GetGI(c)
17 func useGI(c context.Context) context.Context { 17 func useGI(c context.Context) context.Context {
18 » return gae.SetGIFactory(c, func(ci context.Context) gae.GlobalInfo { 18 » return info.SetFactory(c, func(ci context.Context) info.Interface {
19 return giImpl{ci} 19 return giImpl{ci}
20 }) 20 })
21 } 21 }
22 22
23 type giImpl struct{ context.Context } 23 type giImpl struct{ context.Context }
24 24
25 func (g giImpl) AccessToken(scopes ...string) (token string, expiry time.Time, e rr error) { 25 func (g giImpl) AccessToken(scopes ...string) (token string, expiry time.Time, e rr error) {
26 return appengine.AccessToken(g, scopes...) 26 return appengine.AccessToken(g, scopes...)
27 } 27 }
28 func (g giImpl) AppID() string { 28 func (g giImpl) AppID() string {
(...skipping 19 matching lines...) Expand all
48 } 48 }
49 func (g giImpl) ModuleHostname(module, version, instance string) (string, error) { 49 func (g giImpl) ModuleHostname(module, version, instance string) (string, error) {
50 return appengine.ModuleHostname(g, module, version, instance) 50 return appengine.ModuleHostname(g, module, version, instance)
51 } 51 }
52 func (g giImpl) ModuleName() (name string) { 52 func (g giImpl) ModuleName() (name string) {
53 return appengine.ModuleName(g) 53 return appengine.ModuleName(g)
54 } 54 }
55 func (g giImpl) Namespace(namespace string) (context.Context, error) { 55 func (g giImpl) Namespace(namespace string) (context.Context, error) {
56 return appengine.Namespace(g, namespace) 56 return appengine.Namespace(g, namespace)
57 } 57 }
58 func (g giImpl) PublicCertificates() ([]gae.GICertificate, error) { 58 func (g giImpl) PublicCertificates() ([]info.Certificate, error) {
59 certs, err := appengine.PublicCertificates(g) 59 certs, err := appengine.PublicCertificates(g)
60 if err != nil { 60 if err != nil {
61 return nil, err 61 return nil, err
62 } 62 }
63 » ret := make([]gae.GICertificate, len(certs)) 63 » ret := make([]info.Certificate, len(certs))
64 for i, c := range certs { 64 for i, c := range certs {
65 » » ret[i] = (gae.GICertificate)(c) 65 » » ret[i] = info.Certificate(c)
66 } 66 }
67 return ret, nil 67 return ret, nil
68 } 68 }
69 func (g giImpl) RequestID() string { 69 func (g giImpl) RequestID() string {
70 return appengine.RequestID(g) 70 return appengine.RequestID(g)
71 } 71 }
72 func (g giImpl) ServerSoftware() string { 72 func (g giImpl) ServerSoftware() string {
73 return appengine.ServerSoftware() 73 return appengine.ServerSoftware()
74 } 74 }
75 func (g giImpl) ServiceAccount() (string, error) { 75 func (g giImpl) ServiceAccount() (string, error) {
76 return appengine.ServiceAccount(g) 76 return appengine.ServiceAccount(g)
77 } 77 }
78 func (g giImpl) SignBytes(bytes []byte) (keyName string, signature []byte, err e rror) { 78 func (g giImpl) SignBytes(bytes []byte) (keyName string, signature []byte, err e rror) {
79 return appengine.SignBytes(g, bytes) 79 return appengine.SignBytes(g, bytes)
80 } 80 }
81 func (g giImpl) VersionID() string { 81 func (g giImpl) VersionID() string {
82 return appengine.VersionID(g) 82 return appengine.VersionID(g)
83 } 83 }
OLDNEW
« no previous file with comments | « impl/prod/doc.go ('k') | impl/prod/memcache.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698