cue-labs / oci

Go modules related to OCI (Open Container Initiative) registries
Apache License 2.0
22 stars 3 forks source link

wishlist: sparse support in ocimem #24

Open tianon opened 4 months ago

tianon commented 4 months ago

I wanted to use ocimem as a very rudimentary cache on top of an existing registry (was actually building a full ociregistry.Interface that does so transparently :smile:) and ran into the unfortunate limitation that ocimem enforces fully valid/"fat" manifests:

https://github.com/cue-labs/oci/blob/1f693b7466afbd2989a1bdbc88b4c33e5c550472/ociregistry/ocimem/writer.go#L188-L199

It'd be interesting/useful if ocimem could have a way to optionally enable a "sparse" mode that relaxes that restriction. :eyes:

rogpeppe commented 4 months ago

Good idea. I think the API outline described in issue #23 should be sufficient for adding that degree of freedom in ocimem. There are a bunch of possibilities for how much flexibility to provide there though, ranging from a simple StrictReferences boolean to some kind of arbitrary function that's used to query whether a given operation should be allowed.

What might be your preference there?

tianon commented 4 months ago

Oh interesting - I like the idea of a function that gets to choose or do more extensive validation of some kind, but I'm totally fine with just a boolean for my own use case. I guess it depends on how much you want ocimem to scope creep :sweat_smile: