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

Unified Diff: common/api/dm/service/v1/walk_graph_normalize.go

Issue 1537883002: Initial distributor implementation (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: fix imports and make dummy.go a real file Created 4 years, 6 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 | « common/api/dm/service/v1/walk_graph.pb.go ('k') | common/gcloud/pubsub/topic.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/api/dm/service/v1/walk_graph_normalize.go
diff --git a/common/api/dm/service/v1/walk_graph_normalize.go b/common/api/dm/service/v1/walk_graph_normalize.go
index 0a412112ebe2dc06fb6ccf82b12e56e0c596a5a3..9bd4baaccd3660a18c512ac65ab907b087f7041a 100644
--- a/common/api/dm/service/v1/walk_graph_normalize.go
+++ b/common/api/dm/service/v1/walk_graph_normalize.go
@@ -5,6 +5,8 @@
package dm
import (
+ "math"
+
"github.com/luci/luci-go/common/errors"
)
@@ -16,8 +18,27 @@ const (
MaxLimitMaxDataSize = 30 * 1024 * 1024
)
+// MakeWalkGraphIncludeAll makes a new WalkGraphReq_Include which has all the
+// boxes ticked. This should only be used when your application plans to dump
+// the resulting graph query data to some logging/debugging trace for humans.
+//
+// If you don't plan on dumping it for humans, please set the Include options
+// appropriately in order to avoid wasting bandwidth/cpu/datastore query time on
+// the server (and draining your DM quotas unnecessarially).
+func MakeWalkGraphIncludeAll() *WalkGraphReq_Include {
+ return &WalkGraphReq_Include{
+ true, true, true, true, true, math.MaxUint32, true, true, true,
+ }
+}
+
// Normalize returns an error iff the WalkGraphReq is invalid.
func (w *WalkGraphReq) Normalize() error {
+ if w.Auth != nil {
+ if err := w.Auth.Normalize(); err != nil {
+ return err
+ }
+ }
+
if w.Query == nil {
return errors.New("must specify a Query")
}
@@ -52,6 +73,9 @@ func (w *WalkGraphReq) Normalize() error {
if w.Include.AttemptResult {
w.Include.AttemptData = true
}
+ if w.Include.NumExecutions == 0 {
+ w.Include.ExecutionInfoUrl = false
+ }
}
return nil
}
« no previous file with comments | « common/api/dm/service/v1/walk_graph.pb.go ('k') | common/gcloud/pubsub/topic.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698