Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: service/taskqueue/interface.go

Issue 1270063003: Make the rest of the services have a similar raw/user interface structure. (Closed) Base URL: https://github.com/luci/gae.git@add_datastore
Patch Set: address comments Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « service/taskqueue/context.go ('k') | service/taskqueue/raw_interface.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package taskqueue 5 package taskqueue
6 6
7 // Interface is the full interface to the Task Queue service. 7 // Interface is the full interface to the Task Queue service.
8 type Interface interface { 8 type Interface interface {
9 » Add(task *Task, queueName string) (*Task, error) 9 » // NewTask simply creates a new Task object with the Path field populate d.
10 » // The path parameter may be blank, if you want to use the default task path
11 » // ("/_ah/queue/<queuename>").
12 » NewTask(path string) *Task
13
14 » Add(task *Task, queueName string) error
10 Delete(task *Task, queueName string) error 15 Delete(task *Task, queueName string) error
11 16
12 » AddMulti(tasks []*Task, queueName string) ([]*Task, error) 17 » AddMulti(tasks []*Task, queueName string) error
13 DeleteMulti(tasks []*Task, queueName string) error 18 DeleteMulti(tasks []*Task, queueName string) error
14 19
15 » Lease(maxTasks int, queueName string, leaseTime int) ([]*Task, error) 20 » // NOTE(riannucci): No support for pull taskqueues. We're not planning o n
16 » LeaseByTag(maxTasks int, queueName string, leaseTime int, tag string) ([ ]*Task, error) 21 » // making pull-queue clients which RUN in appengine (e.g. they'd all be
17 » ModifyLease(task *Task, queueName string, leaseTime int) error 22 » // external REST consumers). If someone needs this, it will need to be a dded
23 » // here and in RawInterface. The theory is that a good lease API might l ook
24 » // like:
25 » //
26 » // func Lease(queueName, tag string, batchSize int, duration time.Time , cb func(*Task, error<-))
27 » //
28 » // Which blocks and calls cb for each task obtained. Lease would then do all
29 » // necessary backoff negotiation with the backend. The callback could ex ecute
30 » // synchronously (stuffing an error into the chan or panicing if it fail s), or
31 » // asynchronously (dispatching a goroutine which will then populate the error
32 » // channel if needed). If it operates asynchronously, it has the option of
33 » // processing multiple work items at a time.
34 » //
35 » // Lease would also take care of calling ModifyLease as necessary to ens ure
36 » // that each call to cb would have 'duration' amount of time to work on the
37 » // task, as well as releasing as many leased tasks as it can on a failur e.
18 38
19 Purge(queueName string) error 39 Purge(queueName string) error
20 40
21 » QueueStats(queueNames []string) ([]Statistics, error) 41 » Stats(queueNames ...string) ([]Statistics, error)
42
43 » Raw() RawInterface
22 } 44 }
OLDNEW
« no previous file with comments | « service/taskqueue/context.go ('k') | service/taskqueue/raw_interface.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698