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

Unified Diff: service/taskqueue/types.go

Issue 1890983004: service/taskqueue: Add NewPOSTTask, remove NewTask (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Zero value. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « service/taskqueue/taskqueue.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/taskqueue/types.go
diff --git a/service/taskqueue/types.go b/service/taskqueue/types.go
index 1ce2bf88dcbc6988090795cd98a91ceca2712a5c..c4e492adc40d9893aa5190be02033dac7304ca70 100644
--- a/service/taskqueue/types.go
+++ b/service/taskqueue/types.go
@@ -14,7 +14,6 @@
package taskqueue
import (
- "net/http"
"time"
)
@@ -27,99 +26,3 @@ type Statistics struct {
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.
- // If AgeLimit is also set, both limits must be exceeded for the task to fail permanently.
- RetryLimit int32
-
- // Maximum time allowed since the task's first try before the task fails permanently and is deleted (only for push tasks).
- // If RetryLimit is also set, both limits must be exceeded for the task to fail permanently.
- AgeLimit time.Duration
-
- // Minimum time between successive tries (only for push tasks).
- MinBackoff time.Duration
-
- // Maximum time between successive tries (only for push tasks).
- MaxBackoff time.Duration
-
- // Maximum number of times to double the interval between successive tries before the intervals increase linearly (only for push tasks).
- MaxDoublings int32
-
- // If MaxDoublings is zero, set ApplyZeroMaxDoublings to true to override the default non-zero value.
- // Otherwise a zero MaxDoublings is ignored and the default is used.
- ApplyZeroMaxDoublings bool
-}
-
-// Task represents a taskqueue task to be executed.
-type Task struct {
- // Path is the worker URL for the task.
- // If unset, it will default to /_ah/queue/<queue_name>.
- Path string
-
- // Payload is the data for the task.
- // This will be delivered as the HTTP request body.
- // It is only used when Method is POST, PUT or PULL.
- // url.Values' Encode method may be used to generate this for POST requests.
- Payload []byte
-
- // Additional HTTP headers to pass at the task's execution time.
- // To schedule the task to be run with an alternate app version
- // or backend, set the "Host" header.
- Header http.Header
-
- // Method is the HTTP method for the task ("GET", "POST", etc.),
- // or "PULL" if this is task is destined for a pull-based queue.
- // If empty, this defaults to "POST".
- Method string
-
- // A name for the task.
- // If empty, a name will be chosen.
- Name string
-
- // Delay specifies the duration the task queue service must wait
- // before executing the task.
- // Either Delay or ETA may be set, but not both.
- Delay time.Duration
-
- // ETA specifies the earliest time a task may be executed (push queues)
- // or leased (pull queues).
- // Either Delay or ETA may be set, but not both.
- ETA time.Time
-
- // The number of times the task has been dispatched or leased.
- RetryCount int32
-
- // Tag for the task. Only used when Method is PULL.
- Tag string
-
- // Retry options for this task. May be nil.
- RetryOptions *RetryOptions
-}
-
-// Duplicate returns a deep copy of this Task.
-func (t *Task) Duplicate() *Task {
- ret := *t
-
- if len(t.Header) > 0 {
- ret.Header = make(http.Header, len(t.Header))
- for k, vs := range t.Header {
- newVs := make([]string, len(vs))
- copy(newVs, vs)
- ret.Header[k] = newVs
- }
- }
-
- if len(t.Payload) > 0 {
- ret.Payload = make([]byte, len(t.Payload))
- copy(ret.Payload, t.Payload)
- }
-
- if t.RetryOptions != nil {
- ret.RetryOptions = &RetryOptions{}
- *ret.RetryOptions = *t.RetryOptions
- }
-
- return &ret
-}
« no previous file with comments | « service/taskqueue/taskqueue.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698