umoci icon indicating copy to clipboard operation
umoci copied to clipboard

api: switch to config-function pattern

Open cyphar opened this issue 2 months ago • 0 comments

At the moment we pass a bunch of arguments, to our core github.com/opencontainers/umoci APIs. These are awful to use and cause API breakages whenever we add a new argument. The main alternatives are:

  1. Use a struct. The main issue with this is that it requires exposing more internal types and more complicated configurations can get a bit complicated.
  2. Use the function pattern (i.e., UnpackManifest(..., GzipCompression, Rootless) with the trailing arguments being functions that can modify an internal configuration struct. This is a bit more complicated to implement but it gives us more flexibility without the need to expose all of our internal types or add wrapping types. This also theoretically lets us use the same config functions for different functions by using reflection.

cyphar avatar Oct 01 '25 17:10 cyphar