Skip to content

Commit 73b120d

Browse files
Surayya Huseyn ZadaSurayya Huseyn Zada
authored andcommitted
rearrange functions order in DockerCli for easier review
1 parent fb04982 commit 73b120d

File tree

1 file changed

+40
-40
lines changed
  • src/Containers/Microsoft.NET.Build.Containers/LocalDaemons

1 file changed

+40
-40
lines changed

src/Containers/Microsoft.NET.Build.Containers/LocalDaemons/DockerCli.cs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -398,30 +398,6 @@ private static async Task WriteManifestForDockerImage(
398398
}
399399
}
400400

401-
public static async Task WriteMultiArchOciImageToStreamAsync(
402-
BuiltImage[] images,
403-
SourceImageReference sourceReference,
404-
DestinationImageReference destinationReference,
405-
Stream imageStream,
406-
CancellationToken cancellationToken)
407-
{
408-
cancellationToken.ThrowIfCancellationRequested();
409-
410-
using TarWriter writer = new(imageStream, TarEntryFormat.Pax, leaveOpen: true);
411-
412-
foreach (var image in images)
413-
{
414-
await WriteOciImageToBlobs(writer, image, sourceReference, cancellationToken)
415-
.ConfigureAwait(false);
416-
}
417-
418-
await WriteIndexJsonForMultiArchOciImage(writer, images, destinationReference, cancellationToken)
419-
.ConfigureAwait(false);
420-
421-
await WriteOciLayout(writer, cancellationToken)
422-
.ConfigureAwait(false);
423-
}
424-
425401
private static async Task WriteOciImageToStreamAsync(
426402
BuiltImage image,
427403
SourceImageReference sourceReference,
@@ -443,22 +419,6 @@ await WriteOciLayout(writer, cancellationToken)
443419
.ConfigureAwait(false);
444420
}
445421

446-
private static async Task WriteOciImageToBlobs(
447-
TarWriter writer,
448-
BuiltImage image,
449-
SourceImageReference sourceReference,
450-
CancellationToken cancellationToken)
451-
{
452-
await WriteImageLayers(writer, image, sourceReference, d => $"{_blobsPath}/{d.Substring("sha256:".Length)}", cancellationToken)
453-
.ConfigureAwait(false);
454-
455-
await WriteImageConfig(writer, image, $"{_blobsPath}/{image.ImageSha}", cancellationToken)
456-
.ConfigureAwait(false);
457-
458-
await WriteManifestForOciImage(writer, image, cancellationToken)
459-
.ConfigureAwait(false);
460-
}
461-
462422
private static async Task WriteOciLayout(TarWriter writer, CancellationToken cancellationToken)
463423
{
464424
cancellationToken.ThrowIfCancellationRequested();
@@ -493,6 +453,46 @@ private static async Task WriteManifestForOciImage(
493453
}
494454
}
495455

456+
private static async Task WriteOciImageToBlobs(
457+
TarWriter writer,
458+
BuiltImage image,
459+
SourceImageReference sourceReference,
460+
CancellationToken cancellationToken)
461+
{
462+
await WriteImageLayers(writer, image, sourceReference, d => $"{_blobsPath}/{d.Substring("sha256:".Length)}", cancellationToken)
463+
.ConfigureAwait(false);
464+
465+
await WriteImageConfig(writer, image, $"{_blobsPath}/{image.ImageSha}", cancellationToken)
466+
.ConfigureAwait(false);
467+
468+
await WriteManifestForOciImage(writer, image, cancellationToken)
469+
.ConfigureAwait(false);
470+
}
471+
472+
public static async Task WriteMultiArchOciImageToStreamAsync(
473+
BuiltImage[] images,
474+
SourceImageReference sourceReference,
475+
DestinationImageReference destinationReference,
476+
Stream imageStream,
477+
CancellationToken cancellationToken)
478+
{
479+
cancellationToken.ThrowIfCancellationRequested();
480+
481+
using TarWriter writer = new(imageStream, TarEntryFormat.Pax, leaveOpen: true);
482+
483+
foreach (var image in images)
484+
{
485+
await WriteOciImageToBlobs(writer, image, sourceReference, cancellationToken)
486+
.ConfigureAwait(false);
487+
}
488+
489+
await WriteIndexJsonForMultiArchOciImage(writer, images, destinationReference, cancellationToken)
490+
.ConfigureAwait(false);
491+
492+
await WriteOciLayout(writer, cancellationToken)
493+
.ConfigureAwait(false);
494+
}
495+
496496
private static async Task WriteIndexJsonForMultiArchOciImage(
497497
TarWriter writer,
498498
BuiltImage[] images,

0 commit comments

Comments
 (0)