package cim
import "github.com/Microsoft/hcsshim/internal/wclayer/cim"
This package provides utilities for working with container image layers in the cim format via the wclayer APIs.
Index ¶
- Variables
- func CleanupContainerMounts(containerID string) error
- func LayerID(vol string) (string, error)
- func MergeMountBlockCIMLayer(ctx context.Context, mergedLayer *cimfs.BlockCIM, parentLayers []*cimfs.BlockCIM, containerID string) (_ string, err error)
- func MountBlockCIMLayer(ctx context.Context, layer *cimfs.BlockCIM, containerID string) (_ string, err error)
- func MountForkedCimLayer(ctx context.Context, cimPath, containerID string) (string, error)
- func UnmountCimLayer(ctx context.Context, volume string) error
- type BlockCIMLayerWriter
- func NewBlockCIMLayerWriter(ctx context.Context, layer *cimfs.BlockCIM, parentLayers []*cimfs.BlockCIM) (_ *BlockCIMLayerWriter, err error)
- func (cw *BlockCIMLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo, fileSize int64, securityDescriptor []byte, extendedAttributes []byte, reparseData []byte) error
- func (cw BlockCIMLayerWriter) AddAlternateStream(name string, size uint64) error
- func (cw *BlockCIMLayerWriter) AddLink(name string, target string) error
- func (cw BlockCIMLayerWriter) Close(ctx context.Context) (retErr error)
- func (cw *BlockCIMLayerWriter) Remove(name string) error
- func (cw BlockCIMLayerWriter) Write(b []byte) (int, error)
- type CIMLayerWriter
- type ForkedCimLayerWriter
- func NewForkedCimLayerWriter(ctx context.Context, layerPath, cimPath string, parentLayerPaths, parentLayerCimPaths []string) (_ *ForkedCimLayerWriter, err error)
- func (cw ForkedCimLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo, fileSize int64, securityDescriptor []byte, extendedAttributes []byte, reparseData []byte) error
- func (cw ForkedCimLayerWriter) AddAlternateStream(name string, size uint64) error
- func (cw ForkedCimLayerWriter) AddLink(name string, target string) error
- func (cw ForkedCimLayerWriter) Close(ctx context.Context) (retErr error)
- func (cw *ForkedCimLayerWriter) Remove(name string) error
- func (cw ForkedCimLayerWriter) Write(b []byte) (int, error)
Variables ¶
var ( ErrBlockCIMWriterNotSupported = fmt.Errorf("writing block device CIM isn't supported") ErrBlockCIMParentTypeMismatch = fmt.Errorf("parent layer block CIM type doesn't match with extraction layer") )
Functions ¶
func CleanupContainerMounts ¶
func LayerID ¶
LayerID provides a unique GUID for each mounted CIM volume.
func MergeMountBlockCIMLayer ¶
func MergeMountBlockCIMLayer(ctx context.Context, mergedLayer *cimfs.BlockCIM, parentLayers []*cimfs.BlockCIM, containerID string) (_ string, err error)
MergeMountBlockCIMLayer mounts the given merged block cim and returns the mount location of that cim. The containerID is used to generate the volumeID for the volume at which this CIM is mounted. containerID is used so that if the shim process crashes for any reason, the mounted cim can be correctly cleaned up during `shim delete` call. parentLayers MUST be in the base to topmost order. I.e base layer should be at index 0 and immediate parent MUST be at the last index.
func MountBlockCIMLayer ¶
func MountBlockCIMLayer(ctx context.Context, layer *cimfs.BlockCIM, containerID string) (_ string, err error)
MountBlockCIMLayer mounts the given block cim and returns the mount location of that cim. The containerID is used to generate the volumeID for the volume at which this CIM is mounted. containerID is used so that if the shim process crashes for any reason, the mounted cim can be correctly cleaned up during `shim delete` call.
func MountForkedCimLayer ¶
MountForkedCimLayer mounts the cim at path `cimPath` and returns the mount location of that cim. The containerID is used to generate the volumeID for the volume at which this CIM is mounted. containerID is used so that if the shim process crashes for any reason, the mounted cim can be correctly cleaned up during `shim delete` call.
func UnmountCimLayer ¶
Unmounts the cim mounted at the given volume
Types ¶
type BlockCIMLayerWriter ¶
type BlockCIMLayerWriter struct {
// contains filtered or unexported fields
}
A BlockCIMLayerWriter implements the CIMLayerWriter interface to allow writing container image layers in the blocked cim format.
func NewBlockCIMLayerWriter ¶
func NewBlockCIMLayerWriter(ctx context.Context, layer *cimfs.BlockCIM, parentLayers []*cimfs.BlockCIM) (_ *BlockCIMLayerWriter, err error)
NewBlockCIMLayerWriter writes the layer files in the block CIM format.
func (*BlockCIMLayerWriter) Add ¶
func (cw *BlockCIMLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo, fileSize int64, securityDescriptor []byte, extendedAttributes []byte, reparseData []byte) error
Add adds a file to the layer with given metadata.
func (BlockCIMLayerWriter) AddAlternateStream ¶
AddAlternateStream creates another alternate stream at the given path. Any writes made after this call will go to that stream.
func (*BlockCIMLayerWriter) AddLink ¶
func (cw *BlockCIMLayerWriter) AddLink(name string, target string) error
AddLink adds a hard link to the layer. Note that the link added here is evaluated only at the CIM merge time. So an invalid link will not throw an error here.
func (BlockCIMLayerWriter) Close ¶
Close finishes the layer writing process and releases any resources.
func (*BlockCIMLayerWriter) Remove ¶
func (cw *BlockCIMLayerWriter) Remove(name string) error
Remove removes a file that was present in a parent layer from the layer.
func (BlockCIMLayerWriter) Write ¶
Write writes data to the current file. The data must be in the format of a Win32 backup stream.
type CIMLayerWriter ¶
type CIMLayerWriter interface { // Add adds a file to the layer with given metadata. Add(string, *winio.FileBasicInfo, int64, []byte, []byte, []byte) error // AddLink adds a hard link to the layer. The target must already have been added. AddLink(string, string) error // AddAlternateStream adds an alternate stream to a file AddAlternateStream(string, uint64) error // Remove removes a file that was present in a parent layer from the layer. Remove(string) error // Write writes data to the current file. The data must be in the format of a Win32 // backup stream. Write([]byte) (int, error) // Close finishes the layer writing process and releases any resources. Close(context.Context) error }
CIMLayerWriter is an interface that supports writing a new container image layer to the CIM format
type ForkedCimLayerWriter ¶
type ForkedCimLayerWriter struct {
// contains filtered or unexported fields
}
A ForkedCimLayerWriter implements the wclayer.LayerWriter interface to allow writing container image layers in the cim format. A cim layer consist of cim files (which are usually stored in the `cim-layers` directory and some other files which are stored in the directory of that layer (i.e the `path` directory).
func NewForkedCimLayerWriter ¶
func NewForkedCimLayerWriter(ctx context.Context, layerPath, cimPath string, parentLayerPaths, parentLayerCimPaths []string) (_ *ForkedCimLayerWriter, err error)
func (ForkedCimLayerWriter) Add ¶
func (cw ForkedCimLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo, fileSize int64, securityDescriptor []byte, extendedAttributes []byte, reparseData []byte) error
Add adds a file to the layer with given metadata.
func (ForkedCimLayerWriter) AddAlternateStream ¶
AddAlternateStream creates another alternate stream at the given path. Any writes made after this call will go to that stream.
func (ForkedCimLayerWriter) AddLink ¶
AddLink adds a hard link to the layer. The target must already have been added.
func (ForkedCimLayerWriter) Close ¶
Close finishes the layer writing process and releases any resources.
func (*ForkedCimLayerWriter) Remove ¶
func (cw *ForkedCimLayerWriter) Remove(name string) error
Remove removes a file that was present in a parent layer from the layer.
func (ForkedCimLayerWriter) Write ¶
Write writes data to the current file. The data must be in the format of a Win32 backup stream.
Source Files ¶
block_cim_writer.go common.go doc.go file_writer.go forked_cim_writer.go mount.go pending.go process.go registry.go
- Version
- v0.13.0-rc.3
- Published
- Jan 10, 2025
- Platform
- windows/amd64
- Imports
- 20 packages
- Last checked
- 49 minutes ago –
Tools for package owners.