| Index: service/taskqueue/task.go
|
| diff --git a/service/taskqueue/types.go b/service/taskqueue/task.go
|
| similarity index 78%
|
| copy from service/taskqueue/types.go
|
| copy to service/taskqueue/task.go
|
| index 1ce2bf88dcbc6988090795cd98a91ceca2712a5c..c24c2a6ee4f8198f2f164ccda500028dd80d3d84 100644
|
| --- a/service/taskqueue/types.go
|
| +++ b/service/taskqueue/task.go
|
| @@ -2,32 +2,14 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// This file contains types which are mirrors/duplicates of the upstream SDK
|
| -// types. This exists so that users can depend solely on this wrapper library
|
| -// without necessarially needing an SDK implementation present.
|
| -//
|
| -// This was done (instead of type-aliasing from the github version of the SDK)
|
| -// because some of the types need to be tweaked (like Task.RetryOptions) to
|
| -// interact well with the wrapper, and the inconsistency of having some types
|
| -// defined by the gae package and others defined by the SDK was pretty awkward.
|
| -
|
| package taskqueue
|
|
|
| import (
|
| "net/http"
|
| + "net/url"
|
| "time"
|
| )
|
|
|
| -// Statistics represents statistics about a single task queue.
|
| -type Statistics struct {
|
| - Tasks int // may be an approximation
|
| - OldestETA time.Time // zero if there are no pending tasks
|
| -
|
| - Executed1Minute int // tasks executed in the last minute
|
| - InFlight int // tasks executing now
|
| - EnforcedRate float64 // requests per second
|
| -}
|
| -
|
| // RetryOptions let you control whether to retry a task and the backoff intervals between tries.
|
| type RetryOptions struct {
|
| // Number of tries/leases after which the task fails permanently and is deleted.
|
| @@ -98,6 +80,18 @@ type Task struct {
|
| RetryOptions *RetryOptions
|
| }
|
|
|
| +// NewPOSTTask creates a Task that will POST to a path with URL-encoded values.
|
| +func NewPOSTTask(path string, params url.Values) *Task {
|
| + h := make(http.Header)
|
| + h.Set("Content-Type", "application/x-www-form-urlencoded")
|
| + return &Task{
|
| + Path: path,
|
| + Payload: []byte(params.Encode()),
|
| + Header: h,
|
| + Method: "POST",
|
| + }
|
| +}
|
| +
|
| // Duplicate returns a deep copy of this Task.
|
| func (t *Task) Duplicate() *Task {
|
| ret := *t
|
|
|