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

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

Issue 2642343003: luci_config: Request content only when desired. (Closed)
Patch Set: 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 | « no previous file | luci_config/server/cfgclient/config_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: luci_config/server/cfgclient/config.go
diff --git a/luci_config/server/cfgclient/config.go b/luci_config/server/cfgclient/config.go
index f197e2c1990237bc3a03dcfc60a280e5a6b0e223..b83048d6a813c195127ca2f697025d80f54ca363 100644
--- a/luci_config/server/cfgclient/config.go
+++ b/luci_config/server/cfgclient/config.go
@@ -63,9 +63,9 @@ func ServiceURL(c context.Context) url.URL { return backend.Get(c).ServiceURL(c)
// Get retrieves a single configuration file.
//
-// r, if supplied, is a MultiResolver that will load the configuration data.
-// If nil, the configuration data will be discarded (useful if you only care
-// about metas).
+// r, if not nil, is a Resolver that will load the configuration data. If nil,
+// the configuration data will be discarded (useful if you only care about
+// metas).
//
// meta, if not nil, will have the configuration's Meta loaded into it on
// success.
@@ -74,7 +74,7 @@ func Get(c context.Context, a Authority, cs cfgtypes.ConfigSet, path string, r R
params := backend.Params{
Authority: backend.Authority(a),
- Content: true,
+ Content: r != nil,
}
if fr, ok := r.(FormattingResolver); ok {
@@ -97,7 +97,7 @@ func Get(c context.Context, a Authority, cs cfgtypes.ConfigSet, path string, r R
// Projects retrieves all named project configurations.
//
-// r, if supplied, is a MultiResolver that will load the configuration data.
+// r, if not nil, is a MultiResolver that will load the configuration data.
// If nil, the configuration data will be discarded (useful if you only care
// about metas). If the MultiResolver operates on a slice (which it probably
// will), each meta and/or error index will correspond to its slice index.
@@ -132,9 +132,10 @@ func getAll(c context.Context, a Authority, t backend.GetAllTarget, path string,
params := backend.Params{
Authority: backend.Authority(a),
- Content: true,
+ Content: r != nil,
}
+ // If we're fetching content, apply a formatting specification.
if fr, ok := r.(FormattingResolver); ok {
params.FormatSpec = fr.Format()
}
« no previous file with comments | « no previous file | luci_config/server/cfgclient/config_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698