Skip to content

api: switch to config-function pattern #629

@cyphar

Description

@cyphar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions