Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Lixia (Sylvia) Lei <[email protected]>
  • Loading branch information
Wwwsylvia committed Nov 21, 2024
1 parent 4ad3ec6 commit ccc81fc
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/OrasProject.Oras/Registry/Remote/ManifestStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,20 @@ public async Task<bool> ExistsAsync(Descriptor target, CancellationToken cancell
}

/// <summary>
/// Pushes the content, matching the expected descriptor.
/// Pushes the manifest content, matching the expected descriptor.
/// </summary>
/// <param name="expected"></param>
/// <param name="content"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task PushAsync(Descriptor expected, Stream content, CancellationToken cancellationToken = default)
=> await DoPushAsync(expected, content, expected.Digest, cancellationToken).ConfigureAwait(false);
{
var remoteReference = Repository.ParseReference(expected.Digest);
await DoPushAsync(expected, content, remoteReference, cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// PushReferenceASync pushes the manifest with a reference tag.
/// Pushes the manifest content with a reference tag.
/// </summary>
/// <param name="expected"></param>
/// <param name="content"></param>
Expand All @@ -156,19 +159,6 @@ public async Task PushAsync(Descriptor expected, Stream content, string referenc
await DoPushAsync(expected, content, remoteReference, cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// Pushes the manifest content, matching the expected descriptor.
/// </summary>
/// <param name="expected"></param>
/// <param name="stream"></param>
/// <param name="contentReference"></param>
/// <param name="cancellationToken"></param>
private async Task DoPushAsync(Descriptor expected, Stream stream, string contentReference, CancellationToken cancellationToken)
{
var remoteReference = Repository.ParseReference(contentReference);
await DoPushAsync(expected, stream, remoteReference, cancellationToken);
}

/// <summary>
/// Pushes the manifest content, matching the expected descriptor.
/// </summary>
Expand Down

0 comments on commit ccc81fc

Please sign in to comment.