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

Pass the image layers as a Vector #79

Closed
wants to merge 1 commit into from

Conversation

lswith
Copy link
Contributor

@lswith lswith commented Apr 22, 2023

This PR is the result of a long winding issue when calling the client.push function from
within tokio::spawn.

The specific error was:

error: implementation of `Iterator` is not general enough
  --> src/tester.rs:54:5
   |
54 |     res
   |     ^^^ implementation of `Iterator` is not general enough
   |
   = note: `Iterator` would have to be implemented for the type `std::slice::Iter<'0, ImageLayer>`, for any lifetime `'0`...
   = note: ...but `Iterator` is actually implemented for the type `std::slice::Iter<'1, ImageLayer>`, for some specific lifetime `'1`

and

error: implementation of `FnOnce` is not general enough
  --> src/tester.rs:54:5
   |
54 |     res
   |     ^^^ implementation of `FnOnce` is not general enough
   |
   = note: closure with signature `fn(&'0 ImageLayer) -> [async block@Client::push::{closure#0}::{closure#0}::{closure#0}]` must implement `FnOnce<(&ImageLayer,)>`, for any lifetime `'0`...
   = note: ...but it actually implements `FnOnce<(&ImageLayer,)>

or

error: higher-ranked lifetime error
   --> src/client.rs:92:5
    |
92  | /     async move {
93  | |         if *auth != RegistryAuth::Anonymous {
94  | |             client
95  | |                 .auth(&image, auth, oci_distribution::RegistryOperation::Push)
...   |
99  | |         client.push(&image, &layers, config, auth, manifest).await
100 | |     }
    | |_____^

warning: `registry-load-tester` (lib) generated 2 warnings
error: could not compile `registry-load-tester` due to previous error; 2 warnings emitted

Only once I found this specific rust issue: rust-lang/rust#89976 did it make sense that
this was the issue.

Signed-off-by: Luke Swithenbank <lswith@users.noreply.github.com>
@@ -281,7 +281,7 @@ impl Client {
self.validate_layers(&manifest, accepted_media_types)
.await?;

let layers = stream::iter(&manifest.layers)
let layers = stream::iter(manifest.layers.clone())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a clone of the descriptors, not the actual layers.

@flavio
Copy link
Contributor

flavio commented May 9, 2023

Can you show a snippet of the code under tester.rs that triggered the error?

@lswith
Copy link
Contributor Author

lswith commented May 12, 2023

I can't seem to find the code or replicate so I'm happy to remove this PR for now and if it comes back, I'll make a better example.

@lswith lswith closed this May 12, 2023
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.

2 participants