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

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

Issue 1240573002: Reland: Refactor current GAE abstraction library to be free of the SDK* (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: expand coverage range to fit 32bit test expectations Created 5 years, 5 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 | « go/src/infra/gae/libs/memlock/memlock_test.go ('k') | go/src/infra/gae/libs/meta/eg_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 899c2c6a929a65b8e96c2e295a262f9fce563892..8522d5051d6dc7f5e98c26c8d945cb605a1780f0 100644
--- a/go/src/infra/gae/libs/meta/eg.go
+++ b/go/src/infra/gae/libs/meta/eg.go
@@ -7,11 +7,9 @@ package meta
import (
"golang.org/x/net/context"
- "appengine/datastore"
-
"github.com/luci/luci-go/common/errors"
- "infra/gae/libs/wrapper"
+ "infra/gae/libs/gae"
)
var mark = errors.MakeMarkFn("eg")
@@ -20,24 +18,20 @@ var mark = errors.MakeMarkFn("eg")
// appengine. You shouldn't need to use this struct directly, but instead should
// use GetEntityGroupVersion.
type EntityGroupMeta struct {
- _kind string `datastore:"-" goon:"kind,__entity_group__"`
-
- ID int64 `datastore:"-" goon:"id"`
- Parent *datastore.Key `datastore:"-" goon:"parent"`
-
- Version int64 `datastore:"__version__"`
+ Version int64 `gae:"__version__"`
}
// 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.Context, root *datastore.Key) (int64, error) {
+func GetEntityGroupVersion(c context.Context, root gae.DSKey) (int64, error) {
for root.Parent() != nil {
root = root.Parent()
}
- egm := &EntityGroupMeta{ID: 1, Parent: root}
- err := wrapper.GetDS(c).Get(egm)
- if err != datastore.ErrNoSuchEntity {
+ egm := &EntityGroupMeta{}
+ rds := gae.GetRDS(c)
+ err := rds.Get(rds.NewKey("__entity_group__", "", 1, root), egm)
+ if err != gae.ErrDSNoSuchEntity {
err = mark(err)
} else {
// this is OK for callers. The version of the entity group is effectively 0
« no previous file with comments | « go/src/infra/gae/libs/memlock/memlock_test.go ('k') | go/src/infra/gae/libs/meta/eg_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698