| 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
|
|
|