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

Unified Diff: doc.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Lightning talk licenses. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | docs/present/lightning/dummy.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: doc.go
diff --git a/doc.go b/doc.go
index 70d7033b0c7d7b17e11c343a4011083d9cb92b18..43150313d96e7cd4e33055845b19a4c819d70226 100644
--- a/doc.go
+++ b/doc.go
@@ -63,9 +63,8 @@
// }
//
// func innerHandler(c context.Context, w http.ResponseWriter) {
-// rds := datastore.Get(c)
// obj := &CoolStruct{Value: "hello"}
-// if err := rds.Put(obj); err != nil {
+// if err := rds.Put(c, obj); err != nil {
// http.Error(w, err.String(), http.StatusInternalServerError)
// }
// fmt.Fprintf(w, "I wrote: %s", ds.KeyForObj(obj))
@@ -123,10 +122,6 @@
// implementations directly.
//
// And common functions are:
-// service.Get - Retrieve the current, filtered Interface
-// implementation from the context. This is the most
-// frequently used service function by far.
-//
// service.GetRaw - Retrieve the current, filtered RawInterface
// implementation from the context. This is less
// frequently used, but can be useful if you want to
@@ -178,15 +173,10 @@
// }
//
// func CoolFunc(c context.Context, ...) {
-// ds := datastore.Get(c) // returns a datastore.Interface object
-// mc := memcache.Get(c) // returns a memcache.Interface object
-// // use them here
-//
-// // don't pass ds/mc/etc. directly, pass the context instead.
// SomeOtherFunction(c, ...)
//
// // because you might need to:
-// ds.RunInTransaction(func (c context.Context) error {
+// ds.RunInTransaction(c, func (c context.Context) error {
// SomeOtherFunction(c, ...) // c contains transactional versions of everything
// }, nil)
// }
@@ -203,15 +193,6 @@
// <count filter (counts how many times each API is actually hit)>
// memory datastore.RawInterface implementation
//
-// So datastore.Get would return the full stack. In code, this would look
-// like:
-// func HTTPHandler(r *http.Request) {
-// c := prod.UseRequest(r) // production datastore
-// c, rawCount := count.FilterRDS(c) // add count filter
-// c = dscache.FilterRDS(c) // add dscache filter
-// c, userCount := count.FilterRDS(c) // add another count filter
-// }
-//
// Filters may or may not have state, it's up to the filter itself. In the case
// of the count filter, it returns its state from the Filter<Service> method,
// and the state can be observed to see how many times each API was invoked.
« no previous file with comments | « no previous file | docs/present/lightning/dummy.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698