| 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 taskqueue | 5 package taskqueue |
| 6 | 6 |
| 7 import "time" |
| 8 |
| 7 // RawCB is a simple callback for RawInterface.DeleteMulti, getting the error | 9 // RawCB is a simple callback for RawInterface.DeleteMulti, getting the error |
| 8 // for the attempted deletion. | 10 // for the attempted deletion. |
| 9 type RawCB func(error) | 11 type RawCB func(error) |
| 10 | 12 |
| 11 // RawTaskCB is the callback for RawInterface.AddMulti, getting the added task | 13 // RawTaskCB is the callback for RawInterface.AddMulti, getting the added task |
| 12 // and an error. | 14 // and an error. |
| 13 type RawTaskCB func(*Task, error) | 15 type RawTaskCB func(*Task, error) |
| 14 | 16 |
| 15 // RawStatsCB is the callback for RawInterface.Stats. It takes the statistics | 17 // RawStatsCB is the callback for RawInterface.Stats. It takes the statistics |
| 16 // object, as well as an error (e.g. in case the queue doesn't exist). | 18 // object, as well as an error (e.g. in case the queue doesn't exist). |
| 17 type RawStatsCB func(*Statistics, error) | 19 type RawStatsCB func(*Statistics, error) |
| 18 | 20 |
| 19 // RawInterface is the full interface to the Task Queue service. | 21 // RawInterface is the full interface to the Task Queue service. |
| 20 type RawInterface interface { | 22 type RawInterface interface { |
| 21 // AddMulti adds multiple tasks to the given queue, calling cb for each
item. | 23 // AddMulti adds multiple tasks to the given queue, calling cb for each
item. |
| 22 // | 24 // |
| 23 // The task passed to the callback function will have all the default va
lues | 25 // The task passed to the callback function will have all the default va
lues |
| 24 // filled in, and will have the Name field populated, if the input task
was | 26 // filled in, and will have the Name field populated, if the input task
was |
| 25 // anonymous (e.g. the Name field was blank). | 27 // anonymous (e.g. the Name field was blank). |
| 26 AddMulti(tasks []*Task, queueName string, cb RawTaskCB) error | 28 AddMulti(tasks []*Task, queueName string, cb RawTaskCB) error |
| 27 DeleteMulti(tasks []*Task, queueName string, cb RawCB) error | 29 DeleteMulti(tasks []*Task, queueName string, cb RawCB) error |
| 28 | 30 |
| 31 Lease(maxTasks int, queueName string, leaseTime time.Duration) ([]*Task,
error) |
| 32 LeaseByTag(maxTasks int, queueName string, leaseTime time.Duration, tag
string) ([]*Task, error) |
| 33 ModifyLease(task *Task, queueName string, leaseTime time.Duration) error |
| 34 |
| 29 Purge(queueName string) error | 35 Purge(queueName string) error |
| 30 | 36 |
| 31 Stats(queueNames []string, cb RawStatsCB) error | 37 Stats(queueNames []string, cb RawStatsCB) error |
| 32 | 38 |
| 33 GetTestable() Testable | 39 GetTestable() Testable |
| 34 } | 40 } |
| OLD | NEW |