You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of having a large and growing list of functions which perform
any number of possibly desired image flows:
- from:
- OCI container
- filesystem
- with or without root directory stat
- selinux relabel (yes/no)
- output:
- create an image
- compute an image checksum
- print a dumpfile
Add a function for each source (oci, fs) for creating a FileSystem and
define some new high-level transformations and operations on the
FileSystem object itself.
These operations sort of depend on everything whereas the rest of the
code in tree.rs depends on almost nothing, so it feels a bit weird to
include them in that file. I tried some other approaches here:
- define a bunch of functions that take a FileSystem as their first
argument and operate on it. This had bad ergonomics because they
essentially class methods, and it wasn't able to invoke them as such.
- move FileSystem into a separate file and define the methods there.
This was strange because lower-level parts of the code still
had to create a FileSystem object, so they ended up depending on the
higher-level file again.
- define a "FileSystemOps" helper trait which is implemented only for
FileSystem: this was probably the cleanest approach and had the
advantage of requiring the trait to be in scope in order to perform
the high-level operations. The only reason I dismissed this one was
because it was pointlessly complicated and required writing the
method signatures twice.
In the end we just make use of the fact that it's possible to have
multiple `impl` blocks for a given `struct` as long as they're in the
same crate. The "trait" approach might be a bit cleaner, but this works
as well.
Adjust various API users to make use of the new operations.
Overhaul the `cfsctl` commandline to be more consistent about the
offered operations and the flags that get passed to them. Update the
examples as appropriate.
Signed-off-by: Allison Karlitskaya <[email protected]>
0 commit comments