// updateIfNewer incorporates the results of trybot runs into this results // if they are newer. func (t *TryBotResults) updateIfNewer(tries *TryBotResults) (bool, int64) { updated := false var latestPatchset int64 = 0 for key, entry := range tries.Bots { found, ok := t.Bots[key] if !ok || (found.TS < entry.TS) { latestPatchset = util.MaxInt64(latestPatchset, entry.Patchset) t.Bots[key] = entry updated = true } } return updated, latestPatchset }
func (h *historian) processTile(tile *tiling.Tile) error { dStore := h.storages.DigestStore tileLen := tile.LastCommitIndex() + 1 var digestInfo *digeststore.DigestInfo var ok bool counter := 0 minMaxTimes := map[string]map[string]*digeststore.DigestInfo{} for _, trace := range tile.Traces { gTrace := trace.(*types.GoldenTrace) testName := trace.Params()[types.PRIMARY_KEY_FIELD] for idx, digest := range gTrace.Values[:tileLen] { if digest != types.MISSING_DIGEST { timeStamp := tile.Commits[idx].CommitTime if digestInfo, ok = minMaxTimes[testName][digest]; !ok { digestInfo = &digeststore.DigestInfo{ TestName: testName, Digest: digest, First: timeStamp, Last: timeStamp, } if testVal, ok := minMaxTimes[testName]; !ok { minMaxTimes[testName] = map[string]*digeststore.DigestInfo{digest: digestInfo} } else { testVal[digest] = digestInfo } counter++ } else { digestInfo.First = util.MinInt64(digestInfo.First, timeStamp) digestInfo.Last = util.MaxInt64(digestInfo.Last, timeStamp) } } } } digestInfos := make([]*digeststore.DigestInfo, 0, counter) for _, digests := range minMaxTimes { for _, digestInfo := range digests { digestInfos = append(digestInfos, digestInfo) } } return dStore.Update(digestInfos) }