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

Functions

func CleanupContainerMounts

func CleanupContainerMounts(containerID string) error

func GetCimMountPath

func GetCimMountPath(cimPath, containerID string) (string, error)

GetCimMountPath returns the volume at which a cim is mounted. If the cim is not mounted returns error

func LayerID

func LayerID(cimPath, containerID string) (string, error)

func MountCimLayer

func MountCimLayer(ctx context.Context, cimPath, containerID string) (string, error)

MountCimLayer mounts the cim at path `cimPath` and returns the mount location of that cim. This method uses the `CimMountFlagCacheFiles` mount flag when mounting the cim. The containerID is used to generated 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

func UnmountCimLayer(ctx context.Context, cimPath, containerID string) error

Unmount unmounts the cim at mounted for given container.

Types

type CimLayerWriter

type CimLayerWriter struct {
	// contains filtered or unexported fields
}

A CimLayerWriter 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 NewCimLayerWriter

func NewCimLayerWriter(ctx context.Context, layerPath, cimPath string, parentLayerPaths, parentLayerCimPaths []string) (_ *CimLayerWriter, err error)

func (*CimLayerWriter) Add

func (cw *CimLayerWriter) 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 (*CimLayerWriter) AddAlternateStream

func (cw *CimLayerWriter) AddAlternateStream(name string, size uint64) error

AddAlternateStream creates another alternate stream at the given path. Any writes made after this call will go to that stream.

func (cw *CimLayerWriter) AddLink(name string, target string) error

AddLink adds a hard link to the layer. The target must already have been added.

func (*CimLayerWriter) Close

func (cw *CimLayerWriter) Close(ctx context.Context) (retErr error)

Close finishes the layer writing process and releases any resources.

func (*CimLayerWriter) Remove

func (cw *CimLayerWriter) Remove(name string) error

Remove removes a file that was present in a parent layer from the layer.

func (*CimLayerWriter) Write

func (cw *CimLayerWriter) Write(b []byte) (int, error)

Write writes data to the current file. The data must be in the format of a Win32 backup stream.

Source Files

LayerWriter.go doc.go file_writer.go mount.go pending.go process.go registry.go

Version
v0.13.0-rc.1
Published
Jun 27, 2024
Platform
windows/amd64
Imports
21 packages
Last checked
2 hours ago

Tools for package owners.