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

Unified Diff: luci_config/appengine/format/context.go

Issue 2575383002: Add server/cache support to gaeconfig. (Closed)
Patch Set: Un-collapse. 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') | luci_config/appengine/format/default.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: luci_config/appengine/format/context.go
diff --git a/luci_config/appengine/format/context.go b/luci_config/appengine/format/context.go
new file mode 100644
index 0000000000000000000000000000000000000000..73b7044781dedd7b4e52a3dd0e32df6c2f1e7843
--- /dev/null
+++ b/luci_config/appengine/format/context.go
@@ -0,0 +1,25 @@
+// Copyright 2016 The LUCI Authors. All rights reserved.
+// Use of this source code is governed under the Apache License, Version 2.0
+// that can be found in the LICENSE file.
+
+package format
+
+import (
+ "github.com/luci/luci-go/luci_config/server/cfgclient"
+
+ "golang.org/x/net/context"
+)
+
+var formatRegistryKey = "github.com/luci/luci-go/luci_config/appengine/format:FormatRegistry"
+
+// WithRegistry returns a Context with the supplied FormatterRegistry embedded
+// into it.
+func WithRegistry(c context.Context, fr *cfgclient.FormatterRegistry) context.Context {
+ return context.WithValue(c, &formatRegistryKey, fr)
+}
+
+// GetRegistry is used to retrieve the config service format registry from the
+// supplied Context.
+func GetRegistry(c context.Context) *cfgclient.FormatterRegistry {
+ return c.Value(&formatRegistryKey).(*cfgclient.FormatterRegistry)
+}
« no previous file with comments | « luci_config/appengine/backend/memcache/cache_test.go ('k') | luci_config/appengine/format/default.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698