Documentation ¶
Index ¶
- func ActivateLayer(path string) error
- func CreateLayer(path, parent string) error
- func CreateScratchLayer(path string, parentLayerPaths []string) error
- func DeactivateLayer(path string) error
- func DestroyLayer(path string) error
- func ExpandScratchSize(path string, size uint64) error
- func ExportLayer(path string, exportFolderPath string, parentLayerPaths []string) error
- func GetLayerMountPath(path string) (string, error)
- func GetSharedBaseImages() (imageData string, err error)
- func GrantVmAccess(vmid string, filepath string) error
- func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) error
- func LayerExists(path string) (bool, error)
- func LayerID(path string) (guid.GUID, error)
- func NameToGuid(name string) (id guid.GUID, err error)
- func PrepareLayer(path string, parentLayerPaths []string) error
- func ProcessBaseLayer(path string) error
- func ProcessUtilityVMImage(path string) error
- func UnprepareLayer(path string) error
- type LayerReader
- type LayerWriter
- type WC_LAYER_DESCRIPTOR
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivateLayer ¶
ActivateLayer will find the layer with the given id and mount it's filesystem. For a read/write layer, the mounted filesystem will appear as a volume on the host, while a read-only layer is generally expected to be a no-op. An activated layer must later be deactivated via DeactivateLayer.
func CreateLayer ¶
CreateLayer creates a new, empty, read-only layer on the filesystem based on the parent layer provided.
func CreateScratchLayer ¶
CreateScratchLayer creates and populates new read-write layer for use by a container. This requires both the id of the direct parent layer, as well as the full list of paths to all parent layers up to the base (and including the direct parent whose id was provided).
func DeactivateLayer ¶
DeactivateLayer will dismount a layer that was mounted via ActivateLayer.
func DestroyLayer ¶
DestroyLayer will remove the on-disk files representing the layer with the given path, including that layer's containing folder, if any.
func ExpandScratchSize ¶
ExpandScratchSize expands the size of a layer to at least size bytes.
func ExportLayer ¶
ExportLayer will create a folder at exportFolderPath and fill that folder with the transport format version of the layer identified by layerId. This transport format includes any metadata required for later importing the layer (using ImportLayer), and requires the full list of parent layer paths in order to perform the export.
func GetLayerMountPath ¶
GetLayerMountPath will look for a mounted layer with the given path and return the path at which that layer can be accessed. This path may be a volume path if the layer is a mounted read-write layer, otherwise it is expected to be the folder path at which the layer is stored.
func GetSharedBaseImages ¶
GetSharedBaseImages will enumerate the images stored in the common central image store and return descriptive info about those images for the purpose of registering them with the graphdriver, graph, and tagstore.
func GrantVmAccess ¶
GrantVmAccess adds access to a file for a given VM
func ImportLayer ¶
ImportLayer will take the contents of the folder at importFolderPath and import that into a layer with the id layerId. Note that in order to correctly populate the layer and interperet the transport format, all parent layers must already be present on the system at the paths provided in parentLayerPaths.
func LayerExists ¶
LayerExists will return true if a layer with the given id exists and is known to the system.
func NameToGuid ¶
NameToGuid converts the given string into a GUID using the algorithm in the Host Compute Service, ensuring GUIDs generated with the same string are common across all clients.
func PrepareLayer ¶
PrepareLayer finds a mounted read-write layer matching path and enables the the filesystem filter for use on that layer. This requires the paths to all parent layers, and is necessary in order to view or interact with the layer as an actual filesystem (reading and writing files, creating directories, etc). Disabling the filter must be done via UnprepareLayer.
func ProcessBaseLayer ¶
ProcessBaseLayer post-processes a base layer that has had its files extracted. The files should have been extracted to <path>\Files.
func ProcessUtilityVMImage ¶
ProcessUtilityVMImage post-processes a utility VM image that has had its files extracted. The files should have been extracted to <path>\Files.
func UnprepareLayer ¶
UnprepareLayer disables the filesystem filter for the read-write layer with the given id.
Types ¶
type LayerReader ¶
type LayerReader interface { Next() (string, int64, *winio.FileBasicInfo, error) Read(b []byte) (int, error) Close() error }
func NewLayerReader ¶
func NewLayerReader(path string, parentLayerPaths []string) (LayerReader, error)
NewLayerReader returns a new layer reader for reading the contents of an on-disk layer. The caller must have taken the SeBackupPrivilege privilege to call this and any methods on the resulting LayerReader.
type LayerWriter ¶
type LayerWriter interface { // Add adds a file to the layer with given metadata. Add(name string, fileInfo *winio.FileBasicInfo) error // AddLink adds a hard link to the layer. The target must already have been added. AddLink(name string, target string) error // Remove removes a file that was present in a parent layer from the layer. Remove(name string) error // Write writes data to the current file. The data must be in the format of a Win32 // backup stream. Write(b []byte) (int, error) // Close finishes the layer writing process and releases any resources. Close() error }
LayerWriter is an interface that supports writing a new container image layer.
func NewLayerWriter ¶
func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error)
NewLayerWriter returns a new layer writer for creating a layer on disk. The caller must have taken the SeBackupPrivilege and SeRestorePrivilege privileges to call this and any methods on the resulting LayerWriter.
type WC_LAYER_DESCRIPTOR ¶
To pass into syscall, we need a struct matching the following:
typedef struct _WC_LAYER_DESCRIPTOR {
// // The ID of the layer // GUID LayerId; // // Additional flags // union { struct { ULONG Reserved : 31; ULONG Dirty : 1; // Created from sandbox as a result of snapshot }; ULONG Value; } Flags; // // Path to the layer root directory, null-terminated // PCWSTR Path;
} WC_LAYER_DESCRIPTOR, *PWC_LAYER_DESCRIPTOR;
Source Files ¶
- activatelayer.go
- baselayer.go
- createlayer.go
- createscratchlayer.go
- deactivatelayer.go
- destroylayer.go
- expandscratchsize.go
- exportlayer.go
- getlayermountpath.go
- getsharedbaseimages.go
- grantvmaccess.go
- importlayer.go
- layerexists.go
- layerid.go
- layerutils.go
- legacy.go
- nametoguid.go
- preparelayer.go
- processimage.go
- unpreparelayer.go
- wclayer.go