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

Unified Diff: service/datastore/meta/eg.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: service/datastore/meta/eg.go
diff --git a/service/datastore/meta/eg.go b/service/datastore/meta/eg.go
index 240fa9dec2ac8aa3ba1454cd139535a405422c21..e15d639d1a486008d9e134c648f301bbd4dd1750 100644
--- a/service/datastore/meta/eg.go
+++ b/service/datastore/meta/eg.go
@@ -5,7 +5,8 @@
package meta
import (
- "github.com/luci/gae/service/datastore"
+ ds "github.com/luci/gae/service/datastore"
+
"golang.org/x/net/context"
)
@@ -13,9 +14,9 @@ import (
// appengine. You shouldn't need to use this struct directly, but instead should
// use GetEntityGroupVersion.
type EntityGroupMeta struct {
- kind string `gae:"$kind,__entity_group__"`
- id int64 `gae:"$id,1"`
- Parent *datastore.Key `gae:"$parent"`
+ kind string `gae:"$kind,__entity_group__"`
+ id int64 `gae:"$id,1"`
+ Parent *ds.Key `gae:"$parent"`
Version int64 `gae:"__version__"`
}
@@ -23,12 +24,11 @@ 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.Context, key *datastore.Key) (int64, error) {
- ds := datastore.Get(c)
+func GetEntityGroupVersion(c context.Context, key *ds.Key) (int64, error) {
egm := &EntityGroupMeta{Parent: key.Root()}
- err := ds.Get(egm)
+ err := ds.Get(c, egm)
ret := egm.Version
- if err == datastore.ErrNoSuchEntity {
+ if err == ds.ErrNoSuchEntity {
// this is OK for callers. The version of the entity group is effectively 0
// in this case.
err = nil

Powered by Google App Engine
This is Rietveld 408576698