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

Unified Diff: go/src/infra/gae/libs/meta/eg.go

Issue 1151473003: Better attempt at an appengine wrapper. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: pointer! Created 5 years, 7 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
Index: go/src/infra/gae/libs/meta/eg.go
diff --git a/go/src/infra/gae/libs/meta/eg.go b/go/src/infra/gae/libs/meta/eg.go
index 25463238fd8b095182a15a6524605d5ea0f34186..01e0f3eb4a06752039e5e7414ef02e5203aec904 100644
--- a/go/src/infra/gae/libs/meta/eg.go
+++ b/go/src/infra/gae/libs/meta/eg.go
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// +build appengine
-
package meta
import (
+ "golang.org/x/net/context"
M-A Ruel 2015/05/25 17:14:50 Why golang.org and github.com not be grouped toget
iannucci 2015/05/26 18:25:05 Ok, I was unsure of this. I was trying to do somet
M-A Ruel 2015/05/27 00:27:10 I prefer the result of the following: pack everyt
+
"appengine/datastore"
"github.com/luci/luci-go/common/errors"
- "infra/gae/libs/context"
+ "infra/gae/libs/wrapper"
)
var mark = errors.MakeMarkFn("eg")
@@ -31,12 +31,13 @@ type EntityGroupMeta struct {
// GetEntityGroupVersion returns the entity group version for the entity group
// containing root. If the entity group doesn't exist, this function will return
// zero and a nil error.
-func GetEntityGroupVersion(c context.SingleReadWriter, root *datastore.Key) (int64, error) {
+func GetEntityGroupVersion(c context.Context, root *datastore.Key) (int64, error) {
+ ds := wrapper.GetDS(c)
for root.Parent() != nil {
root = root.Parent()
}
egm := &EntityGroupMeta{ID: 1, Parent: root}
- err := c.Get(egm)
+ err := ds.Get(egm)
if err != datastore.ErrNoSuchEntity {
err = mark(err)
} else {

Powered by Google App Engine
This is Rietveld 408576698