Chromium Code Reviews| 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, |
|
dnj (Google)
2016/06/16 16:57:22
nit: For this many fields, I think you should key:
iannucci
2016/06/18 01:35:41
I'm intentionally not using fields so that if I ad
|
| + } |
| +} |
| + |
| // 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 |
| } |