MCPcopy Index your code
hub / github.com/coder/coder / Get

Method Get

coderd/schedule/template.go:169–201  ·  view source on GitHub ↗
(ctx context.Context, db database.Store, templateID uuid.UUID)

Source from the content-addressed store, hash-verified

167}
168
169func (*agplTemplateScheduleStore) Get(ctx context.Context, db database.Store, templateID uuid.UUID) (TemplateScheduleOptions, error) {
170 ctx, span := tracing.StartSpan(ctx)
171 defer span.End()
172
173 tpl, err := db.GetTemplateByID(ctx, templateID)
174 if err != nil {
175 return TemplateScheduleOptions{}, err
176 }
177
178 return TemplateScheduleOptions{
179 // Disregard the values in the database, since user scheduling is an
180 // enterprise feature.
181 UserAutostartEnabled: true,
182 UserAutostopEnabled: true,
183 DefaultTTL: time.Duration(tpl.DefaultTTL),
184 ActivityBump: time.Duration(tpl.ActivityBump),
185 // Disregard the values in the database, since AutostopRequirement,
186 // FailureTTL, TimeTilDormant, and TimeTilDormantAutoDelete are enterprise features.
187 AutostartRequirement: TemplateAutostartRequirement{
188 // Default to allowing all days for AGPL
189 DaysOfWeek: 0b01111111,
190 },
191 AutostopRequirement: TemplateAutostopRequirement{
192 // No days means never. The weeks value should always be greater
193 // than zero though.
194 DaysOfWeek: 0,
195 Weeks: 1,
196 },
197 FailureTTL: 0,
198 TimeTilDormant: 0,
199 TimeTilDormantAutoDelete: 0,
200 }, nil
201}
202
203func (*agplTemplateScheduleStore) Set(ctx context.Context, db database.Store, tpl database.Template, opts TemplateScheduleOptions) (database.Template, error) {
204 ctx, span := tracing.StartSpan(ctx)

Callers

nothing calls this directly

Calls 3

StartSpanFunction · 0.92
DurationMethod · 0.80
GetTemplateByIDMethod · 0.65

Tested by

no test coverage detected