Skip to content

Commit b203feb

Browse files
Merge transferjobinternal (Azure#46540)
* setup of base method * erase old impls * remove child types
1 parent 401d052 commit b203feb

13 files changed

+352
-924
lines changed

sdk/storage/Azure.Storage.DataMovement.Blobs/tests/BlobContainerServiceToServiceJobTests.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ await checkpointer.AddNewJobAsync(
110110
It.IsAny<StorageResourceContainer>(),
111111
It.IsAny<CancellationToken>()))
112112
.Returns(GetStorageResourceItemsAsyncEnumerable(blobItems));
113-
ServiceToServiceTransferJob transferJob = new ServiceToServiceTransferJob(
113+
TransferJobInternal transferJob = new(
114114
new DataTransfer(id: transferId),
115115
sourceMock.Object,
116116
destinationMock.Object,
117+
ServiceToServiceJobPart.CreateJobPartAsync,
118+
ServiceToServiceJobPart.CreateJobPartAsync,
117119
new DataTransferOptions(),
118120
checkpointer,
119121
DataTransferErrorMode.StopOnAnyFailure,
@@ -164,10 +166,12 @@ await checkpointer.AddNewJobAsync(
164166
It.IsAny<StorageResourceContainer>(),
165167
It.IsAny<CancellationToken>()))
166168
.Returns(GetStorageResourceItemsAsyncEnumerable(blobItems));
167-
ServiceToServiceTransferJob transferJob = new ServiceToServiceTransferJob(
169+
TransferJobInternal transferJob = new(
168170
new DataTransfer(id: transferId),
169171
sourceMock.Object,
170172
destinationMock.Object,
173+
ServiceToServiceJobPart.CreateJobPartAsync,
174+
ServiceToServiceJobPart.CreateJobPartAsync,
171175
new DataTransferOptions(),
172176
checkpointer,
173177
DataTransferErrorMode.StopOnAnyFailure,

sdk/storage/Azure.Storage.DataMovement/src/JobBuilder.cs

Lines changed: 102 additions & 217 deletions
Large diffs are not rendered by default.

sdk/storage/Azure.Storage.DataMovement/src/ServiceToServiceJobPart.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal class ServiceToServiceJobPart : JobPartInternal, IDisposable
2424
/// <summary>
2525
/// Creating job part based on a single transfer job
2626
/// </summary>
27-
private ServiceToServiceJobPart(ServiceToServiceTransferJob job, int partNumber)
27+
private ServiceToServiceJobPart(TransferJobInternal job, int partNumber)
2828
: base(dataTransfer: job._dataTransfer,
2929
partNumber: partNumber,
3030
sourceResource: job._sourceResource,
@@ -50,7 +50,7 @@ private ServiceToServiceJobPart(ServiceToServiceTransferJob job, int partNumber)
5050
/// Creating transfer job based on a storage resource created from listing.
5151
/// </summary>
5252
private ServiceToServiceJobPart(
53-
ServiceToServiceTransferJob job,
53+
TransferJobInternal job,
5454
int partNumber,
5555
StorageResourceItem sourceResource,
5656
StorageResourceItem destinationResource,
@@ -82,7 +82,7 @@ private ServiceToServiceJobPart(
8282
/// Creating transfer job based on a checkpoint file.
8383
/// </summary>
8484
private ServiceToServiceJobPart(
85-
ServiceToServiceTransferJob job,
85+
TransferJobInternal job,
8686
int partNumber,
8787
StorageResourceItem sourceResource,
8888
StorageResourceItem destinationResource,
@@ -121,8 +121,8 @@ public void Dispose()
121121
/// <summary>
122122
/// Called when creating a job part from a single transfer.
123123
/// </summary>
124-
public static async Task<ServiceToServiceJobPart> CreateJobPartAsync(
125-
ServiceToServiceTransferJob job,
124+
public static async Task<JobPartInternal> CreateJobPartAsync(
125+
TransferJobInternal job,
126126
int partNumber)
127127
{
128128
// Create Job Part file as we're initializing the job part
@@ -134,12 +134,11 @@ public static async Task<ServiceToServiceJobPart> CreateJobPartAsync(
134134
/// <summary>
135135
/// Called when creating a job part from a container transfer.
136136
/// </summary>
137-
public static async Task<ServiceToServiceJobPart> CreateJobPartAsync(
138-
ServiceToServiceTransferJob job,
137+
public static async Task<JobPartInternal> CreateJobPartAsync(
138+
TransferJobInternal job,
139139
int partNumber,
140140
StorageResourceItem sourceResource,
141-
StorageResourceItem destinationResource,
142-
long? length = default)
141+
StorageResourceItem destinationResource)
143142
{
144143
Argument.AssertNotNull(sourceResource, nameof(sourceResource));
145144
Argument.AssertNotNull(destinationResource, nameof(destinationResource));
@@ -149,8 +148,7 @@ public static async Task<ServiceToServiceJobPart> CreateJobPartAsync(
149148
job: job,
150149
partNumber: partNumber,
151150
sourceResource: sourceResource,
152-
destinationResource: destinationResource,
153-
length: length);
151+
destinationResource: destinationResource);
154152
await part.AddJobPartToCheckpointerAsync().ConfigureAwait(false);
155153
return part;
156154
}
@@ -159,7 +157,7 @@ public static async Task<ServiceToServiceJobPart> CreateJobPartAsync(
159157
/// Called when creating a job part from a checkpoint file on resume.
160158
/// </summary>
161159
public static ServiceToServiceJobPart CreateJobPartFromCheckpoint(
162-
ServiceToServiceTransferJob job,
160+
TransferJobInternal job,
163161
int partNumber,
164162
StorageResourceItem sourceResource,
165163
StorageResourceItem destinationResource,

sdk/storage/Azure.Storage.DataMovement/src/ServiceToServiceTransferJob.cs

Lines changed: 0 additions & 225 deletions
This file was deleted.

sdk/storage/Azure.Storage.DataMovement/src/Shared/DataMovementExtensions.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ internal static StorageResourceItemProperties ToStorageResourceProperties(this F
2121
properties: properties);
2222
}
2323

24-
public static StreamToUriJobPart ToJobPartAsync(
25-
this StreamToUriTransferJob baseJob,
24+
public static StreamToUriJobPart ToStreamToUriJobPartAsync(
25+
this TransferJobInternal baseJob,
2626
Stream planFileStream,
2727
StorageResourceItem sourceResource,
2828
StorageResourceItem destinationResource)
@@ -53,8 +53,8 @@ public static StreamToUriJobPart ToJobPartAsync(
5353
return jobPart;
5454
}
5555

56-
public static ServiceToServiceJobPart ToJobPartAsync(
57-
this ServiceToServiceTransferJob baseJob,
56+
public static ServiceToServiceJobPart ToServiceToServiceJobPartAsync(
57+
this TransferJobInternal baseJob,
5858
Stream planFileStream,
5959
StorageResourceItem sourceResource,
6060
StorageResourceItem destinationResource)
@@ -85,8 +85,8 @@ public static ServiceToServiceJobPart ToJobPartAsync(
8585
return jobPart;
8686
}
8787

88-
public static UriToStreamJobPart ToJobPartAsync(
89-
this UriToStreamTransferJob baseJob,
88+
public static UriToStreamJobPart ToUriToStreamJobPartAsync(
89+
this TransferJobInternal baseJob,
9090
Stream planFileStream,
9191
StorageResourceItem sourceResource,
9292
StorageResourceItem destinationResource)
@@ -117,8 +117,8 @@ public static UriToStreamJobPart ToJobPartAsync(
117117
return jobPart;
118118
}
119119

120-
public static StreamToUriJobPart ToJobPartAsync(
121-
this StreamToUriTransferJob baseJob,
120+
public static StreamToUriJobPart ToStreamToUriJobPartAsync(
121+
this TransferJobInternal baseJob,
122122
Stream planFileStream,
123123
StorageResourceContainer sourceResource,
124124
StorageResourceContainer destinationResource)
@@ -153,8 +153,8 @@ public static StreamToUriJobPart ToJobPartAsync(
153153
return jobPart;
154154
}
155155

156-
public static ServiceToServiceJobPart ToJobPartAsync(
157-
this ServiceToServiceTransferJob baseJob,
156+
public static ServiceToServiceJobPart ToServiceToServiceJobPartAsync(
157+
this TransferJobInternal baseJob,
158158
Stream planFileStream,
159159
StorageResourceContainer sourceResource,
160160
StorageResourceContainer destinationResource)
@@ -187,8 +187,8 @@ public static ServiceToServiceJobPart ToJobPartAsync(
187187
return jobPart;
188188
}
189189

190-
public static UriToStreamJobPart ToJobPartAsync(
191-
this UriToStreamTransferJob baseJob,
190+
public static UriToStreamJobPart ToUriToStreamJobPartAsync(
191+
this TransferJobInternal baseJob,
192192
Stream planFileStream,
193193
StorageResourceContainer sourceResource,
194194
StorageResourceContainer destinationResource)

0 commit comments

Comments
 (0)