| OLD | NEW |
| 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 "net/http" | 8 "net/http" |
| 9 | 9 |
| 10 "github.com/luci/gae/service/info" | 10 "github.com/luci/gae/service/info" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 if deadline, ok := c.Deadline(); ok { | 44 if deadline, ok := c.Deadline(); ok { |
| 45 aeCtx, _ = context.WithDeadline(aeCtx, deadline) | 45 aeCtx, _ = context.WithDeadline(aeCtx, deadline) |
| 46 } | 46 } |
| 47 return aeCtx | 47 return aeCtx |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Use adds production implementations for all the gae services to the | 50 // Use adds production implementations for all the gae services to the |
| 51 // context. | 51 // context. |
| 52 // | 52 // |
| 53 // The services added are: | 53 // The services added are: |
| 54 // - github.com/luci-go/common/logging |
| 54 // - github.com/luci/gae/service/datastore | 55 // - github.com/luci/gae/service/datastore |
| 56 // - github.com/luci/gae/service/info |
| 57 // - github.com/luci/gae/service/mail |
| 58 // - github.com/luci/gae/service/memcache |
| 55 // - github.com/luci/gae/service/taskqueue | 59 // - github.com/luci/gae/service/taskqueue |
| 56 // - github.com/luci/gae/service/memcache | |
| 57 // - github.com/luci/gae/service/info | |
| 58 // - github.com/luci/gae/service/urlfetch | 60 // - github.com/luci/gae/service/urlfetch |
| 59 // - github.com/luci/gae/service/user | 61 // - github.com/luci/gae/service/user |
| 60 // - github.com/luci-go/common/logging | |
| 61 // | 62 // |
| 62 // These can be retrieved with the <service>.Get functions. | 63 // These can be retrieved with the <service>.Get functions. |
| 63 // | 64 // |
| 64 // The implementations are all backed by the real appengine SDK functionality, | 65 // The implementations are all backed by the real appengine SDK functionality, |
| 65 func Use(c context.Context, r *http.Request) context.Context { | 66 func Use(c context.Context, r *http.Request) context.Context { |
| 66 aeCtx := appengine.NewContext(r) | 67 aeCtx := appengine.NewContext(r) |
| 67 c = context.WithValue(c, prodContextKey, aeCtx) | 68 c = context.WithValue(c, prodContextKey, aeCtx) |
| 68 c = context.WithValue(c, prodContextNoTxnKey, aeCtx) | 69 c = context.WithValue(c, prodContextNoTxnKey, aeCtx) |
| 69 » return useUser(useURLFetch(useRDS(useMC(useTQ(useGI(useLogging(c))))))) | 70 » return useMail(useUser(useURLFetch(useRDS(useMC(useTQ(useGI(useLogging(c
)))))))) |
| 70 } | 71 } |
| OLD | NEW |