github.com/opencontainers/umoci@v0.4.8-0.20240508124516-656e4836fb0d/oci/layer/types.go (about)

     1  package layer
     2  
     3  import (
     4  	ispec "github.com/opencontainers/image-spec/specs-go/v1"
     5  )
     6  
     7  // WhiteoutMode indicates how this TarExtractor will create whiteouts on the
     8  // filesystem when it encounters them.
     9  type WhiteoutMode int
    10  
    11  const (
    12  	// OCIStandardWhiteout does the standard OCI thing: a file named
    13  	// .wh.foo indicates you should rm -rf foo.
    14  	OCIStandardWhiteout WhiteoutMode = iota
    15  
    16  	// OverlayFSWhiteout generates a rootfs suitable for use in overlayfs,
    17  	// so it follows the overlayfs whiteout protocol:
    18  	//     .wh.foo => mknod c 0 0 foo
    19  	OverlayFSWhiteout
    20  )
    21  
    22  // UnpackOptions describes the behavior of the various unpack operations.
    23  type UnpackOptions struct {
    24  	// MapOptions are the UID and GID mappings used when unpacking an image
    25  	MapOptions MapOptions
    26  
    27  	// KeepDirlinks is essentially the same as rsync's optio
    28  	// --keep-dirlinks: if, on extraction, a directory would be created
    29  	// where a symlink to a directory previously existed, KeepDirlinks
    30  	// doesn't create that directory, but instead just uses the existing
    31  	// symlink.
    32  	KeepDirlinks bool
    33  
    34  	// AfterLayerUnpack is a function that's called after every layer is
    35  	// unpacked.
    36  	AfterLayerUnpack AfterLayerUnpackCallback
    37  
    38  	// StartFrom is the descriptor in the manifest to start from
    39  	StartFrom ispec.Descriptor
    40  
    41  	// WhiteoutMode is the type of whiteout to write to the filesystem.
    42  	WhiteoutMode WhiteoutMode
    43  }
    44  
    45  // RepackOptions describes the behavior of the various GenerateLayer operations.
    46  type RepackOptions struct {
    47  	// MapOptions are the UID and GID mappings used when unpacking an image
    48  	MapOptions MapOptions
    49  
    50  	// TranslateOverlayWhiteouts changes char devices of type 0,0 to
    51  	// .wh.foo style whiteouts when generating tarballs. Without this,
    52  	// whiteouts are untouched.
    53  	TranslateOverlayWhiteouts bool
    54  }