oras-project / rust-oci-client

A Rust crate to interact with OCI registries
Apache License 2.0
84 stars 44 forks source link

`Client::pull` returns layers in non-deterministic order #134

Open aochagavia opened 1 month ago

aochagavia commented 1 month ago

The code for Client::pull uses buffer_unordered under the hood (see here). Because of this, layers are stored in arbitrary order in ImageData::layers. Unfortunately, this makes it impossible to know which layer from ImageData::layers corresponds to which entry in OciImageManifest::layers, unless you recalculate the hash (which seems like a waste of resources).

IMO we should either store the layers in ImageData::layers in their original order, or provide a mechanism to cheaply correlate them to the layers in OciImageManifest::layers (e.g. including an index number).

thomastaylor312 commented 1 month ago

I actually saw this the other day when I was modifying something else and wondered if it would be a problem. Thanks for filing the issue!