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

Unified Diff: luci_config/server/cfgclient/backend/caching/config.go

Issue 2640813005: Fold config service URL into datastore cache keys. (Closed)
Patch Set: Rebase. Created 3 years, 11 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 | « luci_config/appengine/backend/memcache/cache_test.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: luci_config/server/cfgclient/backend/caching/config.go
diff --git a/luci_config/server/cfgclient/backend/caching/config.go b/luci_config/server/cfgclient/backend/caching/config.go
index c8dd1ed5b7331087f42f5197341292d37632a415..983926d104a3d6c729fe9137548193a071554179 100644
--- a/luci_config/server/cfgclient/backend/caching/config.go
+++ b/luci_config/server/cfgclient/backend/caching/config.go
@@ -39,6 +39,9 @@ type Key struct {
// incompatible way, this must also change.
Schema string `json:"s,omitempty"`
+ // ServiceURL is the URL of the config service.
+ ServiceURL string `json:"u,omitempty"`
+
// Authority is the config authority to use.
Authority backend.Authority `json:"a,omitempty"`
@@ -70,8 +73,8 @@ func (k *Key) ParamHash() []byte {
if k.Content {
cstr = "y"
}
- return HashParams(k.Schema, string(k.Authority), string(k.Op), cstr, k.Formatter, k.FormatData,
- k.ConfigSet, k.Path, string(k.GetAllTarget))
+ return HashParams(k.Schema, k.ServiceURL, string(k.Authority), string(k.Op), cstr,
+ k.Formatter, k.FormatData, k.ConfigSet, k.Path, string(k.GetAllTarget))
}
// String prints a text representation of the key. No effort is made to ensure
@@ -238,10 +241,16 @@ type Backend struct {
CacheGet func(context.Context, Key, Loader) (*Value, error)
}
+func (b *Backend) keyServiceURL(c context.Context) string {
+ u := b.ServiceURL(c)
+ return u.String()
+}
+
// Get implements backend.B.
func (b *Backend) Get(c context.Context, configSet, path string, p backend.Params) (*backend.Item, error) {
key := Key{
Schema: Schema,
+ ServiceURL: b.keyServiceURL(c),
Authority: p.Authority,
Op: OpGet,
Content: p.Content,
@@ -283,6 +292,7 @@ func (b *Backend) Get(c context.Context, configSet, path string, p backend.Param
func (b *Backend) GetAll(c context.Context, t backend.GetAllTarget, path string, p backend.Params) ([]*backend.Item, error) {
key := Key{
Schema: Schema,
+ ServiceURL: b.keyServiceURL(c),
Authority: p.Authority,
Op: OpGetAll,
Content: p.Content,
@@ -317,10 +327,11 @@ func (b *Backend) GetAll(c context.Context, t backend.GetAllTarget, path string,
// ConfigSetURL implements backend.B.
func (b *Backend) ConfigSetURL(c context.Context, configSet string, p backend.Params) (u url.URL, err error) {
key := Key{
- Schema: Schema,
- Authority: p.Authority,
- Op: OpConfigSetURL,
- ConfigSet: configSet,
+ Schema: Schema,
+ ServiceURL: b.keyServiceURL(c),
+ Authority: p.Authority,
+ Op: OpConfigSetURL,
+ ConfigSet: configSet,
}
var value *Value
« no previous file with comments | « luci_config/appengine/backend/memcache/cache_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698