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

Unified Diff: service/taskqueue/types.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 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 c8cde3996c2f3e96d8568ec529a2cc7b15b21f97..7bc6a130432d3738859b8175d262995a1419691e 100644
--- a/service/taskqueue/types.go
+++ b/service/taskqueue/types.go
@@ -97,3 +97,28 @@ type Task struct {
// Retry options for this task. May be nil.
RetryOptions *RetryOptions
}
+
+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