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

Unified Diff: appengine/logdog/coordinator/endpoints/util.go

Issue 1971493003: LogDog: Project READ access for user endpoints. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-service-config
Patch Set: Updated patchset dependency Created 4 years, 7 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/endpoints/util.go
diff --git a/appengine/logdog/coordinator/endpoints/util.go b/appengine/logdog/coordinator/endpoints/util.go
new file mode 100644
index 0000000000000000000000000000000000000000..f202b85ef352d7d6e8a48a8c326807ee9accc075
--- /dev/null
+++ b/appengine/logdog/coordinator/endpoints/util.go
@@ -0,0 +1,24 @@
+// Copyright 2016 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 endpoints
+
+import (
+ "time"
+
+ "github.com/luci/luci-go/common/proto/google"
+)
+
+// MinDuration selects the smallest duration that is > 0 from a set of
+// google.Duration protobufs.
+//
+// If none of the supplied Durations are > 0, 0 will be returned.
+func MinDuration(candidates ...*google.Duration) (exp time.Duration) {
+ for _, c := range candidates {
+ if cd := c.Duration(); cd > 0 && (exp <= 0 || cd < exp) {
+ exp = cd
+ }
+ }
+ return
+}

Powered by Google App Engine
This is Rietveld 408576698