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 services | 5 package services |
6 | 6 |
7 import ( | 7 import ( |
8 "crypto/subtle" | 8 "crypto/subtle" |
9 | 9 |
10 ds "github.com/luci/gae/service/datastore" | 10 ds "github.com/luci/gae/service/datastore" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 cat := mutations.CreateArchiveTask{ | 110 cat := mutations.CreateArchiveTask{ |
111 ID: id, | 111 ID: id, |
112 | 112 |
113 // Optimistic parameters. | 113 // Optimistic parameters. |
114 SettleDelay: params.SettleDelay, | 114 SettleDelay: params.SettleDelay, |
115 CompletePeriod: params.CompletePeriod, | 115 CompletePeriod: params.CompletePeriod, |
116 | 116 |
117 // Schedule this mutation to execute after our s
ettle delay. | 117 // Schedule this mutation to execute after our s
ettle delay. |
118 Expiration: now.Add(params.SettleDelay), | 118 Expiration: now.Add(params.SettleDelay), |
119 } | 119 } |
120 » » » aeParent, aeName := cat.TaskName(c) | 120 |
| 121 » » » aeParent, aeName := ds.KeyForObj(c, lst), cat.TaskName(c
) |
121 if err := tumble.PutNamedMutations(c, aeParent, map[stri
ng]tumble.Mutation{aeName: &cat}); err != nil { | 122 if err := tumble.PutNamedMutations(c, aeParent, map[stri
ng]tumble.Mutation{aeName: &cat}); err != nil { |
122 log.WithError(err).Errorf(c, "Failed to replace
archive expiration mutation.") | 123 log.WithError(err).Errorf(c, "Failed to replace
archive expiration mutation.") |
123 return grpcutil.Internal | 124 return grpcutil.Internal |
124 } | 125 } |
125 | 126 |
126 log.Fields{ | 127 log.Fields{ |
127 "terminalIndex": lst.TerminalIndex, | 128 "terminalIndex": lst.TerminalIndex, |
128 "settleDelay": cat.SettleDelay, | 129 "settleDelay": cat.SettleDelay, |
129 "completePeriod": cat.CompletePeriod, | 130 "completePeriod": cat.CompletePeriod, |
130 "scheduledAt": cat.Expiration, | 131 "scheduledAt": cat.Expiration, |
(...skipping 10 matching lines...) Expand all Loading... |
141 | 142 |
142 return &google.Empty{}, nil | 143 return &google.Empty{}, nil |
143 } | 144 } |
144 | 145 |
145 func standardArchivalParams(cfg *config.Config, pcfg *svcconfig.ProjectConfig) *
coordinator.ArchivalParams { | 146 func standardArchivalParams(cfg *config.Config, pcfg *svcconfig.ProjectConfig) *
coordinator.ArchivalParams { |
146 return &coordinator.ArchivalParams{ | 147 return &coordinator.ArchivalParams{ |
147 SettleDelay: cfg.Coordinator.ArchiveSettleDelay.Duration(), | 148 SettleDelay: cfg.Coordinator.ArchiveSettleDelay.Duration(), |
148 CompletePeriod: endpoints.MinDuration(cfg.Coordinator.ArchiveDel
ayMax, pcfg.MaxStreamAge), | 149 CompletePeriod: endpoints.MinDuration(cfg.Coordinator.ArchiveDel
ayMax, pcfg.MaxStreamAge), |
149 } | 150 } |
150 } | 151 } |
OLD | NEW |