package computestorage
import "github.com/Microsoft/hcsshim/computestorage"
Package computestorage is a wrapper around the HCS storage APIs. These are new storage APIs introduced separate from the original graphdriver calls intended to give more freedom around creating and managing container layers and scratch spaces.
Index ¶
- func AttachLayerStorageFilter(ctx context.Context, layerPath string, layerData LayerData) (err error)
- func AttachOverlayFilter(ctx context.Context, volumePath string, layerData LayerData) (err error)
- func DestroyLayer(ctx context.Context, layerPath string) (err error)
- func DetachLayerStorageFilter(ctx context.Context, layerPath string) (err error)
- func DetachOverlayFilter(ctx context.Context, volumePath string, filterType hcsschema.FileSystemFilterType) (err error)
- func ExportLayer(ctx context.Context, layerPath, exportFolderPath string, layerData LayerData, options ExportLayerOptions) (err error)
- func FormatWritableLayerVhd(ctx context.Context, vhdHandle windows.Handle) (err error)
- func GetLayerVhdMountPath(ctx context.Context, vhdHandle windows.Handle) (path string, err error)
- func ImportLayer(ctx context.Context, layerPath, sourceFolderPath string, layerData LayerData) (err error)
- func InitializeWritableLayer(ctx context.Context, layerPath string, layerData LayerData) (err error)
- func SetupBaseOSLayer(ctx context.Context, layerPath string, vhdHandle windows.Handle, options OsLayerOptions) (err error)
- func SetupBaseOSVolume(ctx context.Context, layerPath, volumePath string, options OsLayerOptions) (err error)
- func SetupContainerBaseLayer(ctx context.Context, layerPath, baseVhdPath, diffVhdPath string, sizeInGB uint64) (err error)
- func SetupUtilityVMBaseLayer(ctx context.Context, uvmPath, baseVhdPath, diffVhdPath string, sizeInGB uint64) (err error)
- type ExportLayerOptions
- type Layer
- type LayerData
- type OsLayerOptions
- type OsLayerType
- type Version
Functions ¶
func AttachLayerStorageFilter ¶
func AttachLayerStorageFilter(ctx context.Context, layerPath string, layerData LayerData) (err error)
AttachLayerStorageFilter sets up the layer storage filter on a writable container layer.
`layerPath` is a path to a directory the writable layer is mounted. If the path does not end in a `\` the platform will append it automatically.
`layerData` is the parent read-only layer data.
func AttachOverlayFilter ¶
AttachOverlayFilter sets up a filter of the given type on a writable container layer. Currently the only supported filter types are WCIFS & UnionFS (defined in internal/hcs/schema2/layer.go)
`volumePath` is volume path at which writable layer is mounted. If the path does not end in a `\` the platform will append it automatically.
`layerData` is the parent read-only layer data.
func DestroyLayer ¶
DestroyLayer deletes a container layer.
`layerPath` is a path to a directory containing the layer to export.
func DetachLayerStorageFilter ¶
DetachLayerStorageFilter detaches the layer storage filter on a writable container layer.
`layerPath` is a path to a directory containing the layer to export.
func DetachOverlayFilter ¶
func DetachOverlayFilter(ctx context.Context, volumePath string, filterType hcsschema.FileSystemFilterType) (err error)
DetachOverlayFilter detaches the filter on a writable container layer.
`volumePath` is a path to writable container volume.
func ExportLayer ¶
func ExportLayer(ctx context.Context, layerPath, exportFolderPath string, layerData LayerData, options ExportLayerOptions) (err error)
ExportLayer exports a container layer.
`layerPath` is a path to a directory containing the layer to export.
`exportFolderPath` is a pre-existing folder to export the layer to.
`layerData` is the parent layer data.
`options` are the export options applied to the exported layer.
func FormatWritableLayerVhd ¶
FormatWritableLayerVhd formats a virtual disk for use as a writable container layer.
If the VHD is not mounted it will be temporarily mounted.
NOTE: This API had a breaking change in the operating system after Windows Server 2019. On ws2019 the API expects to get passed a file handle from CreateFile for the vhd that the caller wants to format. On > ws2019, its expected that the caller passes a vhd handle that can be obtained from the virtdisk APIs.
func GetLayerVhdMountPath ¶
GetLayerVhdMountPath returns the volume path for a virtual disk of a writable container layer.
func ImportLayer ¶
func ImportLayer(ctx context.Context, layerPath, sourceFolderPath string, layerData LayerData) (err error)
ImportLayer imports a container layer.
`layerPath` is a path to a directory to import the layer to. If the directory does not exist it will be automatically created.
`sourceFolderpath` is a pre-existing folder that contains the layer to import.
`layerData` is the parent layer data.
func InitializeWritableLayer ¶
func InitializeWritableLayer(ctx context.Context, layerPath string, layerData LayerData) (err error)
InitializeWritableLayer initializes a writable layer for a container.
`layerPath` is a path to a directory the layer is mounted. If the path does not end in a `\` the platform will append it automatically.
`layerData` is the parent read-only layer data.
func SetupBaseOSLayer ¶
func SetupBaseOSLayer(ctx context.Context, layerPath string, vhdHandle windows.Handle, options OsLayerOptions) (err error)
SetupBaseOSLayer sets up a layer that contains a base OS for a container.
`layerPath` is a path to a directory containing the layer.
`vhdHandle` is an empty file handle of `options.Type == OsLayerTypeContainer` or else it is a file handle to the 'SystemTemplateBase.vhdx' if `options.Type == OsLayerTypeVm`.
`options` are the options applied while processing the layer.
func SetupBaseOSVolume ¶
func SetupBaseOSVolume(ctx context.Context, layerPath, volumePath string, options OsLayerOptions) (err error)
SetupBaseOSVolume sets up a volume that contains a base OS for a container.
`layerPath` is a path to a directory containing the layer.
`volumePath` is the path to the volume to be used for setup.
`options` are the options applied while processing the layer.
NOTE: This API is only available on builds of Windows greater than 19645. Inside we check if the hosts build has the API available by using 'GetVersion' which requires the calling application to be manifested. https://docs.microsoft.com/en-us/windows/win32/sbscs/manifests
func SetupContainerBaseLayer ¶
func SetupContainerBaseLayer(ctx context.Context, layerPath, baseVhdPath, diffVhdPath string, sizeInGB uint64) (err error)
SetupContainerBaseLayer is a helper to setup a containers scratch. It will create and format the vhdx's inside and the size is configurable with the sizeInGB parameter.
`layerPath` is the path to the base container layer on disk.
`baseVhdPath` is the path to where the base vhdx for the base layer should be created.
`diffVhdPath` is the path where the differencing disk for the base layer should be created.
`sizeInGB` is the size in gigabytes to make the base vhdx.
func SetupUtilityVMBaseLayer ¶
func SetupUtilityVMBaseLayer(ctx context.Context, uvmPath, baseVhdPath, diffVhdPath string, sizeInGB uint64) (err error)
SetupUtilityVMBaseLayer is a helper to setup a UVMs scratch space. It will create and format the vhdx inside and the size is configurable by the sizeInGB parameter.
`uvmPath` is the path to the UtilityVM filesystem.
`baseVhdPath` is the path to where the base vhdx for the UVM should be created.
`diffVhdPath` is the path where the differencing disk for the UVM should be created.
`sizeInGB` specifies the size in gigabytes to make the base vhdx.
Types ¶
type ExportLayerOptions ¶
type ExportLayerOptions struct { IsWritableLayer bool `json:"IsWritableLayer,omitempty"` }
ExportLayerOptions are the set of options that are used with the `computestorage.HcsExportLayer` syscall.
type Layer ¶
type LayerData ¶
type LayerData struct { SchemaVersion Version `json:"SchemaVersion,omitempty"` Layers []Layer `json:"Layers,omitempty"` FilterType hcsschema.FileSystemFilterType `json:"FilterType,omitempty"` }
LayerData is the data used to describe parent layer information.
type OsLayerOptions ¶
type OsLayerOptions struct { Type OsLayerType `json:"Type,omitempty"` DisableCiCacheOptimization bool `json:"DisableCiCacheOptimization,omitempty"` SkipUpdateBcdForBoot bool `json:"SkipUpdateBcdForBoot,omitempty"` }
OsLayerOptions are the set of options that are used with the `SetupBaseOSLayer` and `SetupBaseOSVolume` calls.
type OsLayerType ¶
type OsLayerType string
OsLayerType is the type of layer being operated on.
const ( // OsLayerTypeContainer is a container layer. OsLayerTypeContainer OsLayerType = "Container" // OsLayerTypeVM is a virtual machine layer. OsLayerTypeVM OsLayerType = "Vm" )
type Version ¶
Source Files ¶
attach.go destroy.go detach.go export.go format.go helpers.go import.go initialize.go mount.go setup.go storage.go zsyscall_windows.go
- Version
- v0.13.0 (latest)
- Published
- Apr 21, 2025
- Platform
- windows/amd64
- Imports
- 16 packages
- Last checked
- 5 minutes ago –
Tools for package owners.