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

Unified Diff: appengine/logdog/coordinator/project.go

Issue 1910633006: LogDog: Support per-namespace expired archival. (Closed) Base URL: https://github.com/luci/luci-go@logdog-coordinator-svcdec
Patch Set: Update another test. Created 4 years, 8 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
Index: appengine/logdog/coordinator/project.go
diff --git a/appengine/logdog/coordinator/project.go b/appengine/logdog/coordinator/project.go
new file mode 100644
index 0000000000000000000000000000000000000000..4534c4f04c354675c4fe414e5d90a2f3e3c0a183
--- /dev/null
+++ b/appengine/logdog/coordinator/project.go
@@ -0,0 +1,31 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package coordinator
+
+import (
+ "strings"
+
+ "github.com/luci/luci-go/common/config"
+)
+
+const projectNamespacePrefix = "luci."
+
+// ProjectNamespace returns the AppEngine namespace for a given luci-config
+// project name.
+func ProjectNamespace(project config.ProjectName) string {
+ return projectNamespacePrefix + string(project)
+}
+
+// ProjectFromNamespace returns the current project installed in the supplied
+// Context's namespace.
+//
+// If the namespace does not have a project namespace prefix, this function
+// will return an empty string.
+func ProjectFromNamespace(ns string) config.ProjectName {
+ if !strings.HasPrefix(ns, projectNamespacePrefix) {
+ return ""
+ }
+ return config.ProjectName(ns[len(projectNamespacePrefix):])
+}
« no previous file with comments | « appengine/logdog/coordinator/mutations/createArchiveTask.go ('k') | appengine/logdog/coordinator/service.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698