| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 backend | |
| 6 | |
| 7 import ( | |
| 8 "github.com/julienschmidt/httprouter" | |
| 9 "github.com/luci/luci-go/appengine/gaemiddleware" | |
| 10 "github.com/luci/luci-go/server/middleware" | |
| 11 ) | |
| 12 | |
| 13 const ( | |
| 14 // defaultMultiTaskBatchSize is the default value for Backend's | |
| 15 // multiTaskBatchSize parameter. | |
| 16 defaultMultiTaskBatchSize = 100 | |
| 17 ) | |
| 18 | |
| 19 // Backend is the base struct for all Backend handlers. It is mostly used to | |
| 20 // configure testing parameters. | |
| 21 type Backend struct { | |
| 22 // multiTaskBatchSize is the number of batch tasks to create at a time. | |
| 23 multiTaskBatchSize int | |
| 24 } | |
| 25 | |
| 26 func (b *Backend) getMultiTaskBatchSize() int { | |
| 27 if v := b.multiTaskBatchSize; v > 0 { | |
| 28 return v | |
| 29 } | |
| 30 return defaultMultiTaskBatchSize | |
| 31 } | |
| 32 | |
| 33 // InstallHandlers installs handlers for the Backend. | |
| 34 func (b *Backend) InstallHandlers(r *httprouter.Router, h middleware.Base) { | |
| 35 r.GET("/archive/cron", h(gaemiddleware.RequireCron(b.HandleArchiveCron))
) | |
| 36 } | |
| OLD | NEW |