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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « service/taskqueue/taskqueue.go ('k') | no next file » | 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 // This file contains types which are mirrors/duplicates of the upstream SDK 5 // This file contains types which are mirrors/duplicates of the upstream SDK
6 // types. This exists so that users can depend solely on this wrapper library 6 // types. This exists so that users can depend solely on this wrapper library
7 // without necessarially needing an SDK implementation present. 7 // without necessarially needing an SDK implementation present.
8 // 8 //
9 // This was done (instead of type-aliasing from the github version of the SDK) 9 // This was done (instead of type-aliasing from the github version of the SDK)
10 // because some of the types need to be tweaked (like Task.RetryOptions) to 10 // because some of the types need to be tweaked (like Task.RetryOptions) to
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 // The number of times the task has been dispatched or leased. 91 // The number of times the task has been dispatched or leased.
92 RetryCount int32 92 RetryCount int32
93 93
94 // Tag for the task. Only used when Method is PULL. 94 // Tag for the task. Only used when Method is PULL.
95 Tag string 95 Tag string
96 96
97 // Retry options for this task. May be nil. 97 // Retry options for this task. May be nil.
98 RetryOptions *RetryOptions 98 RetryOptions *RetryOptions
99 } 99 }
100
101 func (t *Task) Duplicate() *Task {
102 ret := *t
103
104 if len(t.Header) > 0 {
105 ret.Header = make(http.Header, len(t.Header))
106 for k, vs := range t.Header {
107 newVs := make([]string, len(vs))
108 copy(newVs, vs)
109 ret.Header[k] = newVs
110 }
111 }
112
113 if len(t.Payload) > 0 {
114 ret.Payload = make([]byte, len(t.Payload))
115 copy(ret.Payload, t.Payload)
116 }
117
118 if t.RetryOptions != nil {
119 ret.RetryOptions = &RetryOptions{}
120 *ret.RetryOptions = *t.RetryOptions
121 }
122
123 return &ret
124 }
OLDNEW
« 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