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

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: 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
« service/taskqueue/taskqueue.go ('K') | « 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..1ef481c73bd88a46f0801739360f915ad1d6ebf7 100644
--- a/service/taskqueue/types.go
+++ b/service/taskqueue/types.go
@@ -97,3 +97,29 @@ type Task struct {
// Retry options for this task. May be nil.
RetryOptions *RetryOptions
}
+
+func (t *Task) Duplicate() *Task {
+ ret := &Task{}
dnj 2015/08/03 22:37:26 ret := *t ... return &ret
iannucci 2015/08/04 01:21:21 Done.
+ *ret = *t
+
+ if t.Header != nil {
dnj 2015/08/03 22:37:25 len(t.Header) > 0
iannucci 2015/08/04 01:21:21 Done.
+ 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 t.Payload != nil {
dnj 2015/08/03 22:37:26 len(t.Payload) > 0
iannucci 2015/08/04 01:21:21 Done.
+ 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
+}
« service/taskqueue/taskqueue.go ('K') | « service/taskqueue/taskqueue.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698