[gold] Clean up dead code in tiling and gitstore
I believe this was once used by Gold, but no longer.
Also rename tiling.TraceId -> tiling.TraceID
Do we need tiling.Trace since only Gold is really using
the interface? probably not, but that's for another CL.
Bug: skia:9628
Change-Id: I23cf3fff31da017a9f90a82e2061f300e6e9a562
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/253939
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
diff --git a/go/git/gitinfo/gitinfo.go b/go/git/gitinfo/gitinfo.go
index 66cd7dd..2474d61 100644
--- a/go/git/gitinfo/gitinfo.go
+++ b/go/git/gitinfo/gitinfo.go
@@ -1,4 +1,4 @@
-// gitinfo enables querying info from a Git repository.
+// Package gitinfo enables querying info from Git repository using git and a local checkout.
package gitinfo
import (
@@ -13,12 +13,9 @@
"sync"
"time"
- "go.skia.org/infra/go/depot_tools"
"go.skia.org/infra/go/exec"
"go.skia.org/infra/go/git"
"go.skia.org/infra/go/sklog"
- "go.skia.org/infra/go/tiling"
- "go.skia.org/infra/go/util"
"go.skia.org/infra/go/vcsinfo"
)
@@ -28,13 +25,11 @@
// GitInfo allows querying a Git repo.
type GitInfo struct {
- dir git.GitDir
- hashes []string
- timestamps map[string]time.Time // The git hash is the key.
- detailsCache map[string]*vcsinfo.LongCommit // The git hash is the key.
- firstCommit string
- secondaryVCS vcsinfo.VCS
- secondaryExtractor depot_tools.DEPSExtractor
+ dir git.GitDir
+ hashes []string
+ timestamps map[string]time.Time // The git hash is the key.
+ detailsCache map[string]*vcsinfo.LongCommit // The git hash is the key.
+ firstCommit string
// Any access to hashes or timestamps must be protected.
mutex sync.Mutex
@@ -83,13 +78,8 @@
// Update refreshes the history that GitInfo stores for the repo. If pull is
// true then git pull is performed before refreshing.
func (g *GitInfo) Update(ctx context.Context, pull, allBranches bool) error {
- // If there is a secondary repository update it in the background and wait
- // at the end until the update is done.
- doneCh := g.updateSecondary(ctx, pull, allBranches)
-
g.mutex.Lock()
defer g.mutex.Unlock()
- defer func() { <-doneCh }()
sklog.Info("Beginning Update.")
if pull {
@@ -504,52 +494,6 @@
return ret, nil
}
-func (g *GitInfo) IsAncestor(ctx context.Context, a, b string) bool {
- cmd := []string{"merge-base", "--is-ancestor", a, b}
- if _, err := g.dir.Git(ctx, cmd...); err != nil {
- return false
- }
- return true
-}
-
-// ResolveCommit see vcsinfo.VCS interface.
-func (g *GitInfo) ResolveCommit(ctx context.Context, commitHash string) (string, error) {
- if g.secondaryVCS == nil {
- return "", vcsinfo.NoSecondaryRepo
- }
-
- foundCommit, err := g.secondaryExtractor.ExtractCommit(g.secondaryVCS.GetFile(ctx, "DEPS", commitHash))
- if err != nil {
- return "", err
- }
- return foundCommit, nil
-}
-
-// SetSecondaryRepo allows to add a secondary repository and extractor to this instance.
-// It is not included in the constructor since it is currently only used by the Gold ingesters.
-func (g *GitInfo) SetSecondaryRepo(secVCS vcsinfo.VCS, extractor depot_tools.DEPSExtractor) {
- g.secondaryVCS = secVCS
- g.secondaryExtractor = extractor
-}
-
-// updateSecondary updates the secondary VCS if one is defined. The returned
-// channel will be closed once the update this done. This allows to synchronize
-// with the completion via simple read from the channel.
-func (g *GitInfo) updateSecondary(ctx context.Context, pull, allBranches bool) <-chan bool {
- doneCh := make(chan bool)
-
- // Update the secondary VCS if necessary and close the done channel after.
- go func() {
- if g.secondaryVCS != nil {
- if err := g.secondaryVCS.Update(ctx, pull, allBranches); err != nil {
- sklog.Errorf("Error updating secondary VCS: %s", err)
- }
- }
- close(doneCh)
- }()
- return doneCh
-}
-
// gitHash represents information on a single Git commit.
type gitHash struct {
hash string
@@ -696,147 +640,5 @@
return hashes, timestamps, nil
}
-// SkpCommits returns the indices for all the commits that contain SKP updates.
-func (g *GitInfo) SkpCommits(ctx context.Context, tile *tiling.Tile) ([]int, error) {
- // Executes a git log command that looks like:
- //
- // git log --format=format:%h 32956400b4d8f33394e2cdef9b66e8369ba2a0f3..e7416bfc9858bde8fc6eb5f3bfc942bc3350953a SKP_VERSION
- //
- // The output should be a \n separated list of hashes that match.
- first, last := tile.CommitRange()
- output, err := g.dir.Git(ctx, "log", "--format=format:%H", first+".."+last, path.Join("infra", "bots", "assets", "skp", "VERSION"))
- if err != nil {
- return nil, fmt.Errorf("SkpCommits: Failed to find git log of SKP_VERSION: %s", err)
- }
- hashes := strings.Split(output, "\n")
-
- ret := []int{}
- for i, c := range tile.Commits {
- if c.CommitTime != 0 && util.In(c.Hash, hashes) {
- ret = append(ret, i)
- }
- }
- return ret, nil
-}
-
-// LastSkpCommit returns the time of the last change to the SKP_VERSION file.
-func (g *GitInfo) LastSkpCommit(ctx context.Context) (time.Time, error) {
- // Executes a git log command that looks like:
- //
- // git log --format=format:%ct -n 1 SKP_VERSION
- //
- // The output should be a single unix timestamp.
- output, err := g.dir.Git(ctx, "log", "--format=format:%ct", "-n", "1", "SKP_VERSION")
- if err != nil {
- return time.Time{}, fmt.Errorf("LastSkpCommit: Failed to read git log: %s", err)
- }
- ts, err := strconv.ParseInt(output, 10, 64)
- if err != nil {
- return time.Time{}, fmt.Errorf("LastSkpCommit: Failed to parse timestamp: %s", err)
- }
- return time.Unix(ts, 0), nil
-}
-
-// TileAddressFromHash takes a commit hash and time, then returns the Level 0
-// tile number that contains the hash, and its position in the tile commit array.
-// This assumes that tiles are built for commits since after the given time.
-func (g *GitInfo) TileAddressFromHash(hash string, start time.Time) (num, offset int, err error) {
- g.mutex.Lock()
- defer g.mutex.Unlock()
- i := 0
- for _, h := range g.hashes {
- if g.timestamps[h].Before(start) {
- continue
- }
- if h == hash {
- return i / tiling.TILE_SIZE, i % tiling.TILE_SIZE, nil
- }
- i++
- }
- return -1, -1, fmt.Errorf("Cannot find hash %s.\n", hash)
-}
-
-// NumCommits returns the number of commits in the repo.
-func (g *GitInfo) NumCommits() int {
- g.mutex.Lock()
- defer g.mutex.Unlock()
- return len(g.hashes)
-}
-
-// RepoMap is a struct used for managing multiple Git repositories.
-type RepoMap struct {
- repos map[string]*GitInfo
- mutex sync.RWMutex
- workdir string
-}
-
-// NewRepoMap creates and returns a RepoMap which operates within the given
-// workdir.
-func NewRepoMap(workdir string) *RepoMap {
- return &RepoMap{
- repos: map[string]*GitInfo{},
- workdir: workdir,
- }
-}
-
-// Repo retrieves a pointer to a GitInfo for the requested repo URL. If the
-// repo does not yet exist in the repoMap, it is cloned and added before it is
-// returned.
-func (m *RepoMap) Repo(ctx context.Context, r string) (*GitInfo, error) {
- m.mutex.Lock()
- defer m.mutex.Unlock()
- repo, ok := m.repos[r]
- if !ok {
- var err error
- split := strings.Split(r, "/")
- repoPath := path.Join(m.workdir, split[len(split)-1])
- repo, err = CloneOrUpdate(ctx, r, repoPath, true)
- if err != nil {
- return nil, fmt.Errorf("Failed to check out %s: %v", r, err)
- }
- m.repos[r] = repo
- }
- return repo, nil
-}
-
-// RepoForCommit attempts to determine which repository the given commit hash
-// belongs to and returns the associated repo URL if found. This is fragile,
-// because it's possible, though very unlikely, that there may be collisions
-// of commit hashes between repositories.
-func (m *RepoMap) RepoForCommit(ctx context.Context, hash string) (string, error) {
- m.mutex.Lock()
- defer m.mutex.Unlock()
-
- for url, r := range m.repos {
- if _, err := r.FullHash(ctx, hash); err == nil {
- return url, nil
- }
- }
- return "", fmt.Errorf("Could not find commit %s in any repo!", hash)
-}
-
-// Update causes all of the repos in the RepoMap to be updated.
-func (m *RepoMap) Update(ctx context.Context) error {
- m.mutex.Lock()
- defer m.mutex.Unlock()
- for _, r := range m.repos {
- if err := r.Update(ctx, true, true); err != nil {
- return err
- }
- }
- return nil
-}
-
-// Repos returns the list of repos contained in the RepoMap.
-func (m *RepoMap) Repos() []string {
- m.mutex.Lock()
- defer m.mutex.Unlock()
- rv := make([]string, 0, len(m.repos))
- for url := range m.repos {
- rv = append(rv, url)
- }
- return rv
-}
-
// Ensure that GitInfo implements vcsinfo.VCS.
var _ vcsinfo.VCS = &GitInfo{}
diff --git a/go/git/gitinfo/gitinfo_test.go b/go/git/gitinfo/gitinfo_test.go
index d39b076..93a8775 100644
--- a/go/git/gitinfo/gitinfo_test.go
+++ b/go/git/gitinfo/gitinfo_test.go
@@ -4,9 +4,9 @@
"context"
"strings"
"testing"
- "time"
"github.com/stretchr/testify/require"
+
"go.skia.org/infra/go/testutils/unittest"
"go.skia.org/infra/go/util"
vcstu "go.skia.org/infra/go/vcsinfo/testutils"
@@ -269,66 +269,6 @@
}
}
-func TestTileAddressFromHash(t *testing.T) {
- unittest.MediumTest(t)
- repoDir, cleanup := vcstu.InitTempRepo()
- defer cleanup()
-
- ctx := context.Background()
- r, err := NewGitInfo(ctx, repoDir, false, false)
- if err != nil {
- t.Fatal(err)
- }
-
- // The two commits in the repo have timestamps of:
- // 1406721715 and 1406721642.
- testCases := []struct {
- hash string
- start time.Time
- num int
- offset int
- }{
- {
- hash: "8652a6df7dc8a7e6addee49f6ed3c2308e36bd18",
- start: time.Unix(1406721642, 0),
- num: 0,
- offset: 1,
- },
- {
- hash: "8652a6df7dc8a7e6addee49f6ed3c2308e36bd18",
- start: time.Unix(1406721643, 0),
- num: 0,
- offset: 0,
- },
- }
-
- for _, tc := range testCases {
- n, o, err := r.TileAddressFromHash(tc.hash, tc.start)
- if err != nil {
- t.Fatal(err)
- }
- if n != tc.num || o != tc.offset {
- t.Errorf("Address unexpected: got (%d, %d), want (%d, %d).", tc.num, tc.offset, n, o)
- }
- }
-}
-
-func TestNumCommits(t *testing.T) {
- unittest.MediumTest(t)
- repoDir, cleanup := vcstu.InitTempRepo()
- defer cleanup()
-
- ctx := context.Background()
- r, err := NewGitInfo(ctx, repoDir, false, false)
- if err != nil {
- t.Fatal(err)
- }
-
- if got, want := r.NumCommits(), 2; got != want {
- t.Errorf("NumCommit wrong number: Got %v Want %v", got, want)
- }
-}
-
func TestRevList(t *testing.T) {
unittest.MediumTest(t)
repoDir, cleanup := vcstu.InitTempRepo()
diff --git a/go/tiling/tiling.go b/go/tiling/tiling.go
index e92c928..c5b54a1 100644
--- a/go/tiling/tiling.go
+++ b/go/tiling/tiling.go
@@ -2,7 +2,6 @@
import (
"net/url"
- "strings"
"go.skia.org/infra/go/skerr"
"go.skia.org/infra/go/util"
@@ -16,20 +15,11 @@
FILL_AFTER
)
-const (
- // TILE_SCALE The number of points to subsample when moving one level of scaling. I.e.
- // a tile at scale 1 will contain every 4th point of the tiles at scale 0.
- TILE_SCALE = 4
-
- // The number of samples per trace in a tile, i.e. the number of git hashes that have data
- // in a single tile.
- TILE_SIZE = 50
-)
-
// Trace represents a single series of measurements. The actual values it
// stores per Commit is defined by implementations of Trace.
type Trace interface {
- // Returns the parameters that describe this trace.
+ // Params returns the parameters (key-value pairs) that describe this trace.
+ // For example, os:Android, gpu:nVidia
Params() map[string]string
// Merge this trace with the given trace. The given trace is expected to come
@@ -42,7 +32,7 @@
// after based on FillType.
Grow(int, FillType)
- // The number of samples in the series.
+ // Len returns the number of samples in the series.
Len() int
// IsMissing returns true if the measurement at index i is a sentinel value,
@@ -55,24 +45,14 @@
// The length on the Trace will then become end-begin.
Trim(begin, end int) error
- // Sets the value of the measurement at index.
+ // SetAt sets the value of the measurement at index.
//
// Each specialization will convert []byte to the correct type.
SetAt(index int, value []byte) error
}
-// TraceBuilder builds an empty trace of the correct kind, either a PerfTrace
-// or a GoldenTrace.
-type TraceBuilder func(n int) Trace
-
-// TraceId helps document when strings should represent TraceIds
-type TraceId string
-
-type TraceIdSlice []TraceId
-
-func (b TraceIdSlice) Len() int { return len(b) }
-func (b TraceIdSlice) Less(i, j int) bool { return string(b[i]) < string(b[j]) }
-func (b TraceIdSlice) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
+// TraceID helps document when strings should represent TraceIds
+type TraceID string
// Matches returns true if the given Trace matches the given query.
func Matches(tr Trace, query url.Values) bool {
@@ -84,46 +64,6 @@
return true
}
-// MatchesWithIgnores returns true if the given Trace matches the given query
-// and none of the ignore queries.
-func MatchesWithIgnores(tr Trace, query url.Values, ignores ...url.Values) bool {
- if !Matches(tr, query) {
- return false
- }
- for _, i := range ignores {
- if Matches(tr, i) {
- return false
- }
- }
- return true
-}
-
-func AsCalculatedID(id string) string {
- if strings.HasPrefix(id, "!") {
- return id
- }
- return "!" + id
-}
-
-func IsCalculatedID(id string) bool {
- return strings.HasPrefix(id, "!")
-}
-
-func AsFormulaID(id string) string {
- if strings.HasPrefix(id, "@") {
- return id
- }
- return "@" + id
-}
-
-func IsFormulaID(id string) bool {
- return strings.HasPrefix(id, "@")
-}
-
-func FormulaFromID(id string) string {
- return id[1:]
-}
-
// Commit is information about each Git commit.
type Commit struct {
// CommitTime is in seconds since the epoch
@@ -147,22 +87,12 @@
return -1, nil
}
-// LastCommitIndex returns the index of the last valid Commit in the given slice of commits.
-func LastCommitIndex(commits []*Commit) int {
- for i := len(commits) - 1; i > 0; i-- {
- if commits[i].CommitTime != 0 {
- return i
- }
- }
- return 0
-}
-
// Tile is a config.TILE_SIZE commit slice of data.
//
// The length of the Commits array is the same length as all of the Values
// arrays in all of the Traces.
type Tile struct {
- Traces map[TraceId]Trace `json:"traces"`
+ Traces map[TraceID]Trace `json:"traces"`
ParamSet map[string][]string `json:"param_set"`
Commits []*Commit `json:"commits"`
@@ -172,34 +102,26 @@
TileIndex int `json:"tileIndex"`
}
-// NewTile returns an new Tile object.
-func NewTile() *Tile {
- t := &Tile{
- Traces: map[TraceId]Trace{},
- ParamSet: map[string][]string{},
- Commits: make([]*Commit, TILE_SIZE, TILE_SIZE),
- }
- for i := range t.Commits {
- t.Commits[i] = &Commit{}
- }
- return t
-}
-
// LastCommitIndex returns the index of the last valid Commit.
func (t Tile) LastCommitIndex() int {
- return LastCommitIndex(t.Commits)
+ for i := len(t.Commits) - 1; i > 0; i-- {
+ if t.Commits[i].CommitTime != 0 {
+ return i
+ }
+ }
+ return 0
}
-// Returns the hashes of the first and last commits in the Tile.
+// CommitRange returns the hashes of the first and last commits in the Tile.
func (t Tile) CommitRange() (string, string) {
return t.Commits[0].Hash, t.Commits[t.LastCommitIndex()].Hash
}
-// Makes a copy of the tile where the Traces and Commits are deep copies and
+// Copy makes a copy of the tile where the Traces and Commits are deep copies and
// all the rest of the data is a shallow copy.
func (t Tile) Copy() *Tile {
ret := &Tile{
- Traces: map[TraceId]Trace{},
+ Traces: map[TraceID]Trace{},
ParamSet: t.ParamSet,
Scale: t.Scale,
TileIndex: t.TileIndex,
@@ -225,7 +147,7 @@
return nil, skerr.Fmt("Invalid Trim range [%d, %d) of [0, %d]", begin, end, length)
}
ret := &Tile{
- Traces: map[TraceId]Trace{},
+ Traces: map[TraceID]Trace{},
ParamSet: t.ParamSet,
Scale: t.Scale,
TileIndex: t.TileIndex,
@@ -246,50 +168,8 @@
return ret, nil
}
-// TraceGUI is used in TileGUI.
-type TraceGUI struct {
- Data [][2]float64 `json:"data"`
- Label string `json:"label"`
- Params map[string]string `json:"_params"`
-}
-
-// TileGUI is the JSON the server serves for tile requests.
-type TileGUI struct {
- ParamSet map[string][]string `json:"paramset,omitempty"`
- Commits []*Commit `json:"commits,omitempty"`
- Scale int `json:"scale"`
- Tiles []int `json:"tiles"`
- Ticks []interface{} `json:"ticks"` // The x-axis tick marks.
- Skps []int `json:"skps"` // The x values where SKPs were regenerated.
-}
-
-func NewTileGUI(scale int, tileIndex int) *TileGUI {
- return &TileGUI{
- ParamSet: make(map[string][]string, 0),
- Commits: make([]*Commit, 0),
- Scale: scale,
- Tiles: []int{tileIndex},
- }
-}
-
-// TileStore is an interface representing the ability to save and restore Tiles.
-type TileStore interface {
- Put(scale, index int, tile *Tile) error
-
- // Get returns the Tile for a given scale and index. Pass in -1 for index to
- // get the last tile for a given scale. Each tile contains its tile index and
- // scale. Get returns (nil, nil) if there is no data in the store yet for that
- // scale and index. The implementation of TileStore can assume that the
- // caller will not modify the tile it returns.
- Get(scale, index int) (*Tile, error)
-
- // GetModifiable behaves identically to Get, except it always returns a
- // copy that can be modified.
- GetModifiable(scale, index int) (*Tile, error)
-}
-
-// Finds the paramSet for the given slice of traces.
-func GetParamSet(traces map[TraceId]Trace, paramSet map[string][]string) {
+// GetParamSet finds the paramSet for the given slice of traces.
+func GetParamSet(traces map[TraceID]Trace, paramSet map[string][]string) {
for _, trace := range traces {
for k, v := range trace.Params() {
if _, ok := paramSet[k]; !ok {
@@ -306,7 +186,7 @@
n := len(tile1.Commits) + len(tile2.Commits)
n1 := len(tile1.Commits)
t := &Tile{
- Traces: make(map[TraceId]Trace),
+ Traces: make(map[TraceID]Trace),
ParamSet: make(map[string][]string),
Commits: make([]*Commit, n, n),
}
@@ -323,7 +203,7 @@
}
// Merge the Traces.
- seen := map[TraceId]bool{}
+ seen := map[TraceID]bool{}
for key, trace := range tile1.Traces {
seen[key] = true
if trace2, ok := tile2.Traces[key]; ok {
diff --git a/go/vcsinfo/bt_vcs/bt_vcs.go b/go/vcsinfo/bt_vcs/bt_vcs.go
index cadf915..545cd58 100644
--- a/go/vcsinfo/bt_vcs/bt_vcs.go
+++ b/go/vcsinfo/bt_vcs/bt_vcs.go
@@ -9,7 +9,6 @@
"sync"
"time"
- "go.skia.org/infra/go/depot_tools"
"go.skia.org/infra/go/gitiles"
"go.skia.org/infra/go/gitstore"
"go.skia.org/infra/go/skerr"
@@ -19,11 +18,9 @@
// BigTableVCS implements the vcsinfo.VCS interface based on a BT-backed GitStore.
type BigTableVCS struct {
- gitStore gitstore.GitStore
- gitiles *gitiles.Repo
- branch string
- secondaryVCS vcsinfo.VCS
- secondaryExtractor depot_tools.DEPSExtractor
+ gitStore gitstore.GitStore
+ gitiles *gitiles.Repo
+ branch string
// This mutex protects detailsCache and indexCommits
mutex sync.RWMutex
@@ -36,7 +33,7 @@
updateMutex sync.Mutex
}
-// NewVCS returns an instance of vcsinfo.VCS that is backed by the given GitStore and uses the
+// New returns an instance of vcsinfo.VCS that is backed by the given GitStore and uses the
// gittiles.Repo to retrieve files. Each instance provides an interface to one branch.
// The instance of gitiles.Repo is only used to fetch files.
func New(ctx context.Context, gitStore gitstore.GitStore, branch string, repo *gitiles.Repo) (*BigTableVCS, error) {
@@ -61,13 +58,6 @@
return b.branch
}
-// SetSecondaryRepo allows to add a secondary repository and extractor to this instance.
-// It is not included in the constructor since it is currently only used by the Gold ingesters.
-func (b *BigTableVCS) SetSecondaryRepo(secVCS vcsinfo.VCS, extractor depot_tools.DEPSExtractor) {
- b.secondaryVCS = secVCS
- b.secondaryExtractor = extractor
-}
-
// Update implements the vcsinfo.VCS interface
func (b *BigTableVCS) Update(ctx context.Context, _, _ bool) error {
b.updateMutex.Lock()
@@ -269,19 +259,6 @@
return buf.String(), nil
}
-// ResolveCommit implements the vcsinfo.VCS interface
-func (b *BigTableVCS) ResolveCommit(ctx context.Context, commitHash string) (string, error) {
- if b.secondaryVCS == nil {
- return "", vcsinfo.NoSecondaryRepo
- }
-
- foundCommit, err := b.secondaryExtractor.ExtractCommit(b.secondaryVCS.GetFile(ctx, "DEPS", commitHash))
- if err != nil {
- return "", err
- }
- return foundCommit, nil
-}
-
// GetGitStore implements the gitstore.GitStoreBased interface
func (b *BigTableVCS) GetGitStore() gitstore.GitStore {
return b.gitStore
diff --git a/go/vcsinfo/mocks/VCS.go b/go/vcsinfo/mocks/VCS.go
index af4478c..6b302f2 100644
--- a/go/vcsinfo/mocks/VCS.go
+++ b/go/vcsinfo/mocks/VCS.go
@@ -101,20 +101,6 @@
return r0
}
-// GetBranch provides a mock function with given fields:
-func (_m *VCS) GetBranch() string {
- ret := _m.Called()
-
- var r0 string
- if rf, ok := ret.Get(0).(func() string); ok {
- r0 = rf()
- } else {
- r0 = ret.Get(0).(string)
- }
-
- return r0
-}
-
// GetFile provides a mock function with given fields: ctx, fileName, commitHash
func (_m *VCS) GetFile(ctx context.Context, fileName string, commitHash string) (string, error) {
ret := _m.Called(ctx, fileName, commitHash)
@@ -189,27 +175,6 @@
return r0
}
-// ResolveCommit provides a mock function with given fields: ctx, commitHash
-func (_m *VCS) ResolveCommit(ctx context.Context, commitHash string) (string, error) {
- ret := _m.Called(ctx, commitHash)
-
- var r0 string
- if rf, ok := ret.Get(0).(func(context.Context, string) string); ok {
- r0 = rf(ctx, commitHash)
- } else {
- r0 = ret.Get(0).(string)
- }
-
- var r1 error
- if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
- r1 = rf(ctx, commitHash)
- } else {
- r1 = ret.Error(1)
- }
-
- return r0, r1
-}
-
// Update provides a mock function with given fields: ctx, pull, allBranches
func (_m *VCS) Update(ctx context.Context, pull bool, allBranches bool) error {
ret := _m.Called(ctx, pull, allBranches)
diff --git a/go/vcsinfo/types.go b/go/vcsinfo/types.go
index 105b059..a3510d6 100644
--- a/go/vcsinfo/types.go
+++ b/go/vcsinfo/types.go
@@ -2,7 +2,6 @@
import (
"context"
- "errors"
"time"
)
@@ -72,8 +71,6 @@
}
func (s IndexCommitSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-var NoSecondaryRepo = errors.New("No secondary repo configured for this vcsinfo")
-
// VCS is a generic interface to the information contained in a version
// control system.
type VCS interface {
@@ -111,12 +108,4 @@
// GetFile returns the content of the given file at the given commit.
GetFile(ctx context.Context, fileName, commitHash string) (string, error)
-
- // ResolveCommit will resolve the given commit against a secondary repo if one
- // was defined with the VCS. Returns vcsinfo.NoSecondaryRepo if there is
- // no secondary repo configured.
- ResolveCommit(ctx context.Context, commitHash string) (string, error)
-
- // GetBranch returns the branch that is tracked by this VCS instance.
- GetBranch() string
}
diff --git a/golden/go/digest_counter/digest_counter.go b/golden/go/digest_counter/digest_counter.go
index 64bff7a..679c05a 100644
--- a/golden/go/digest_counter/digest_counter.go
+++ b/golden/go/digest_counter/digest_counter.go
@@ -23,7 +23,7 @@
ByTest() map[types.TestName]DigestCount
// ByTrace returns a map of trace_id -> DigestCount
- ByTrace() map[tiling.TraceId]DigestCount
+ ByTrace() map[tiling.TraceID]DigestCount
// MaxDigestsByTest returns a map of all tests seen
// in the tile mapped to the digest that showed up
@@ -37,7 +37,7 @@
// Counter implements DigestCounter
type Counter struct {
- traceDigestCount map[tiling.TraceId]DigestCount
+ traceDigestCount map[tiling.TraceID]DigestCount
testDigestCount map[types.TestName]DigestCount
maxCountsByTest map[types.TestName]types.DigestSet
}
@@ -58,7 +58,7 @@
}
// ByTrace implements the DigestCounter interface.
-func (t *Counter) ByTrace() map[tiling.TraceId]DigestCount {
+func (t *Counter) ByTrace() map[tiling.TraceID]DigestCount {
return t.traceDigestCount
}
@@ -74,7 +74,7 @@
}
// countByQuery does the actual work of ByQuery.
-func countByQuery(tile *tiling.Tile, traceDigestCount map[tiling.TraceId]DigestCount, query url.Values) DigestCount {
+func countByQuery(tile *tiling.Tile, traceDigestCount map[tiling.TraceID]DigestCount, query url.Values) DigestCount {
ret := DigestCount{}
for k, tr := range tile.Traces {
if tiling.Matches(tr, query) {
@@ -94,9 +94,9 @@
}
// calculate computes the counts by trace id and test name from the given Tile.
-func calculate(tile *tiling.Tile) (map[tiling.TraceId]DigestCount, map[types.TestName]DigestCount, map[types.TestName]types.DigestSet) {
+func calculate(tile *tiling.Tile) (map[tiling.TraceID]DigestCount, map[types.TestName]DigestCount, map[types.TestName]types.DigestSet) {
defer shared.NewMetricsTimer("digest_counter_calculate").Stop()
- traceDigestCount := map[tiling.TraceId]DigestCount{}
+ traceDigestCount := map[tiling.TraceID]DigestCount{}
testDigestCount := map[types.TestName]DigestCount{}
for k, tr := range tile.Traces {
gtr := tr.(*types.GoldenTrace)
diff --git a/golden/go/digest_counter/digest_counter_test.go b/golden/go/digest_counter/digest_counter_test.go
index f92e093..ae60f9d 100644
--- a/golden/go/digest_counter/digest_counter_test.go
+++ b/golden/go/digest_counter/digest_counter_test.go
@@ -16,7 +16,7 @@
dc := New(tile)
- require.Equal(t, map[tiling.TraceId]DigestCount{
+ require.Equal(t, map[tiling.TraceID]DigestCount{
x86TestAlphaTraceID: {
// FirstDigest showed up twice for this test+config and SecondDigest only once.
FirstDigest: 2,
@@ -121,16 +121,16 @@
BetaTest = types.TestName("test_beta")
// TraceIDs are created like tracestore.TraceIDFromParams
- x86TestAlphaTraceID = tiling.TraceId(",config=x86,source_type=test_alpha,name=gm")
- x64TestAlphaTraceID = tiling.TraceId(",config=x86_64,source_type=test_alpha,name=image")
+ x86TestAlphaTraceID = tiling.TraceID(",config=x86,source_type=test_alpha,name=gm")
+ x64TestAlphaTraceID = tiling.TraceID(",config=x86_64,source_type=test_alpha,name=image")
- x64TestBetaTraceID = tiling.TraceId(",config=x86_64,source_type=test_beta,name=image")
+ x64TestBetaTraceID = tiling.TraceID(",config=x86_64,source_type=test_beta,name=image")
)
func makePartialTileOne() *tiling.Tile {
return &tiling.Tile{
// Commits, Scale and Tile Index omitted (should not affect things)
- Traces: map[tiling.TraceId]tiling.Trace{
+ Traces: map[tiling.TraceID]tiling.Trace{
x86TestAlphaTraceID: &types.GoldenTrace{
Digests: types.DigestSlice{FirstDigest, FirstDigest, SecondDigest},
Keys: map[string]string{
@@ -156,7 +156,7 @@
return &tiling.Tile{
// Commits, Scale and Tile Index omitted (should not affect things)
- Traces: map[tiling.TraceId]tiling.Trace{
+ Traces: map[tiling.TraceID]tiling.Trace{
// Reminder that the ids for the traces are created by concatenating
// all the values in alphabetical order of the keys.
x86TestAlphaTraceID: &types.GoldenTrace{
diff --git a/golden/go/ignore/common.go b/golden/go/ignore/common.go
index e0f4d5c..145c157 100644
--- a/golden/go/ignore/common.go
+++ b/golden/go/ignore/common.go
@@ -11,7 +11,7 @@
func FilterIgnored(inputTile *tiling.Tile, ignores []*Rule) (*tiling.Tile, paramtools.ParamMatcher, error) {
// Make a shallow copy with a new Traces map
ret := &tiling.Tile{
- Traces: map[tiling.TraceId]tiling.Trace{},
+ Traces: map[tiling.TraceID]tiling.Trace{},
ParamSet: inputTile.ParamSet,
Commits: inputTile.Commits,
diff --git a/golden/go/indexer/indexer.go b/golden/go/indexer/indexer.go
index 7f9e29b..34b74f2 100644
--- a/golden/go/indexer/indexer.go
+++ b/golden/go/indexer/indexer.go
@@ -118,7 +118,7 @@
}
// DigestCountsByTrace implements the IndexSearcher interface.
-func (idx *SearchIndex) DigestCountsByTrace(is types.IgnoreState) map[tiling.TraceId]digest_counter.DigestCount {
+func (idx *SearchIndex) DigestCountsByTrace(is types.IgnoreState) map[tiling.TraceID]digest_counter.DigestCount {
return idx.dCounters[is].ByTrace()
}
diff --git a/golden/go/indexer/mocks/IndexSearcher.go b/golden/go/indexer/mocks/IndexSearcher.go
index 6d3009f..5ad6b7c 100644
--- a/golden/go/indexer/mocks/IndexSearcher.go
+++ b/golden/go/indexer/mocks/IndexSearcher.go
@@ -80,15 +80,15 @@
}
// DigestCountsByTrace provides a mock function with given fields: is
-func (_m *IndexSearcher) DigestCountsByTrace(is types.IgnoreState) map[tiling.TraceId]digest_counter.DigestCount {
+func (_m *IndexSearcher) DigestCountsByTrace(is types.IgnoreState) map[tiling.TraceID]digest_counter.DigestCount {
ret := _m.Called(is)
- var r0 map[tiling.TraceId]digest_counter.DigestCount
- if rf, ok := ret.Get(0).(func(types.IgnoreState) map[tiling.TraceId]digest_counter.DigestCount); ok {
+ var r0 map[tiling.TraceID]digest_counter.DigestCount
+ if rf, ok := ret.Get(0).(func(types.IgnoreState) map[tiling.TraceID]digest_counter.DigestCount); ok {
r0 = rf(is)
} else {
if ret.Get(0) != nil {
- r0 = ret.Get(0).(map[tiling.TraceId]digest_counter.DigestCount)
+ r0 = ret.Get(0).(map[tiling.TraceID]digest_counter.DigestCount)
}
}
diff --git a/golden/go/indexer/types.go b/golden/go/indexer/types.go
index 7d59e4e..2e3d4a6 100644
--- a/golden/go/indexer/types.go
+++ b/golden/go/indexer/types.go
@@ -34,7 +34,7 @@
MaxDigestsByTest(is types.IgnoreState) map[types.TestName]types.DigestSet
// DigestCountsByTrace returns the counts of digests grouped by trace id.
- DigestCountsByTrace(is types.IgnoreState) map[tiling.TraceId]digest_counter.DigestCount
+ DigestCountsByTrace(is types.IgnoreState) map[tiling.TraceID]digest_counter.DigestCount
// DigestCountsByQuery returns a DigestCount of all the digests that match the given query.
DigestCountsByQuery(query url.Values, is types.IgnoreState) digest_counter.DigestCount
diff --git a/golden/go/ingestion_processors/common.go b/golden/go/ingestion_processors/common.go
index df12a5d..f2e1e33 100644
--- a/golden/go/ingestion_processors/common.go
+++ b/golden/go/ingestion_processors/common.go
@@ -45,40 +45,21 @@
// target hash is not in the primary repository it will try and find it in the secondary
// repository which has the primary as a dependency.
func getCanonicalCommitHash(ctx context.Context, vcs vcsinfo.VCS, targetHash string) (string, error) {
- // If it is not in the primary repo.
- if !isCommit(ctx, vcs, targetHash) {
- // Extract the commit.
- foundCommit, err := vcs.ResolveCommit(ctx, targetHash)
- if err != nil && err != vcsinfo.NoSecondaryRepo {
- return "", skerr.Wrapf(err, "resolving commit %s in primary or secondary repo", targetHash)
- }
-
- if foundCommit == "" {
- if err == vcsinfo.NoSecondaryRepo {
- sklog.Warningf("Unable to find commit %s in primary repo and no secondary configured", targetHash)
- } else {
- sklog.Warningf("Unable to find commit %s in primary or secondary repo.", targetHash)
- }
- c := vcs.LastNIndex(3)
- if len(c) == 3 {
- sklog.Debugf("Last three commits were %s on %s, %s on %s, and %s on %s",
- c[0].Hash, c[0].Timestamp, c[1].Hash, c[1].Timestamp, c[2].Hash, c[2].Timestamp)
- } else {
- sklog.Debugf("Last commits: %v", c)
- }
-
- return "", ingestion.IgnoreResultsFileErr
- }
-
- // Check if the found commit is actually in the primary repository. This could indicate misconfiguration
- // of the secondary repo.
- if !isCommit(ctx, vcs, foundCommit) {
- return "", skerr.Fmt("Found invalid commit %s in secondary repo at commit %s. Not contained in primary repo.", foundCommit, targetHash)
- }
- sklog.Infof("Commit translation: %s -> %s", targetHash, foundCommit)
- targetHash = foundCommit
+ if isCommit(ctx, vcs, targetHash) {
+ return targetHash, nil
}
- return targetHash, nil
+ // TODO(kjlubick) We need a way to handle secondary repos (probably not something that
+ // clutters the VCS interface). skbug.com/9628
+ sklog.Warningf("Unable to find commit %s in primary repo and no secondary configured", targetHash)
+
+ c := vcs.LastNIndex(3)
+ if len(c) == 3 {
+ sklog.Debugf("Last three commits were %s on %s, %s on %s, and %s on %s",
+ c[0].Hash, c[0].Timestamp, c[1].Hash, c[1].Timestamp, c[2].Hash, c[2].Timestamp)
+ } else {
+ sklog.Debugf("Last commits: %v", c)
+ }
+ return "", ingestion.IgnoreResultsFileErr
}
// isCommit returns true if the given commit is in vcs.
diff --git a/golden/go/ingestion_processors/common_test.go b/golden/go/ingestion_processors/common_test.go
index 56f3a3c..e1e0fda 100644
--- a/golden/go/ingestion_processors/common_test.go
+++ b/golden/go/ingestion_processors/common_test.go
@@ -7,6 +7,10 @@
"testing"
"github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/mock"
+ "github.com/stretchr/testify/require"
+
+ "go.skia.org/infra/go/ingestion"
"go.skia.org/infra/go/testutils"
"go.skia.org/infra/go/testutils/unittest"
"go.skia.org/infra/go/vcsinfo"
@@ -17,7 +21,7 @@
const (
// name of the input file containing test data.
- TEST_INGESTION_FILE = "testdata/dm.json"
+ dmJSONFile = "testdata/dm.json"
)
// Tests parsing and processing of a single file.
@@ -25,11 +29,11 @@
// depend on jsonio.ParseGoldResults which has its own test suite.
func TestDMResults(t *testing.T) {
unittest.SmallTest(t)
- f, err := os.Open(TEST_INGESTION_FILE)
- assert.NoError(t, err)
+ f, err := os.Open(dmJSONFile)
+ require.NoError(t, err)
gr, err := parseGoldResultsFromReader(f)
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.Equal(t, &jsonio.GoldResults{
GitHash: "02cb37309c01506e2552e931efa9c04a569ed266",
@@ -93,7 +97,7 @@
mvs.On("Details", testutils.AnyContext, alphaCommitHash, false).Return(&vcsinfo.LongCommit{}, nil)
c, err := getCanonicalCommitHash(context.Background(), mvs, alphaCommitHash)
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.Equal(t, alphaCommitHash, c)
}
@@ -117,24 +121,6 @@
assert.Equal(t, alphaCommitHash, c)
}
-// TestGetCanonicalCommitHashSecondary tests the case where the commit hash
-// was found in the secondary repo
-func TestGetCanonicalCommitHashSecondary(t *testing.T) {
- unittest.SmallTest(t)
-
- mvs := &mock_vcs.VCS{}
- defer mvs.AssertExpectations(t)
-
- mvs.On("Details", testutils.AnyContext, alphaCommitHash, false).Return(nil, commitNotFound)
- mvs.On("Update", testutils.AnyContext, true, false).Return(nil)
- mvs.On("ResolveCommit", testutils.AnyContext, alphaCommitHash).Return(betaCommitHash, nil)
- mvs.On("Details", testutils.AnyContext, betaCommitHash, false).Return(&vcsinfo.LongCommit{}, nil)
-
- c, err := getCanonicalCommitHash(context.Background(), mvs, alphaCommitHash)
- assert.NoError(t, err)
- assert.Equal(t, betaCommitHash, c)
-}
-
// TestGetCanonicalCommitHashInvalid tests the case where the commit hash
// was resolved to something that didn't exist in the primary repo.
func TestGetCanonicalCommitHashInvalid(t *testing.T) {
@@ -145,12 +131,11 @@
mvs.On("Details", testutils.AnyContext, alphaCommitHash, false).Return(nil, commitNotFound)
mvs.On("Update", testutils.AnyContext, true, false).Return(nil)
- mvs.On("ResolveCommit", testutils.AnyContext, alphaCommitHash).Return(betaCommitHash, nil)
- mvs.On("Details", testutils.AnyContext, betaCommitHash, false).Return(nil, commitNotFound)
+ mvs.On("LastNIndex", mock.Anything).Return(nil, nil)
_, err := getCanonicalCommitHash(context.Background(), mvs, alphaCommitHash)
- assert.Error(t, err)
- assert.Contains(t, err.Error(), "invalid commit")
+ require.Error(t, err)
+ assert.Equal(t, ingestion.IgnoreResultsFileErr, err)
}
const (
diff --git a/golden/go/ingestion_processors/tracestore_impl_test.go b/golden/go/ingestion_processors/tracestore_impl_test.go
index 41e540d..a7457db 100644
--- a/golden/go/ingestion_processors/tracestore_impl_test.go
+++ b/golden/go/ingestion_processors/tracestore_impl_test.go
@@ -82,7 +82,7 @@
mts.On("Put", testutils.AnyContext, testCommitHash, expectedEntries, mock.AnythingOfType("time.Time")).Return(nil)
- fsResult, err := ingestion_mocks.MockResultFileLocationFromFile(TEST_INGESTION_FILE)
+ fsResult, err := ingestion_mocks.MockResultFileLocationFromFile(dmJSONFile)
assert.NoError(t, err)
p := &btProcessor{
diff --git a/golden/go/mocks/DigestCounter.go b/golden/go/mocks/DigestCounter.go
index c9d25d8..4e0a233 100644
--- a/golden/go/mocks/DigestCounter.go
+++ b/golden/go/mocks/DigestCounter.go
@@ -51,15 +51,15 @@
}
// ByTrace provides a mock function with given fields:
-func (_m *DigestCounter) ByTrace() map[tiling.TraceId]digest_counter.DigestCount {
+func (_m *DigestCounter) ByTrace() map[tiling.TraceID]digest_counter.DigestCount {
ret := _m.Called()
- var r0 map[tiling.TraceId]digest_counter.DigestCount
- if rf, ok := ret.Get(0).(func() map[tiling.TraceId]digest_counter.DigestCount); ok {
+ var r0 map[tiling.TraceID]digest_counter.DigestCount
+ if rf, ok := ret.Get(0).(func() map[tiling.TraceID]digest_counter.DigestCount); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
- r0 = ret.Get(0).(map[tiling.TraceId]digest_counter.DigestCount)
+ r0 = ret.Get(0).(map[tiling.TraceID]digest_counter.DigestCount)
}
}
diff --git a/golden/go/paramsets/paramsets.go b/golden/go/paramsets/paramsets.go
index 33cf783..db7eade 100644
--- a/golden/go/paramsets/paramsets.go
+++ b/golden/go/paramsets/paramsets.go
@@ -25,7 +25,7 @@
}
// byTestForTile calculates all the paramsets from the given tile and tallies.
-func byTestForTile(tile *tiling.Tile, digestCountsByTrace map[tiling.TraceId]digest_counter.DigestCount) map[types.TestName]map[types.Digest]paramtools.ParamSet {
+func byTestForTile(tile *tiling.Tile, digestCountsByTrace map[tiling.TraceID]digest_counter.DigestCount) map[types.TestName]map[types.Digest]paramtools.ParamSet {
ret := map[types.TestName]map[types.Digest]paramtools.ParamSet{}
for id, dc := range digestCountsByTrace {
diff --git a/golden/go/paramsets/paramsets_test.go b/golden/go/paramsets/paramsets_test.go
index 03ad627..2df638e 100644
--- a/golden/go/paramsets/paramsets_test.go
+++ b/golden/go/paramsets/paramsets_test.go
@@ -92,7 +92,7 @@
unittest.SmallTest(t)
tile := makePartialTestTile()
- noCounts := map[tiling.TraceId]digest_counter.DigestCount{}
+ noCounts := map[tiling.TraceID]digest_counter.DigestCount{}
md := &mocks.DigestCounter{}
defer md.AssertExpectations(t)
@@ -121,8 +121,8 @@
// These counts include some of the data from the testTile, but
// also some made up data
-func makeTestDigestCounts() map[tiling.TraceId]digest_counter.DigestCount {
- return map[tiling.TraceId]digest_counter.DigestCount{
+func makeTestDigestCounts() map[tiling.TraceID]digest_counter.DigestCount {
+ return map[tiling.TraceID]digest_counter.DigestCount{
"a": {
DigestA: 1,
DigestB: 1,
@@ -156,7 +156,7 @@
func makePartialTestTile() *tiling.Tile {
return &tiling.Tile{
// Commits, Scale and Tile Index omitted (should not affect things)
- Traces: map[tiling.TraceId]tiling.Trace{
+ Traces: map[tiling.TraceID]tiling.Trace{
// These trace ids have been shortened for test terseness.
// A real trace id would be like ",config=8888,source_type=gm,name=foo,"
"a": &types.GoldenTrace{
diff --git a/golden/go/search/digest_table.go b/golden/go/search/digest_table.go
index e477cd6..7aaa147 100644
--- a/golden/go/search/digest_table.go
+++ b/golden/go/search/digest_table.go
@@ -127,7 +127,7 @@
ret := map[types.Digest]paramtools.ParamSet{}
// Add digest/trace to the result.
- addFn := func(test types.TestName, digest types.Digest, traceID tiling.TraceId, trace *types.GoldenTrace, acceptRet interface{}) {
+ addFn := func(test types.TestName, digest types.Digest, traceID tiling.TraceID, trace *types.GoldenTrace, acceptRet interface{}) {
if found, ok := ret[digest]; ok {
found.AddParams(trace.Params())
} else {
@@ -188,13 +188,13 @@
}
return len(matching) > 0, matching
}
- addFn = func(test types.TestName, digest types.Digest, traceID tiling.TraceId, trace *types.GoldenTrace, acceptRet interface{}) {
+ addFn = func(test types.TestName, digest types.Digest, traceID tiling.TraceID, trace *types.GoldenTrace, acceptRet interface{}) {
for _, d := range acceptRet.(types.DigestSlice) {
ret[d][digest] = true
}
}
} else {
- addFn = func(test types.TestName, digest types.Digest, traceID tiling.TraceId, trace *types.GoldenTrace, acceptRet interface{}) {
+ addFn = func(test types.TestName, digest types.Digest, traceID tiling.TraceID, trace *types.GoldenTrace, acceptRet interface{}) {
for d := range condDigests {
ret[d][digest] = true
}
diff --git a/golden/go/search/frontend/types.go b/golden/go/search/frontend/types.go
index 7f3f753..3523be7 100644
--- a/golden/go/search/frontend/types.go
+++ b/golden/go/search/frontend/types.go
@@ -64,7 +64,7 @@
// an array of ints here instead of the whole map.
type Trace struct {
Data []Point `json:"data"` // One Point for each test result.
- ID tiling.TraceId `json:"label"` // The id of the trace. Keep the json as label to be compatible with dots-sk.
+ ID tiling.TraceID `json:"label"` // The id of the trace. Keep the json as label to be compatible with dots-sk.
Params map[string]string `json:"params"`
}
diff --git a/golden/go/search/search.go b/golden/go/search/search.go
index b22625b..480d7eb 100644
--- a/golden/go/search/search.go
+++ b/golden/go/search/search.go
@@ -477,7 +477,7 @@
// Add digest/trace to the result.
ret := srInterMap{}
- addFn := func(test types.TestName, digest types.Digest, traceID tiling.TraceId, trace *types.GoldenTrace, acceptRet interface{}) {
+ addFn := func(test types.TestName, digest types.Digest, traceID tiling.TraceID, trace *types.GoldenTrace, acceptRet interface{}) {
ret.Add(test, digest, traceID, trace, nil)
}
@@ -612,13 +612,15 @@
// getDrawableTraces returns an instance of TraceGroup which allows us
// to draw the traces for the given test/digest.
-func (s *SearchImpl) getDrawableTraces(test types.TestName, digest types.Digest, last int, exp common.ExpSlice, traces map[tiling.TraceId]*types.GoldenTrace) *frontend.TraceGroup {
+func (s *SearchImpl) getDrawableTraces(test types.TestName, digest types.Digest, last int, exp common.ExpSlice, traces map[tiling.TraceID]*types.GoldenTrace) *frontend.TraceGroup {
// Get the information necessary to draw the traces.
- traceIDs := make(tiling.TraceIdSlice, 0, len(traces))
+ traceIDs := make([]tiling.TraceID, 0, len(traces))
for traceID := range traces {
traceIDs = append(traceIDs, traceID)
}
- sort.Sort(traceIDs)
+ sort.Slice(traceIDs, func(i, j int) bool {
+ return traceIDs[i] < traceIDs[j]
+ })
// Get the status for all digests in the traces.
digestStatuses := make([]frontend.DigestStatus, 0, MAX_REF_DIGESTS)
diff --git a/golden/go/search/util.go b/golden/go/search/util.go
index a166fe3..a9e7bf7 100644
--- a/golden/go/search/util.go
+++ b/golden/go/search/util.go
@@ -29,7 +29,7 @@
// AddFn is the callback function used by iterTile to add a digest and it's
// trace to the result. acceptResult is the same value returned by the AcceptFn.
-type AddFn func(test types.TestName, digest types.Digest, traceID tiling.TraceId, trace *types.GoldenTrace, acceptResult interface{})
+type AddFn func(test types.TestName, digest types.Digest, traceID tiling.TraceID, trace *types.GoldenTrace, acceptResult interface{})
// iterTile is a generic function to extract information from a tile.
// It iterates over the tile and filters against the given query. If calls
@@ -144,7 +144,7 @@
// digestsFromTrace returns all the digests in the given trace, controlled by
// 'head', and being robust to tallies not having been calculated for the
// trace.
-func digestsFromTrace(id tiling.TraceId, tr *types.GoldenTrace, head bool, lastCommitIndex int, digestsByTrace map[tiling.TraceId]digest_counter.DigestCount) types.DigestSlice {
+func digestsFromTrace(id tiling.TraceID, tr *types.GoldenTrace, head bool, lastCommitIndex int, digestsByTrace map[tiling.TraceID]digest_counter.DigestCount) types.DigestSlice {
digests := types.DigestSet{}
if head {
// Find the last non-missing value in the trace.
@@ -238,18 +238,18 @@
type srIntermediate struct {
test types.TestName
digest types.Digest
- traces map[tiling.TraceId]*types.GoldenTrace
+ traces map[tiling.TraceID]*types.GoldenTrace
params paramtools.ParamSet
}
// newSrIntermediate creates a new srIntermediate for a digest and adds
// the given trace to it.
-func newSrIntermediate(test types.TestName, digest types.Digest, traceID tiling.TraceId, trace tiling.Trace, pset paramtools.ParamSet) *srIntermediate {
+func newSrIntermediate(test types.TestName, digest types.Digest, traceID tiling.TraceID, trace tiling.Trace, pset paramtools.ParamSet) *srIntermediate {
ret := &srIntermediate{
test: test,
digest: digest,
params: paramtools.ParamSet{},
- traces: map[tiling.TraceId]*types.GoldenTrace{},
+ traces: map[tiling.TraceID]*types.GoldenTrace{},
}
ret.add(traceID, trace, pset)
return ret
@@ -258,7 +258,7 @@
// add adds a new trace to an existing intermediate value for a digest
// found in search. If traceID or trace are "" or nil they will not be added.
// 'params' will always be added to the internal parameter set.
-func (s *srIntermediate) add(traceID tiling.TraceId, trace tiling.Trace, pset paramtools.ParamSet) {
+func (s *srIntermediate) add(traceID tiling.TraceID, trace tiling.Trace, pset paramtools.ParamSet) {
if (traceID != "") && (trace != nil) {
s.traces[traceID] = trace.(*types.GoldenTrace)
s.params.AddParams(trace.Params())
@@ -272,7 +272,7 @@
type srInterMap map[types.TestName]map[types.Digest]*srIntermediate
// Add adds the paramset associated with the given test and digest to the srInterMap instance.
-func (sm srInterMap) Add(test types.TestName, digest types.Digest, traceID tiling.TraceId, trace *types.GoldenTrace, pset paramtools.ParamSet) {
+func (sm srInterMap) Add(test types.TestName, digest types.Digest, traceID tiling.TraceID, trace *types.GoldenTrace, pset paramtools.ParamSet) {
if testMap, ok := sm[test]; !ok {
sm[test] = map[types.Digest]*srIntermediate{digest: newSrIntermediate(test, digest, traceID, trace, pset)}
} else if entry, ok := testMap[digest]; !ok {
@@ -289,7 +289,7 @@
test: test,
digest: digest,
params: paramtools.ParamSet{},
- traces: map[tiling.TraceId]*types.GoldenTrace{},
+ traces: map[tiling.TraceID]*types.GoldenTrace{},
}
ns.params.AddParams(params)
sm[test] = map[types.Digest]*srIntermediate{
@@ -300,7 +300,7 @@
test: test,
digest: digest,
params: paramtools.ParamSet{},
- traces: map[tiling.TraceId]*types.GoldenTrace{},
+ traces: map[tiling.TraceID]*types.GoldenTrace{},
}
ns.params.AddParams(params)
testMap[digest] = ns
diff --git a/golden/go/search/util_test.go b/golden/go/search/util_test.go
index db477d7..e452caa 100644
--- a/golden/go/search/util_test.go
+++ b/golden/go/search/util_test.go
@@ -168,7 +168,7 @@
"param-02": {"val-02"},
"param-03": {"robato"},
},
- traces: map[tiling.TraceId]*types.GoldenTrace{},
+ traces: map[tiling.TraceID]*types.GoldenTrace{},
},
},
testTwo: map[types.Digest]*srIntermediate{
@@ -179,7 +179,7 @@
"param-01": {"gato", "dog"},
"param-03": {"robato"},
},
- traces: map[tiling.TraceId]*types.GoldenTrace{
+ traces: map[tiling.TraceID]*types.GoldenTrace{
"mytrace": &goldTrace,
},
},
diff --git a/golden/go/summary/summary.go b/golden/go/summary/summary.go
index 1912cf7..0b45f64 100644
--- a/golden/go/summary/summary.go
+++ b/golden/go/summary/summary.go
@@ -69,11 +69,11 @@
// Data is a helper struct containing the data that goes into computing a summary.
type Data struct {
- Traces map[tiling.TraceId]tiling.Trace
+ Traces map[tiling.TraceID]tiling.Trace
Expectations expectations.ReadOnly
// ByTrace maps all traces in Trace to the counts of digests that appeared
// in those traces.
- ByTrace map[tiling.TraceId]digest_counter.DigestCount
+ ByTrace map[tiling.TraceID]digest_counter.DigestCount
Blamer blame.Blamer
DiffStore diff.DiffStore // only needed if computeDiameter = true
@@ -162,7 +162,7 @@
// tracePair is used to hold traces, along with their ids.
type tracePair struct {
- id tiling.TraceId
+ id tiling.TraceID
tr *types.GoldenTrace
}
diff --git a/golden/go/summary/summary_test.go b/golden/go/summary/summary_test.go
index 97e0975..b894c41 100644
--- a/golden/go/summary/summary_test.go
+++ b/golden/go/summary/summary_test.go
@@ -349,7 +349,7 @@
Scale: 0, // tile contains every data point.
TileIndex: 0,
- Traces: map[tiling.TraceId]tiling.Trace{
+ Traces: map[tiling.TraceID]tiling.Trace{
",device=alpha,name=test_one,source_type=corpusOne,": types.NewGoldenTrace(
types.DigestSlice{
bug_revert.GoodDigestAlfa, corpusOneUntriaged,
@@ -565,7 +565,7 @@
// makeFullTile returns a tile that matches the description at the top of the file.
func makeFullTile() *tiling.Tile {
return &tiling.Tile{
- Traces: map[tiling.TraceId]tiling.Trace{
+ Traces: map[tiling.TraceID]tiling.Trace{
// These trace ids have been shortened for test terseness.
// A real trace id would be like "8888:gm:test_first"
"a": &types.GoldenTrace{
@@ -630,7 +630,7 @@
// "config=565" applied (which as removed one trace compared to makeFullTile()).
func makeTileWithIgnores() *tiling.Tile {
return &tiling.Tile{
- Traces: map[tiling.TraceId]tiling.Trace{
+ Traces: map[tiling.TraceID]tiling.Trace{
// These trace ids have been shortened for test terseness.
// A real trace id would be like "8888:gm:test_first"
"a": &types.GoldenTrace{
diff --git a/golden/go/testutils/data_bug_revert/bug_revert.go b/golden/go/testutils/data_bug_revert/bug_revert.go
index 8b438b7..6f6db43 100644
--- a/golden/go/testutils/data_bug_revert/bug_revert.go
+++ b/golden/go/testutils/data_bug_revert/bug_revert.go
@@ -79,7 +79,7 @@
Scale: 0, // tile contains every data point.
TileIndex: 0,
- Traces: map[tiling.TraceId]tiling.Trace{
+ Traces: map[tiling.TraceID]tiling.Trace{
",device=alpha,name=test_one,source_type=gm,": types.NewGoldenTrace(
types.DigestSlice{
// A very clear history showing 2nd commit as the change to bravo
diff --git a/golden/go/testutils/data_three_devices/three_devices.go b/golden/go/testutils/data_three_devices/three_devices.go
index 5fb2e13..c09df0f 100644
--- a/golden/go/testutils/data_three_devices/three_devices.go
+++ b/golden/go/testutils/data_three_devices/three_devices.go
@@ -102,7 +102,7 @@
Scale: 0, // tile contains every data point.
TileIndex: 0,
- Traces: map[tiling.TraceId]tiling.Trace{
+ Traces: map[tiling.TraceID]tiling.Trace{
AnglerAlphaTraceID: types.NewGoldenTrace(
types.DigestSlice{AlphaBad1Digest, AlphaBad1Digest, AlphaGood1Digest},
map[string]string{
diff --git a/golden/go/tilesource/tilesource.go b/golden/go/tilesource/tilesource.go
index e79ba4d..331ae10 100644
--- a/golden/go/tilesource/tilesource.go
+++ b/golden/go/tilesource/tilesource.go
@@ -137,7 +137,7 @@
// filter tile.
ret := &tiling.Tile{
- Traces: make(map[tiling.TraceId]tiling.Trace, len(tile.Traces)),
+ Traces: make(map[tiling.TraceID]tiling.Trace, len(tile.Traces)),
Commits: tile.Commits,
}
diff --git a/golden/go/tracestore/bt_tracestore/bt_tracestore.go b/golden/go/tracestore/bt_tracestore/bt_tracestore.go
index 4e76744..b60dddc 100644
--- a/golden/go/tracestore/bt_tracestore/bt_tracestore.go
+++ b/golden/go/tracestore/bt_tracestore/bt_tracestore.go
@@ -168,7 +168,7 @@
rowNames := make([]string, 0, len(entries))
for _, entry := range entries {
- // To save space, traceID isn't the long form tiling.TraceId
+ // To save space, traceID isn't the long form tiling.TraceID
// (e.g. ,foo=bar,baz=gm,), it's a string of key-value numbers
// that refer to the params.(e.g. ,0=3,2=18,)
// See params.paramsEncoder
@@ -349,7 +349,7 @@
continue
}
- // Turn the params into the tiling.TraceId we expect elsewhere.
+ // Turn the params into the tiling.TraceID we expect elsewhere.
traceKey := tracestore.TraceIDFromParams(params)
if _, ok := tileTraces[traceKey]; !ok {
if opts, ok := options[idx][pair.ID]; ok {
diff --git a/golden/go/tracestore/bt_tracestore/types.go b/golden/go/tracestore/bt_tracestore/types.go
index a075d64..a75e010 100644
--- a/golden/go/tracestore/bt_tracestore/types.go
+++ b/golden/go/tracestore/bt_tracestore/types.go
@@ -88,7 +88,7 @@
// tiles come first in sort order.
type tileKey int32
-// encodedTraceID is a shortened form of a tiling.TraceId, e.g. 0=1,1=3,3=0,
+// encodedTraceID is a shortened form of a tiling.TraceID, e.g. 0=1,1=3,3=0,
// Those indices are references to the OrderedParamSet stored in encTile.
// See params.paramsEncoder
type encodedTraceID string
@@ -170,7 +170,7 @@
}
// Define this as a type so we can define some helper functions.
-type traceMap map[tiling.TraceId]tiling.Trace
+type traceMap map[tiling.TraceID]tiling.Trace
// CommitIndicesWithData returns the indexes of the commits with at least one non-missing
// digest in at least one trace. Since the traces always have DefaultTraceSize commits
diff --git a/golden/go/tracestore/bt_tracestore/types_test.go b/golden/go/tracestore/bt_tracestore/types_test.go
index 18d4c41..25fbd09 100644
--- a/golden/go/tracestore/bt_tracestore/types_test.go
+++ b/golden/go/tracestore/bt_tracestore/types_test.go
@@ -216,7 +216,7 @@
}
tm := make(traceMap, numTraces)
for i := 0; i < numTraces; i++ {
- traceID := tiling.TraceId(randomDigest()) // any string should do
+ traceID := tiling.TraceID(randomDigest()) // any string should do
gt := &types.GoldenTrace{
// Keys can be blank for the CommitIndicesWithData bench
Digests: make([]types.Digest, numCommits),
diff --git a/golden/go/tracestore/types.go b/golden/go/tracestore/types.go
index 40a8041..b151481 100644
--- a/golden/go/tracestore/types.go
+++ b/golden/go/tracestore/types.go
@@ -49,18 +49,18 @@
GetDenseTile(ctx context.Context, nCommits int) (*tiling.Tile, []*tiling.Commit, error)
}
-// TraceIDFromParams deterministically returns a TraceId that uniquely encodes
+// TraceIDFromParams deterministically returns a TraceID that uniquely encodes
// the given params. It follows the same convention as perf's trace ids, that
// is something like ",key1=value1,key2=value2,...," where the keys
// are in alphabetical order.
-func TraceIDFromParams(params paramtools.Params) tiling.TraceId {
+func TraceIDFromParams(params paramtools.Params) tiling.TraceID {
// Clean up any params with , or =
params = forceValid(params)
s, err := query.MakeKeyFast(params)
if err != nil {
sklog.Warningf("Invalid params passed in for trace id %#v: %s", params, err)
}
- return tiling.TraceId(s)
+ return tiling.TraceID(s)
}
// clean replaces any special runes (',', '=') in a string such that
diff --git a/golden/go/tracestore/types_test.go b/golden/go/tracestore/types_test.go
index 4fb99ed..fef04d0 100644
--- a/golden/go/tracestore/types_test.go
+++ b/golden/go/tracestore/types_test.go
@@ -20,7 +20,7 @@
types.CORPUS_FIELD: "dm",
}
- expected := tiling.TraceId(",cpu=x86,gpu=nVidia,name=test_alpha,source_type=dm,")
+ expected := tiling.TraceID(",cpu=x86,gpu=nVidia,name=test_alpha,source_type=dm,")
require.Equal(t, expected, TraceIDFromParams(input))
}
@@ -36,7 +36,7 @@
types.CORPUS_FIELD: "dm!",
}
- expected := tiling.TraceId(`,c_p_u="x86",gpu=nVi___dia,name=test_alpha,source_type=dm!,`)
+ expected := tiling.TraceID(`,c_p_u="x86",gpu=nVi___dia,name=test_alpha,source_type=dm!,`)
require.Equal(t, expected, TraceIDFromParams(input))
}
diff --git a/golden/go/types/complex_tile.go b/golden/go/types/complex_tile.go
index ae0c439..9e5e79e 100644
--- a/golden/go/types/complex_tile.go
+++ b/golden/go/types/complex_tile.go
@@ -109,6 +109,6 @@
// Maps aren't the best choice in those cases, so maybe instead of
// handing around a map of TraceID -> Trace we can hand around a []TracePair
type TracePair struct {
- ID tiling.TraceId
+ ID tiling.TraceID
Trace tiling.Trace
}
diff --git a/golden/go/types/types.go b/golden/go/types/types.go
index 6cf4d08..c589d32 100644
--- a/golden/go/types/types.go
+++ b/golden/go/types/types.go
@@ -26,7 +26,7 @@
)
// Strings are used a lot, so these type "aliases" can help document
-// which are meant where. See also tiling.TraceId
+// which are meant where. See also tiling.TraceID
// Of note, Digest exclusively means a unique image, identified by
// the MD5 hash of its pixels.
type Digest string
diff --git a/golden/go/types/types_test.go b/golden/go/types/types_test.go
index e866306..f5c0ed8 100644
--- a/golden/go/types/types_test.go
+++ b/golden/go/types/types_test.go
@@ -127,10 +127,10 @@
const numTraces = 1300000
// When we make the traces in bt_tracestore, we don't know how big they can be, so
// we just start from an empty map
- traces := map[tiling.TraceId]tiling.Trace{}
+ traces := map[tiling.TraceID]tiling.Trace{}
for i := 0; i < numTraces; i++ {
id := randomString()
- traces[tiling.TraceId(id)] = NewEmptyGoldenTrace(10, map[string]string{
+ traces[tiling.TraceID(id)] = NewEmptyGoldenTrace(10, map[string]string{
"alpha_type": "Premul",
"arch": "arm64",
"name": id,
@@ -158,7 +158,7 @@
for i := 0; i < numTraces; i++ {
id := randomString()
traces = append(traces, TracePair{
- ID: tiling.TraceId(id),
+ ID: tiling.TraceID(id),
Trace: NewEmptyGoldenTrace(10, map[string]string{
"alpha_type": "Premul",
"arch": "arm64",