-
Notifications
You must be signed in to change notification settings - Fork 13
feat(copy): introduces CopyGraphOptions with events support #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
leonardochaia
wants to merge
33
commits into
oras-project:main
Choose a base branch
from
leonardochaia:feat/improve-copy-performance
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 22 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
6817504
feat(copy): support mounting existing descriptors from other reposito…
leonardochaia b453fbc
fix: standard header
leonardochaia 6a7a1e9
chore: adds repository tests
leonardochaia 88c6793
fix: copy test
leonardochaia 4c52467
Merge branch 'main' into feat/improve-copy-performance
leonardochaia 36342c9
Merge branch 'main' into feat/improve-copy-performance
leonardochaia dbe3509
chore: removes mounting support to be implemented in separate PR
leonardochaia 571820c
refactor: renames class and events as per review
leonardochaia 138120e
chore: adds copy tests
leonardochaia 77e8079
chore: adds overload to prevent breaking change
leonardochaia 06fd442
chore: introduces overloads to keep previous signature on CopyGraphOp…
leonardochaia 5787c04
fix: copy signature
leonardochaia c9be0a2
Merge branch 'main' into feat/improve-copy-performance
leonardochaia 77ba179
refactor: introduces CopyOptions
leonardochaia ecaf1b1
Merge remote-tracking branch 'origin/feat/improve-copy-performance' i…
leonardochaia de9ee0d
Merge branch 'main' into feat/improve-copy-performance
leonardochaia 6ef7e74
chore: adds license
leonardochaia be7b1c5
Merge remote-tracking branch 'origin/feat/improve-copy-performance' i…
leonardochaia a12ff78
chore: adds more tests from oras-go
leonardochaia a7a1baf
chore: adds tests from oras-go
leonardochaia 493a8d9
doc: adds comments to new option structs
leonardochaia 9e40655
refactor: makes copy events async
leonardochaia 68220bd
feat: introduces `InvokeAsync` extension method to support asynchrono…
leonardochaia e35fc7e
refactor: delegate InvokeAsync to execute handlers in parallel
leonardochaia 827f62b
refactor: Copy events to include sync and async variants.
leonardochaia 6d1b0ba
Merge branch 'main' into feat/improve-copy-performance
Wwwsylvia 2372ac6
address comments
Wwwsylvia f7b326d
fix tests
Wwwsylvia fe10a1a
rename
Wwwsylvia c1c7182
nit
Wwwsylvia 7b31ec3
Merge branch 'main' into feat/improve-copy-performance
Wwwsylvia b9f93d0
refactor
Wwwsylvia 20ac068
update tests
Wwwsylvia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright The ORAS Authors. | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using OrasProject.Oras.Oci; | ||
|
||
namespace OrasProject.Oras; | ||
|
||
/// <summary> | ||
/// CopyGraphOptions contains parameters for <see cref="Extensions.CopyGraphAsync(OrasProject.Oras.ITarget,OrasProject.Oras.ITarget,OrasProject.Oras.Oci.Descriptor,System.Threading.CancellationToken)"/> | ||
/// </summary> | ||
public struct CopyGraphOptions | ||
{ | ||
/// <summary> | ||
/// PreCopy handles the current descriptor before it is copied. | ||
/// </summary> | ||
public event Func<Descriptor, Task> PreCopy; | ||
|
||
/// <summary> | ||
/// PostCopy handles the current descriptor after it is copied. | ||
/// </summary> | ||
public event Func<Descriptor, Task> PostCopy; | ||
|
||
/// <summary> | ||
/// CopySkipped will be called when the sub-DAG rooted by the current node | ||
/// is skipped. | ||
/// </summary> | ||
public event Func<Descriptor, Task> CopySkipped; | ||
|
||
internal Task OnPreCopyAsync(Descriptor descriptor) | ||
{ | ||
return PreCopy?.Invoke(descriptor) ?? Task.CompletedTask; | ||
} | ||
|
||
internal Task OnPostCopyAsync(Descriptor descriptor) | ||
{ | ||
return PostCopy?.Invoke(descriptor) ?? Task.CompletedTask; | ||
} | ||
|
||
internal Task OnCopySkippedAsync(Descriptor descriptor) | ||
{ | ||
return CopySkipped?.Invoke(descriptor) ?? Task.CompletedTask; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright The ORAS Authors. | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace OrasProject.Oras; | ||
|
||
/// <summary> | ||
/// CopyOptions contains parameters for <see cref="Extensions.CopyAsync(OrasProject.Oras.ITarget,string,OrasProject.Oras.ITarget,string,System.Threading.CancellationToken)"/> | ||
/// </summary> | ||
public struct CopyOptions | ||
{ | ||
public CopyGraphOptions CopyGraphOptions; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.