| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 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 mutations | 5 package mutations |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "time" | 9 "time" |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return ds.KeyForObj(c, m.logStream()) | 95 return ds.KeyForObj(c, m.logStream()) |
| 96 } | 96 } |
| 97 | 97 |
| 98 // ProcessAfter implements tumble.DelayedMutation. | 98 // ProcessAfter implements tumble.DelayedMutation. |
| 99 func (m *CreateArchiveTask) ProcessAfter() time.Time { return m.Expiration } | 99 func (m *CreateArchiveTask) ProcessAfter() time.Time { return m.Expiration } |
| 100 | 100 |
| 101 // HighPriority implements tumble.DelayedMutation. | 101 // HighPriority implements tumble.DelayedMutation. |
| 102 func (m *CreateArchiveTask) HighPriority() bool { return false } | 102 func (m *CreateArchiveTask) HighPriority() bool { return false } |
| 103 | 103 |
| 104 // TaskName returns the task's name, which is derived from its log stream ID. | 104 // TaskName returns the task's name, which is derived from its log stream ID. |
| 105 func (m *CreateArchiveTask) TaskName(c context.Context) (*ds.Key, string) { | 105 func (m *CreateArchiveTask) TaskName(c context.Context) string { |
| 106 » return ds.KeyForObj(c, m.logStream()), fmt.Sprintf("archive-expired-%s",
m.ID) | 106 » return fmt.Sprintf("archive-expired-%s", m.ID) |
| 107 } | 107 } |
| 108 | 108 |
| 109 // logStream returns the log stream associated with this task. | 109 // logStream returns the log stream associated with this task. |
| 110 func (m *CreateArchiveTask) logStream() *coordinator.LogStream { | 110 func (m *CreateArchiveTask) logStream() *coordinator.LogStream { |
| 111 return &coordinator.LogStream{ | 111 return &coordinator.LogStream{ |
| 112 ID: m.ID, | 112 ID: m.ID, |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 func init() { | 116 func init() { |
| 117 tumble.Register((*CreateArchiveTask)(nil)) | 117 tumble.Register((*CreateArchiveTask)(nil)) |
| 118 } | 118 } |
| OLD | NEW |