Skip to content
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

Add async_read support for pull_blob API #54

Merged
merged 1 commit into from
Dec 14, 2022
Merged

Conversation

arronwy
Copy link
Contributor

@arronwy arronwy commented Dec 8, 2022

This API allows blobs input stream integrate seamless with following blob processing using Rust's asynchronous IO types like async_compression.

Fixed: #53

Signed-off-by: Wang, Arron arron.wang@intel.com

This API allows blobs input stream integrate seamless with
following blob processing using Rust's asynchronous IO types
like async_compression.

Fixed: oras-project#53

Signed-off-by: Wang, Arron <arron.wang@intel.com>
Copy link
Contributor

@flavio flavio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@flavio flavio merged commit 68ecf58 into oras-project:main Dec 14, 2022
flavio added a commit to flavio/rust-oci-client that referenced this pull request Dec 14, 2022
What's Changed
==============

* Bump actions/checkout from 3.0.2 to 3.1.0 by @dependabot in oras-project#47
* feat: enable Clone, Eq, PartialEq and Debug macro for RegistryAuth by @Xynnn007 in oras-project#48
* fix: address broken test by @flavio in oras-project#52
* Update rstest requirement from 0.15.0 to 0.16.0 by @dependabot in oras-project#55
* Add async_read support for pull_blob API by @arronwy in oras-project#54
* fix: rustls allow usage or system root certificates by @flavio in oras-project#56

== New Contributors
* @Xynnn007 made their first contribution in oras-project#48

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
@flavio
Copy link
Contributor

flavio commented Dec 14, 2022

@arronwy I've just published v0.9.4 that features your patch

@arronwy
Copy link
Contributor Author

arronwy commented Dec 14, 2022

@arronwy I've just published v0.9.4 that features your patch

Thanks a lot for your quick review and new v0.9.4 release, much appreciated!

@thomastaylor312
Copy link
Contributor

@flavio Not a big deal for something this small, but generally a feature add should probably be a new minor release rather than patch (so 0.10.0)

&self,
image: &Reference,
digest: &str,
) -> Result<impl AsyncRead + Unpin> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is already merged but @arronwy is there a reason you chose AsyncRead over returning Stream? Generally it is better to return a stream and let the user choose how they want to consume it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @thomastaylor312 , yes, agree, Stream can easy convert to AsyncRead I also verified if we return
Result<impl Stream<Item = std::result::Result<bytes::Bytes, std::io::Error>>>
will also works.

The reason I chose AsyncRead is try to consistent with current pull_blob API with output using:
AsyncWrite and async_compression crates: https://docs.rs/async-compression/latest/async_compression/index.html also operate over AsyncWrite and AsyncBufRead streams.

It's ok for me if we decide change to return Stream to let user to choose :-).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right I had forgotten we used AsyncRead. I'll capture an issue to refactor that at some point

thomastaylor312 pushed a commit that referenced this pull request Mar 2, 2023
Add async_read support for pull_blob API
thomastaylor312 pushed a commit that referenced this pull request Mar 2, 2023
What's Changed
==============

* Bump actions/checkout from 3.0.2 to 3.1.0 by @dependabot in #47
* feat: enable Clone, Eq, PartialEq and Debug macro for RegistryAuth by @Xynnn007 in #48
* fix: address broken test by @flavio in #52
* Update rstest requirement from 0.15.0 to 0.16.0 by @dependabot in #55
* Add async_read support for pull_blob API by @arronwy in #54
* fix: rustls allow usage or system root certificates by @flavio in #56

== New Contributors
* @Xynnn007 made their first contribution in #48

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add stream processing API for pull_blob
3 participants