1 // Package computestorage is a wrapper around the HCS storage APIs. These are new storage APIs introduced 2 // separate from the original graphdriver calls intended to give more freedom around creating 3 // and managing container layers and scratch spaces. 4 package computestorage 5 6 import ( 7 hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" 8 ) 9 10 //go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go storage.go 11 12 //sys hcsImportLayer(layerPath string, sourceFolderPath string, layerData string) (hr error) = computestorage.HcsImportLayer? 13 //sys hcsExportLayer(layerPath string, exportFolderPath string, layerData string, options string) (hr error) = computestorage.HcsExportLayer? 14 //sys hcsDestroyLayer(layerPath string) (hr error) = computestorage.HcsDestoryLayer? 15 //sys hcsSetupBaseOSLayer(layerPath string, handle windows.Handle, options string) (hr error) = computestorage.HcsSetupBaseOSLayer? 16 //sys hcsInitializeWritableLayer(writableLayerPath string, layerData string, options string) (hr error) = computestorage.HcsInitializeWritableLayer? 17 //sys hcsAttachLayerStorageFilter(layerPath string, layerData string) (hr error) = computestorage.HcsAttachLayerStorageFilter? 18 //sys hcsDetachLayerStorageFilter(layerPath string) (hr error) = computestorage.HcsDetachLayerStorageFilter? 19 //sys hcsFormatWritableLayerVhd(handle windows.Handle) (hr error) = computestorage.HcsFormatWritableLayerVhd? 20 //sys hcsGetLayerVhdMountPath(vhdHandle windows.Handle, mountPath **uint16) (hr error) = computestorage.HcsGetLayerVhdMountPath? 21 //sys hcsSetupBaseOSVolume(layerPath string, volumePath string, options string) (hr error) = computestorage.HcsSetupBaseOSVolume? 22 23 type Version = hcsschema.Version 24 type Layer = hcsschema.Layer 25 26 // LayerData is the data used to describe parent layer information. 27 type LayerData struct { 28 SchemaVersion Version `json:"SchemaVersion,omitempty"` 29 Layers []Layer `json:"Layers,omitempty"` 30 } 31 32 // ExportLayerOptions are the set of options that are used with the `computestorage.HcsExportLayer` syscall. 33 type ExportLayerOptions struct { 34 IsWritableLayer bool `json:"IsWritableLayer,omitempty"` 35 } 36 37 // OsLayerType is the type of layer being operated on. 38 type OsLayerType string 39 40 const ( 41 // OsLayerTypeContainer is a container layer. 42 OsLayerTypeContainer OsLayerType = "Container" 43 // OsLayerTypeVM is a virtual machine layer. 44 OsLayerTypeVM OsLayerType = "Vm" 45 ) 46 47 // OsLayerOptions are the set of options that are used with the `SetupBaseOSLayer` and 48 // `SetupBaseOSVolume` calls. 49 type OsLayerOptions struct { 50 Type OsLayerType `json:"Type,omitempty"` 51 DisableCiCacheOptimization bool `json:"DisableCiCacheOptimization,omitempty"` 52 SkipUpdateBcdForBoot bool `json:"SkipUpdateBcdForBoot,omitempty"` 53 } 54