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

Unified Diff: impl/memory/raw_datastore_data.go

Issue 1269113005: A transparent cache for datastore, backed by memcache. (Closed) Base URL: https://github.com/luci/gae.git@add_meta
Patch Set: fix comments Created 5 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
« no previous file with comments | « impl/memory/memcache.go ('k') | impl/prod/memcache.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/raw_datastore_data.go
diff --git a/impl/memory/raw_datastore_data.go b/impl/memory/raw_datastore_data.go
index a37a2abf63392795438f4207e43e487fb0fa8025..dff438b30b33a9d6415fa218e698f26b1fdd3f55 100644
--- a/impl/memory/raw_datastore_data.go
+++ b/impl/memory/raw_datastore_data.go
@@ -63,16 +63,18 @@ func rootIDsKey(kind string) []byte {
}
func curVersion(ents *memCollection, key []byte) int64 {
- if v := ents.Get(key); v != nil {
- pm, err := rpm(v)
- if err != nil {
- panic(err) // memory corruption
- }
- pl, ok := pm["__version__"]
- if ok && len(pl) > 0 && pl[0].Type() == ds.PTInt {
- return pl[0].Value().(int64)
+ if ents != nil {
+ if v := ents.Get(key); v != nil {
+ pm, err := rpm(v)
+ if err != nil {
+ panic(err) // memory corruption
+ }
+ pl, ok := pm["__version__"]
+ if ok && len(pl) > 0 && pl[0].Type() == ds.PTInt {
+ return pl[0].Value().(int64)
+ }
+ panic(fmt.Errorf("__version__ property missing or wrong: %v", pm))
}
- panic(fmt.Errorf("__version__ property missing or wrong: %v", pm))
}
return 0
}
« no previous file with comments | « impl/memory/memcache.go ('k') | impl/prod/memcache.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698