OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 // Package wrapper provides a fakable wrapped interface for the appengine SDK's | |
6 // APIs. This means that it's possible to mock all of the supported appengine | |
7 // APIs for testing (or potentially implement a different backend for them, | |
8 // though you would still need to provide enough of the appengine SDK for a | |
9 // few key types). | |
10 // | |
11 // wrapper currently provides interfaces for: | |
12 // * Datastore | |
13 // * Memcache | |
14 // * TaskQueue | |
15 // * GlobalInfo (e.g. Namespace, AppID, etc.) | |
16 // | |
17 // A package which implements the wrapper is expected to provide the following: | |
18 // * A package function `Enable(c context.Context, ...) context.Context` | |
19 // This function is expected to add any information to c which is necessary | |
20 // for the rest of its implementations to work. This may be something like | |
21 // an `appengine.Context` or some connection information for an external | |
22 // server. The `...` in the function signature may be any additional data | |
23 // needed. | |
24 // * Any of the package functions: | |
25 // | |
26 // UseDS(context.Context) context.Context | |
27 // UseMC(context.Context) context.Context | |
28 // UseTQ(context.Context) context.Context | |
29 // UseGI(context.Context) context.Context | |
30 // | |
31 // each of which would call wrapper.Set<service>Factory with the factory | |
32 // function for that interface type. | |
33 // * A `Use(context.Context) context.Context` function which calls all of
the | |
34 // `Use*` package functions implemented by the package. | |
35 // * Partially-implemented interfaces should embed one of the Dummy* structs | |
36 // which will panic with an appropriate error for unimplemented | |
37 // methods. | |
38 // | |
39 // see "infra/gae/libs/wrapper/gae" for an appengine-backed implementation. | |
40 package wrapper | |
OLD | NEW |