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

Side by Side Diff: milo/common/model/build_summary.go

Issue 2978293002: [milo] Add an (uncached) method to get console rows. (Closed)
Patch Set: more changes Created 3 years, 5 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 2017 The LUCI Authors. 1 // Copyright 2017 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 CurrentStep Summary 57 CurrentStep Summary
58 58
59 // Manifests is a list of links to source manifests that this build repo rted. 59 // Manifests is a list of links to source manifests that this build repo rted.
60 Manifests []ManifestLink 60 Manifests []ManifestLink
61 61
62 // Patches is the list of patches which are associated with this build. 62 // Patches is the list of patches which are associated with this build.
63 // We reserve the multi-patch case for advanced (multi-repo) tryjobs... 63 // We reserve the multi-patch case for advanced (multi-repo) tryjobs...
64 // Typically there will only be one patch associated with a build. 64 // Typically there will only be one patch associated with a build.
65 Patches []PatchInfo 65 Patches []PatchInfo
66 66
67 » // ManifestRevisionIndex has a single entry for each 67 » // ManifestKey has a single entry for each
68 // 0 ++ project ++ console ++ manifest_name ++ url ++ revision.decode( 'hex') 68 // 0 ++ project ++ console ++ manifest_name ++ url ++ revision.decode( 'hex')
69 » // which matched for this build. ++ is cmpbin concatenation. 69 » // which matched for this build. This is used to index this BuildSummary as
70 » // the row for any consoles that it shows up in that use the
71 » // Manifest/RepoURL/Revision indexing scheme.
72 » //
73 » // (++ is cmpbin concatenation)
70 // 74 //
71 // Example: 75 // Example:
72 // 0 ++ "chromium" ++ "main" ++ "UNPATCHED" ++ "https://.../src.git" + + deadbeef 76 // 0 ++ "chromium" ++ "main" ++ "UNPATCHED" ++ "https://.../src.git" + + deadbeef
73 // 77 //
74 // The list of interested consoles is compiled at build summarization ti me. 78 // The list of interested consoles is compiled at build summarization ti me.
75 » ManifestRevisionIndex [][]byte 79 » ManifestKey [][]byte
Ryan Tseng 2017/07/20 00:36:25 ManifestKeys Consider type ManifestKey []byte, so
iannucci 2017/07/20 00:43:59 Done.
76 } 80 }
77 81
78 // AddManifestRevisionIndex adds a new entry to ManifestRevisionIndex. 82 // AddManifestKey adds a new entry to ManifestKey.
79 // 83 //
80 // `revision` should be the hex-decoded git revision. 84 // `revision` should be the hex-decoded git revision.
81 // 85 //
82 // It's up to the caller to ensure that entries in ManifestRevisionIndex aren't 86 // It's up to the caller to ensure that entries in ManifestKey aren't
83 // duplicated. 87 // duplicated.
84 func (bs *BuildSummary) AddManifestRevisionIndex(project, console, manifest, rep oURL string, revision []byte) { 88 func (bs *BuildSummary) AddManifestKey(project, console, manifest, repoURL strin g, revision []byte) {
89 » bs.ManifestKey = append(bs.ManifestKey,
90 » » NewPartialManifestKey(project, console, manifest, repoURL).AddRe vision(revision))
91 }
92
93 // PartialManifestKey is an incomplete ManifestKey key which can be made
94 // complete by calling AddRevision.
95 type PartialManifestKey []byte
96
97 // AddRevision appends a git revision (as bytes) to the PartialManifestKey,
98 // returning a full index value for BuildSummary.ManifestKey.
99 func (p PartialManifestKey) AddRevision(revision []byte) []byte {
100 » var buf bytes.Buffer
101 » buf.Write(p)
102 » cmpbin.WriteBytes(&buf, revision)
103 » return buf.Bytes()
104 }
105
106 // NewPartialManifestKey generates a ManifestKey prefix corresponding to
107 // the given parameters.
108 func NewPartialManifestKey(project, console, manifest, repoURL string) PartialMa nifestKey {
85 var buf bytes.Buffer 109 var buf bytes.Buffer
86 cmpbin.WriteUint(&buf, 0) // version 110 cmpbin.WriteUint(&buf, 0) // version
87 cmpbin.WriteString(&buf, project) 111 cmpbin.WriteString(&buf, project)
88 cmpbin.WriteString(&buf, console) 112 cmpbin.WriteString(&buf, console)
89 cmpbin.WriteString(&buf, manifest) 113 cmpbin.WriteString(&buf, manifest)
90 cmpbin.WriteString(&buf, repoURL) 114 cmpbin.WriteString(&buf, repoURL)
91 » cmpbin.WriteBytes(&buf, revision) 115 » return PartialManifestKey(buf.Bytes())
92 » bs.ManifestRevisionIndex = append(bs.ManifestRevisionIndex, buf.Bytes())
93 } 116 }
OLDNEW
« no previous file with comments | « milo/buildsource/swarming/expectations/build-gerrit.json ('k') | milo/frontend/appengine/templates/pages/console.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698