computestorage

package
v0.0.0-...-2393a11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

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 DestroyLayer

func DestroyLayer(ctx context.Context, layerPath string) (err error)

DestroyLayer deletes a container layer.

`layerPath` is a path to a directory containing the layer to export.

func DetachLayerStorageFilter

func DetachLayerStorageFilter(ctx context.Context, layerPath string) (err error)

DetachLayerStorageFilter detaches the layer storage filter on a writable container layer.

`layerPath` is a path to a directory containing the layer to export.

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

func FormatWritableLayerVhd(ctx context.Context, vhdHandle windows.Handle) (err error)

FormatWritableLayerVhd formats a virtual disk for use as a writable container layer.

If the VHD is not mounted it will be temporarily mounted.

func GetLayerVhdMountPath

func GetLayerVhdMountPath(ctx context.Context, vhdHandle windows.Handle) (path string, err error)

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.

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 LayerData

type LayerData struct {
	SchemaVersion hcsschema.Version `json:"SchemaVersion,omitempty"`
	Layers        []hcsschema.Layer `json:"Layers,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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL