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

Side by Side 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: self review 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package dm 5 package dm
6 6
7 import ( 7 import (
8 "github.com/luci/luci-go/common/errors" 8 "github.com/luci/luci-go/common/errors"
9 "math"
9 ) 10 )
10 11
11 const ( 12 const (
12 // DefaultLimitMaxDataSize is the default MaxDataSize value (16MB). 13 // DefaultLimitMaxDataSize is the default MaxDataSize value (16MB).
13 DefaultLimitMaxDataSize = 16 * 1024 * 1024 14 DefaultLimitMaxDataSize = 16 * 1024 * 1024
14 15
15 // MaxLimitMaxDataSize is the maximum MaxDataSize value (30MB). 16 // MaxLimitMaxDataSize is the maximum MaxDataSize value (30MB).
16 MaxLimitMaxDataSize = 30 * 1024 * 1024 17 MaxLimitMaxDataSize = 30 * 1024 * 1024
17 ) 18 )
18 19
19 // Normalize returns an error iff the WalkGraphReq is invalid. 20 // Normalize returns an error iff the WalkGraphReq is invalid.
20 func (w *WalkGraphReq) Normalize() error { 21 func (w *WalkGraphReq) Normalize() error {
22 if w.Auth != nil {
23 if err := w.Auth.Normalize(); err != nil {
24 return err
25 }
26 }
27
21 if w.Query == nil { 28 if w.Query == nil {
22 return errors.New("must specify a Query") 29 return errors.New("must specify a Query")
23 } 30 }
24 if err := w.Query.Normalize(); err != nil { 31 if err := w.Query.Normalize(); err != nil {
25 return err 32 return err
26 } 33 }
27 34
28 if w.Mode == nil { 35 if w.Mode == nil {
29 w.Mode = &WalkGraphReq_Mode{} 36 w.Mode = &WalkGraphReq_Mode{}
30 } 37 }
(...skipping 11 matching lines...) Expand all
42 if w.Limit.MaxDataSize == 0 { 49 if w.Limit.MaxDataSize == 0 {
43 w.Limit.MaxDataSize = DefaultLimitMaxDataSize 50 w.Limit.MaxDataSize = DefaultLimitMaxDataSize
44 } 51 }
45 if w.Limit.MaxDataSize > MaxLimitMaxDataSize { 52 if w.Limit.MaxDataSize > MaxLimitMaxDataSize {
46 w.Limit.MaxDataSize = MaxLimitMaxDataSize 53 w.Limit.MaxDataSize = MaxLimitMaxDataSize
47 } 54 }
48 55
49 if w.Include == nil { 56 if w.Include == nil {
50 w.Include = &WalkGraphReq_Include{} 57 w.Include = &WalkGraphReq_Include{}
51 } else { 58 } else {
52 » » if w.Include.AttemptResult { 59 » » if w.Include.All {
60 » » » w.Include.ObjectIds = true
61 » » » w.Include.QuestData = true
53 w.Include.AttemptData = true 62 w.Include.AttemptData = true
63 w.Include.AttemptResult = true
64 w.Include.ExpiredAttempts = true
65 w.Include.NumExecutions = math.MaxUint32
66 w.Include.ExecutionInfoUrl = true
67 w.Include.FwdDeps = true
68 w.Include.BackDeps = true
69 } else {
70 if w.Include.AttemptResult {
71 w.Include.AttemptData = true
72 }
73 if w.Include.NumExecutions == 0 {
74 w.Include.ExecutionInfoUrl = false
75 }
54 } 76 }
55 } 77 }
56 return nil 78 return nil
57 } 79 }
OLDNEW
« common/api/dm/service/v1/walk_graph.proto ('K') | « common/api/dm/service/v1/walk_graph.pb.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698