Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package cloud | 5 package cloud |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "github.com/luci/gae/impl/dummy" | 8 "github.com/luci/gae/impl/dummy" |
| 9 ds "github.com/luci/gae/service/datastore" | 9 ds "github.com/luci/gae/service/datastore" |
| 10 "github.com/luci/gae/service/mail" | 10 "github.com/luci/gae/service/mail" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 // Dummy services that we don't support. | 44 // Dummy services that we don't support. |
| 45 c = mail.Set(c, dummy.Mail()) | 45 c = mail.Set(c, dummy.Mail()) |
| 46 c = module.Set(c, dummy.Module()) | 46 c = module.Set(c, dummy.Module()) |
| 47 c = taskqueue.SetRaw(c, dummy.TaskQueue()) | 47 c = taskqueue.SetRaw(c, dummy.TaskQueue()) |
| 48 c = user.Set(c, dummy.User()) | 48 c = user.Set(c, dummy.User()) |
| 49 | 49 |
| 50 c = useInfo(c) | 50 c = useInfo(c) |
| 51 | 51 |
| 52 // datastore service | 52 // datastore service |
| 53 if cfg.DS != nil { | 53 if cfg.DS != nil { |
| 54 cds := cloudDatastore{ | 54 cds := cloudDatastore{ |
|
nodir
2017/04/05 22:10:51
use UseWithDatastore here
hinoka
2017/04/06 17:46:03
Done.
| |
| 55 client: cfg.DS, | 55 client: cfg.DS, |
| 56 } | 56 } |
| 57 c = cds.use(c) | 57 c = cds.use(c) |
| 58 } else { | 58 } else { |
| 59 c = ds.SetRaw(c, dummy.Datastore()) | 59 c = ds.SetRaw(c, dummy.Datastore()) |
| 60 } | 60 } |
| 61 | 61 |
| 62 // memcache service | 62 // memcache service |
| 63 if cfg.MC != nil { | 63 if cfg.MC != nil { |
| 64 mc := memcacheClient{ | 64 mc := memcacheClient{ |
| 65 client: cfg.MC, | 65 client: cfg.MC, |
| 66 } | 66 } |
| 67 c = mc.use(c) | 67 c = mc.use(c) |
| 68 } else { | 68 } else { |
| 69 c = mc.SetRaw(c, dummy.Memcache()) | 69 c = mc.SetRaw(c, dummy.Memcache()) |
| 70 } | 70 } |
| 71 | 71 |
| 72 return c | 72 return c |
| 73 } | 73 } |
| 74 | |
| 75 // UseWithDatastore just install a datastore implementation into the context. | |
|
nodir
2017/04/05 22:10:51
UseDatastore installs a cloud datastore implementa
hinoka
2017/04/06 17:46:03
Done.
| |
| 76 func UseWithDatastore(c context.Context, client *datastore.Client) context.Conte xt { | |
|
nodir
2017/04/05 22:10:51
two verbs? I think it should be either UseDatastor
hinoka
2017/04/06 17:46:03
Done.
| |
| 77 cds := cloudDatastore{ | |
| 78 client: client, | |
| 79 } | |
| 80 return cds.use(c) | |
| 81 } | |
| OLD | NEW |