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

Side by Side Diff: common/api/dm/service/v1/graph_data_purge_timestamps.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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package dm
6
7 // TimestampPurger is for testing: invoking this on a struct in this package
dnj (Google) 2016/06/09 18:00:57 I assume you have a good reason for this, so just
iannucci 2016/06/15 00:46:02 There's so much parallelism going on that it's not
8 // will remove all timestamps from it. This is useful for testing where the
9 // timestamps are frequently just noise.
10 type TimestampPurger interface {
11 PurgeTimestamps()
12 }
13
14 // PurgeTimestamps implements TimestampPurger.
15 func (g *GraphData) PurgeTimestamps() {
16 if g == nil {
17 return
18 }
19 for _, q := range g.Quests {
20 q.PurgeTimestamps()
21 }
22 }
23
24 // PurgeTimestamps implements TimestampPurger.
25 func (q *Quest) PurgeTimestamps() {
26 if q == nil {
27 return
28 }
29 q.Data.PurgeTimestamps()
30 for _, a := range q.Attempts {
31 a.PurgeTimestamps()
32 }
33 }
34
35 // PurgeTimestamps implements TimestampPurger.
36 func (qd *Quest_Data) PurgeTimestamps() {
37 if qd == nil {
38 return
39 }
40 qd.Created = nil
41 }
42
43 // PurgeTimestamps implements TimestampPurger.
44 func (a *Attempt) PurgeTimestamps() {
45 if a == nil {
46 return
47 }
48 a.Data.PurgeTimestamps()
49
50 for _, e := range a.Executions {
51 e.PurgeTimestamps()
52 }
53 }
54
55 // PurgeTimestamps implements TimestampPurger.
56 func (ad *Attempt_Data) PurgeTimestamps() {
57 if ad == nil {
58 return
59 }
60 ad.Created = nil
61 ad.Modified = nil
62 if p, _ := ad.AttemptType.(TimestampPurger); p != nil {
63 p.PurgeTimestamps()
64 }
65 }
66
67 // PurgeTimestamps implements TimestampPurger.
68 func (f *Attempt_Data_Finished_) PurgeTimestamps() {
69 if f == nil || f.Finished == nil {
70 return
71 }
72 f.Finished.Expiration = nil
73 }
74
75 // PurgeTimestamps implements TimestampPurger.
76 func (e *Execution) PurgeTimestamps() {
77 if e == nil {
78 return
79 }
80 e.Data.PurgeTimestamps()
81 }
82
83 // PurgeTimestamps implements TimestampPurger.
84 func (ed *Execution_Data) PurgeTimestamps() {
85 if ed == nil {
86 return
87 }
88 ed.Created = nil
89 ed.Modified = nil
90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698