storage.go 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. import (
  6. hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2"
  7. )
  8. //go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go storage.go
  9. //sys hcsImportLayer(layerPath string, sourceFolderPath string, layerData string) (hr error) = computestorage.HcsImportLayer?
  10. //sys hcsExportLayer(layerPath string, exportFolderPath string, layerData string, options string) (hr error) = computestorage.HcsExportLayer?
  11. //sys hcsDestroyLayer(layerPath string) (hr error) = computestorage.HcsDestoryLayer?
  12. //sys hcsSetupBaseOSLayer(layerPath string, handle windows.Handle, options string) (hr error) = computestorage.HcsSetupBaseOSLayer?
  13. //sys hcsInitializeWritableLayer(writableLayerPath string, layerData string, options string) (hr error) = computestorage.HcsInitializeWritableLayer?
  14. //sys hcsAttachLayerStorageFilter(layerPath string, layerData string) (hr error) = computestorage.HcsAttachLayerStorageFilter?
  15. //sys hcsDetachLayerStorageFilter(layerPath string) (hr error) = computestorage.HcsDetachLayerStorageFilter?
  16. //sys hcsFormatWritableLayerVhd(handle windows.Handle) (hr error) = computestorage.HcsFormatWritableLayerVhd?
  17. //sys hcsGetLayerVhdMountPath(vhdHandle windows.Handle, mountPath **uint16) (hr error) = computestorage.HcsGetLayerVhdMountPath?
  18. //sys hcsSetupBaseOSVolume(layerPath string, volumePath string, options string) (hr error) = computestorage.HcsSetupBaseOSVolume?
  19. type Version = hcsschema.Version
  20. type Layer = hcsschema.Layer
  21. // LayerData is the data used to describe parent layer information.
  22. type LayerData struct {
  23. SchemaVersion Version `json:"SchemaVersion,omitempty"`
  24. Layers []Layer `json:"Layers,omitempty"`
  25. }
  26. // ExportLayerOptions are the set of options that are used with the `computestorage.HcsExportLayer` syscall.
  27. type ExportLayerOptions struct {
  28. IsWritableLayer bool `json:"IsWritableLayer,omitempty"`
  29. }
  30. // OsLayerType is the type of layer being operated on.
  31. type OsLayerType string
  32. const (
  33. // OsLayerTypeContainer is a container layer.
  34. OsLayerTypeContainer OsLayerType = "Container"
  35. // OsLayerTypeVM is a virtual machine layer.
  36. OsLayerTypeVM OsLayerType = "Vm"
  37. )
  38. // OsLayerOptions are the set of options that are used with the `SetupBaseOSLayer` and
  39. // `SetupBaseOSVolume` calls.
  40. type OsLayerOptions struct {
  41. Type OsLayerType `json:"Type,omitempty"`
  42. DisableCiCacheOptimization bool `json:"DisableCiCacheOptimization,omitempty"`
  43. SkipUpdateBcdForBoot bool `json:"SkipUpdateBcdForBoot,omitempty"`
  44. }