@@ -28,7 +28,8 @@ public static async Task<StreamToUriJobPart> ToJobPartAsync(
28
28
jobPartStatus : jobPartStatus ,
29
29
sourceResource : sourceResource ,
30
30
destinationResource : destinationResource ,
31
- partPlanFileExists : true ) . ConfigureAwait ( false ) ;
31
+ partPlanFileExists : true ,
32
+ isFinalPart : header . IsFinalPart ) . ConfigureAwait ( false ) ;
32
33
33
34
// TODO: When enabling resume chunked upload Add each transfer to the CommitChunkHandler
34
35
return jobPart ;
@@ -44,14 +45,15 @@ public static async Task<ServiceToServiceJobPart> ToJobPartAsync(
44
45
JobPartPlanHeader header = JobPartPlanHeader . Deserialize ( planFileStream ) ; ;
45
46
46
47
// Apply credentials to the saved transfer job path
47
- StorageTransferStatus jobPartStatus = ( StorageTransferStatus ) header . AtomicJobStatus ;
48
+ StorageTransferStatus jobPartStatus = header . AtomicJobStatus ;
48
49
ServiceToServiceJobPart jobPart = await ServiceToServiceJobPart . CreateJobPartAsync (
49
50
job : baseJob ,
50
51
partNumber : Convert . ToInt32 ( header . PartNumber ) ,
51
52
jobPartStatus : jobPartStatus ,
52
53
sourceResource : sourceResource ,
53
54
destinationResource : destinationResource ,
54
- partPlanFileExists : true ) . ConfigureAwait ( false ) ;
55
+ partPlanFileExists : true ,
56
+ isFinalPart : header . IsFinalPart ) . ConfigureAwait ( false ) ;
55
57
56
58
// TODO: When enabling resume chunked upload Add each transfer to the CommitChunkHandler
57
59
return jobPart ;
@@ -67,14 +69,15 @@ public static async Task<UriToStreamJobPart> ToJobPartAsync(
67
69
JobPartPlanHeader header = JobPartPlanHeader . Deserialize ( planFileStream ) ; ;
68
70
69
71
// Apply credentials to the saved transfer job path
70
- StorageTransferStatus jobPartStatus = ( StorageTransferStatus ) header . AtomicJobStatus ;
72
+ StorageTransferStatus jobPartStatus = header . AtomicJobStatus ;
71
73
UriToStreamJobPart jobPart = await UriToStreamJobPart . CreateJobPartAsync (
72
74
job : baseJob ,
73
75
partNumber : Convert . ToInt32 ( header . PartNumber ) ,
74
76
jobPartStatus : jobPartStatus ,
75
77
sourceResource : sourceResource ,
76
78
destinationResource : destinationResource ,
77
- partPlanFileExists : true ) . ConfigureAwait ( false ) ;
79
+ partPlanFileExists : true ,
80
+ isFinalPart : header . IsFinalPart ) . ConfigureAwait ( false ) ;
78
81
79
82
// TODO: When enabling resume chunked upload Add each transfer to the CommitChunkHandler
80
83
return jobPart ;
@@ -87,19 +90,22 @@ public static async Task<StreamToUriJobPart> ToJobPartAsync(
87
90
StorageResourceContainer destinationResource )
88
91
{
89
92
// Convert stream to job plan header
90
- JobPartPlanHeader header = JobPartPlanHeader . Deserialize ( planFileStream ) ; ;
93
+ JobPartPlanHeader header = JobPartPlanHeader . Deserialize ( planFileStream ) ;
91
94
92
95
// Apply credentials to the saved transfer job path
93
96
string childSourcePath = header . SourcePath ;
94
- string childDestinationPath = header . SourcePath ;
97
+ string childSourceName = childSourcePath . Substring ( sourceResource . Path . Length + 1 ) ;
98
+ string childDestinationPath = header . DestinationPath ;
99
+ string childDestinationName = childDestinationPath . Substring ( destinationResource . Uri . AbsoluteUri . Length + 1 ) ;
95
100
StorageTransferStatus jobPartStatus = header . AtomicJobStatus ;
96
101
StreamToUriJobPart jobPart = await StreamToUriJobPart . CreateJobPartAsync (
97
102
job : baseJob ,
98
103
partNumber : Convert . ToInt32 ( header . PartNumber ) ,
99
104
jobPartStatus : jobPartStatus ,
100
- sourceResource : sourceResource . GetChildStorageResource ( childSourcePath . Substring ( sourceResource . Path . Length ) ) ,
101
- destinationResource : destinationResource . GetChildStorageResource ( childDestinationPath . Substring ( destinationResource . Path . Length ) ) ,
102
- partPlanFileExists : true ) . ConfigureAwait ( false ) ;
105
+ sourceResource : sourceResource . GetChildStorageResource ( childSourceName ) ,
106
+ destinationResource : destinationResource . GetChildStorageResource ( childDestinationName ) ,
107
+ partPlanFileExists : true ,
108
+ isFinalPart : header . IsFinalPart ) . ConfigureAwait ( false ) ;
103
109
104
110
// TODO: When enabling resume chunked upload Add each transfer to the CommitChunkHandler
105
111
return jobPart ;
@@ -116,15 +122,16 @@ public static async Task<ServiceToServiceJobPart> ToJobPartAsync(
116
122
117
123
// Apply credentials to the saved transfer job path
118
124
string childSourcePath = header . SourcePath ;
119
- string childDestinationPath = header . SourcePath ;
125
+ string childDestinationPath = header . DestinationPath ;
120
126
StorageTransferStatus jobPartStatus = header . AtomicJobStatus ;
121
127
ServiceToServiceJobPart jobPart = await ServiceToServiceJobPart . CreateJobPartAsync (
122
128
job : baseJob ,
123
129
partNumber : Convert . ToInt32 ( header . PartNumber ) ,
124
130
jobPartStatus : jobPartStatus ,
125
- sourceResource : sourceResource . GetChildStorageResource ( childSourcePath . Substring ( sourceResource . Path . Length ) ) ,
126
- destinationResource : destinationResource . GetChildStorageResource ( childDestinationPath . Substring ( destinationResource . Path . Length ) ) ,
127
- partPlanFileExists : true ) . ConfigureAwait ( false ) ;
131
+ sourceResource : sourceResource . GetChildStorageResource ( childSourcePath . Substring ( sourceResource . Uri . AbsoluteUri . Length + 1 ) ) ,
132
+ destinationResource : destinationResource . GetChildStorageResource ( childDestinationPath . Substring ( destinationResource . Uri . AbsoluteUri . Length + 1 ) ) ,
133
+ partPlanFileExists : true ,
134
+ isFinalPart : header . IsFinalPart ) . ConfigureAwait ( false ) ;
128
135
129
136
// TODO: When enabling resume chunked upload Add each transfer to the CommitChunkHandler
130
137
return jobPart ;
@@ -141,15 +148,18 @@ public static async Task<UriToStreamJobPart> ToJobPartAsync(
141
148
142
149
// Apply credentials to the saved transfer job path
143
150
string childSourcePath = header . SourcePath ;
144
- string childDestinationPath = header . SourcePath ;
151
+ string childSourceName = childSourcePath . Substring ( sourceResource . Uri . AbsoluteUri . Length + 1 ) ;
152
+ string childDestinationPath = header . DestinationPath ;
153
+ string childDestinationName = childDestinationPath . Substring ( destinationResource . Path . Length + 1 ) ;
145
154
StorageTransferStatus jobPartStatus = header . AtomicJobStatus ;
146
155
UriToStreamJobPart jobPart = await UriToStreamJobPart . CreateJobPartAsync (
147
156
job : baseJob ,
148
157
partNumber : Convert . ToInt32 ( header . PartNumber ) ,
149
158
jobPartStatus : jobPartStatus ,
150
- sourceResource : sourceResource . GetChildStorageResource ( childSourcePath . Substring ( sourceResource . Path . Length ) ) ,
151
- destinationResource : destinationResource . GetChildStorageResource ( childDestinationPath . Substring ( destinationResource . Path . Length ) ) ,
152
- partPlanFileExists : true ) . ConfigureAwait ( false ) ;
159
+ sourceResource : sourceResource . GetChildStorageResource ( childSourceName ) ,
160
+ destinationResource : destinationResource . GetChildStorageResource ( childDestinationName ) ,
161
+ partPlanFileExists : true ,
162
+ isFinalPart : header . IsFinalPart ) . ConfigureAwait ( false ) ;
153
163
154
164
// TODO: When enabling resume chunked upload Add each transfer to the CommitChunkHandler
155
165
return jobPart ;
@@ -158,7 +168,9 @@ public static async Task<UriToStreamJobPart> ToJobPartAsync(
158
168
/// <summary>
159
169
/// Translate the initial job part header to a job plan format file
160
170
/// </summary>
161
- internal static JobPartPlanHeader ToJobPartPlanHeader ( this JobPartInternal jobPart , StorageTransferStatus jobStatus )
171
+ internal static JobPartPlanHeader ToJobPartPlanHeader ( this JobPartInternal jobPart ,
172
+ StorageTransferStatus jobStatus ,
173
+ bool isFinalPart )
162
174
{
163
175
JobPartPlanDestinationBlob dstBlobData = new JobPartPlanDestinationBlob (
164
176
blobType : JobPlanBlobType . Detect , // TODO: update when supported
@@ -186,11 +198,15 @@ internal static JobPartPlanHeader ToJobPartPlanHeader(this JobPartInternal jobPa
186
198
startTime : DateTimeOffset . UtcNow , // TODO: update to job start time
187
199
transferId : jobPart . _dataTransfer . Id ,
188
200
partNumber : ( uint ) jobPart . PartNumber ,
189
- sourcePath : jobPart . _sourceResource . Path ,
201
+ sourcePath : jobPart . _sourceResource . CanProduceUri == ProduceUriType . ProducesUri ?
202
+ jobPart . _sourceResource . Uri . AbsoluteUri :
203
+ jobPart . _sourceResource . Path ,
190
204
sourceExtraQuery : "" , // TODO: convert options to string
191
- destinationPath : jobPart . _destinationResource . Path ,
205
+ destinationPath : jobPart . _destinationResource . CanProduceUri == ProduceUriType . ProducesUri ?
206
+ jobPart . _destinationResource . Uri . AbsoluteUri :
207
+ jobPart . _destinationResource . Path ,
192
208
destinationExtraQuery : "" , // TODO: convert options to string
193
- isFinalPart : false , // TODO: change but we might remove this param
209
+ isFinalPart : isFinalPart ,
194
210
forceWrite : jobPart . _createMode == StorageResourceCreateMode . Overwrite , // TODO: change to enum value
195
211
forceIfReadOnly : false , // TODO: revisit for Azure Files
196
212
autoDecompress : false , // TODO: revisit if we want to support this feature
0 commit comments