OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package dscache | 5 package dscache |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 | 9 |
10 ds "github.com/luci/gae/service/datastore" | 10 ds "github.com/luci/gae/service/datastore" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // from datastore and then attempt to save them back to memcache. | 85 // from datastore and then attempt to save them back to memcache. |
86 // * some entries are 'lock' entries, owned by something else, so we should | 86 // * some entries are 'lock' entries, owned by something else, so we should |
87 // get them from datastore and then NOT save them to memcache. | 87 // get them from datastore and then NOT save them to memcache. |
88 // | 88 // |
89 // Or some combination thereof. This also handles memcache enries with invalid | 89 // Or some combination thereof. This also handles memcache enries with invalid |
90 // data in them, cases where items have caching disabled entirely, etc. | 90 // data in them, cases where items have caching disabled entirely, etc. |
91 func makeFetchPlan(c context.Context, aid, ns string, f *facts) *plan { | 91 func makeFetchPlan(c context.Context, aid, ns string, f *facts) *plan { |
92 p := plan{ | 92 p := plan{ |
93 keepMeta: f.getMeta != nil, | 93 keepMeta: f.getMeta != nil, |
94 decoded: make([]ds.PropertyMap, len(f.lockItems)), | 94 decoded: make([]ds.PropertyMap, len(f.lockItems)), |
95 » » lme: errors.LazyMultiError{Size: len(f.lockItems)}, | 95 » » lme: errors.NewLazyMultiError(len(f.lockItems)), |
96 } | 96 } |
97 for i, lockItm := range f.lockItems { | 97 for i, lockItm := range f.lockItems { |
98 m := f.getMeta.GetSingle(i) | 98 m := f.getMeta.GetSingle(i) |
99 getKey := f.getKeys[i] | 99 getKey := f.getKeys[i] |
100 | 100 |
101 if lockItm == nil { | 101 if lockItm == nil { |
102 // this item wasn't cacheable (e.g. the model had cachin
g disabled, | 102 // this item wasn't cacheable (e.g. the model had cachin
g disabled, |
103 // shardsForKey returned 0, etc.) | 103 // shardsForKey returned 0, etc.) |
104 p.add(i, getKey, m, nil) | 104 p.add(i, getKey, m, nil) |
105 continue | 105 continue |
(...skipping 22 matching lines...) Expand all Loading... |
128 p.add(i, getKey, m, nil) | 128 p.add(i, getKey, m, nil) |
129 } | 129 } |
130 | 130 |
131 default: | 131 default: |
132 // have some other sort of object, or our AddMulti faile
d to add this item. | 132 // have some other sort of object, or our AddMulti faile
d to add this item. |
133 p.add(i, getKey, m, nil) | 133 p.add(i, getKey, m, nil) |
134 } | 134 } |
135 } | 135 } |
136 return &p | 136 return &p |
137 } | 137 } |
OLD | NEW |