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

Side by Side Diff: doc.go

Issue 1270063003: Make the rest of the services have a similar raw/user interface structure. (Closed) Base URL: https://github.com/luci/gae.git@add_datastore
Patch Set: address comments Created 5 years, 4 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 | « no previous file | filter/count/count_test.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 gae provides a fakable wrapped interface for the appengine SDK's 5 // Package gae 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 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). 7 // APIs for testing (or potentially implement a different backend for them).
8 // 8 //
9 // Features 9 // Features
10 // 10 //
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // 96 //
97 // A service defintion lives under the `service` subfolder, and defines the 97 // A service defintion lives under the `service` subfolder, and defines the
98 // user-facing interface for a service. Each service has a few common types and 98 // user-facing interface for a service. Each service has a few common types and
99 // functions. Common types are: 99 // functions. Common types are:
100 // 100 //
101 // service.Interface - the main user-friendly service interface. 101 // service.Interface - the main user-friendly service interface.
102 // 102 //
103 // service.RawInterface - the internal service interface used by service 103 // service.RawInterface - the internal service interface used by service
104 // and filter implementations. Note that some services 104 // and filter implementations. Note that some services
105 // like Info don't distinguish between the service 105 // like Info don't distinguish between the service
106 // interface and the user interface. 106 // interface and the user interface. This interface is
107 // typically a bit lower level than Interface and
108 // lacks convenience methods.
107 // 109 //
108 // service.Testable - any additional methods that a 'testing' 110 // service.Testable - any additional methods that a 'testing'
109 // implementation should provide. It's expected that 111 // implementation should provide. It's expected that
110 // tests will cast the RawInterface from GetRaw() to 112 // tests will cast the RawInterface from GetRaw() to
111 // Testable in order to access these methods. 113 // Testable in order to access these methods.
112 // 114 //
113 // service.RawFactory - a function returning a RawInterface 115 // service.RawFactory - a function returning a RawInterface
114 // 116 //
115 // service.RawFilter - a function returning a new RawInterface based on 117 // service.RawFilter - a function returning a new RawInterface based on
116 // the previous filtered interface. Filters chain 118 // the previous filtered interface. Filters chain
117 // together to allow behavioral service features 119 // together to allow behavioral service features
118 // without needing to agument the underlying service 120 // without needing to agument the underlying service
119 // implementations directly. 121 // implementations directly.
120 // 122 //
121 // And common functions are: 123 // And common functions are:
122 // service.Get - Retrieve the current, filtered Interface 124 // service.Get - Retrieve the current, filtered Interface
123 // implementation from the context. This is the most 125 // implementation from the context. This is the most
124 // frequently used service function by far. 126 // frequently used service function by far.
125 // 127 //
126 // service.GetRaw - Retrieve the current, filtered RawInterface 128 // service.GetRaw - Retrieve the current, filtered RawInterface
127 // implementation from the context. This is less 129 // implementation from the context. This is less
128 // frequently used, but can be useful if you want to 130 // frequently used, but can be useful if you want to
129 // avoid some of the overhead of the user-friendly 131 // avoid some of the overhead of the user-friendly
130 // Interface, which can do sometimes-unnecessary amou nts 132 // Interface, which can do sometimes-unnecessary amou nts
131 // of reflection or allocation. The RawInterface and 133 // of reflection or allocation. The RawInterface and
132 // Interface for a service are fully interchangable a nd 134 // Interface for a service are fully interchangable a nd
133 // usage of them can be freely mixed in an applicatio n. 135 // usage of them can be freely mixed in an applicatio n.
134 // 136 //
135 // service.AddRawFilters - adds one or more Filters to the context. 137 // service.AddRawFilters - adds one or more RawFilters to the context.
136 // 138 //
137 // service.SetRawFactory - adds a Factory to the context 139 // service.SetRawFactory - adds a RawFactory to the context
138 // 140 //
139 // service.SetRaw - adds an implementation of RawInterface to the cont ext 141 // service.SetRaw - adds an implementation of RawInterface to the cont ext
140 // (shorthand for SetRawFactory, useful for testing) 142 // (shorthand for SetRawFactory, useful for testing)
141 // 143 //
142 // Implementations 144 // Implementations
143 // 145 //
144 // The impl subdirectory contains a couple different service implementations, 146 // The impl subdirectory contains a couple different service implementations,
145 // depending on your needs. 147 // depending on your needs.
146 // 148 //
147 // 'prod' is the production (e.g. real appengine-backed) implementation. It 149 // 'prod' is the production (e.g. real appengine-backed) implementation. It
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // and the state can be observed to see how many times each API was invoked. 215 // and the state can be observed to see how many times each API was invoked.
214 // Since filters stack, we can compare counts from rawCount versus userCount to 216 // Since filters stack, we can compare counts from rawCount versus userCount to
215 // see how many calls to the actual real datastore went through, vs. how many 217 // see how many calls to the actual real datastore went through, vs. how many
216 // went to memcache, for example. 218 // went to memcache, for example.
217 // 219 //
218 // Note that Filters apply only to the service.RawInterface. All implementations 220 // Note that Filters apply only to the service.RawInterface. All implementations
219 // of service.Interface boil down to calls to service.RawInterface methods, but 221 // of service.Interface boil down to calls to service.RawInterface methods, but
220 // it's possible that bad calls to the service.Interface methods could return 222 // it's possible that bad calls to the service.Interface methods could return
221 // an error before ever reaching the filters or service implementation. 223 // an error before ever reaching the filters or service implementation.
222 package gae 224 package gae
OLDNEW
« no previous file with comments | « no previous file | filter/count/count_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698