package resources

import "github.com/Microsoft/hcsshim/internal/resources"

Package resources handles creating, updating, and releasing resources on a container

Index

Functions

func ReleaseResources

func ReleaseResources(ctx context.Context, r *Resources, vm *uvm.UtilityVM, all bool) error

ReleaseResources releases/frees all of the resources associated with a container. This includes Plan9 shares, vsmb mounts, pipe mounts, network endpoints, scsi mounts, vpci devices and layers. TODO: make method on Resources struct.

Types

type ResourceCloser

type ResourceCloser interface {
	Release(context.Context) error
}

ResourceCloser is a generic interface for the releasing of a resource. If a resource implements this interface(which they all should), freeing of that resource should entail one call to <resourceName>.Release(ctx)

type Resources

type Resources struct {
	// contains filtered or unexported fields
}

Resources is the structure returned as part of creating a container. It holds nothing useful to clients, hence everything is lowercased. A client would use it in a call to ReleaseResources to ensure everything is cleaned up when a container exits.

func NewContainerResources

func NewContainerResources(id string) *Resources

NewContainerResources returns a new empty container Resources struct with the given container id

func (*Resources) Add

func (r *Resources) Add(newResources ...ResourceCloser)

Add adds one or more resource closers to the resources struct to be tracked for release later on

func (*Resources) ContainerRootInUVM

func (r *Resources) ContainerRootInUVM() string

ContainerRootInUVM returns the containerRootInUVM for the container

func (*Resources) LcowScratchPath

func (r *Resources) LcowScratchPath() string

func (*Resources) NetNS

func (r *Resources) NetNS() string

NetNS returns the network namespace for the container

func (*Resources) SetAddedNetNSToVM

func (r *Resources) SetAddedNetNSToVM(addedNetNSToVM bool)

SetAddedNetNSToVM updates the container resource's AddedNetNSToVM value

func (*Resources) SetContainerRootInUVM

func (r *Resources) SetContainerRootInUVM(containerRootInUVM string)

SetContainerRootInUVM updates the container resource's containerRootInUVM value

func (*Resources) SetCreatedNetNS

func (r *Resources) SetCreatedNetNS(created bool)

SetCreatedNetNS updates the container resource's CreatedNetNS value

func (*Resources) SetLayers

func (r *Resources) SetLayers(l ResourceCloser)

SetLayers updates the container resource's image layers

func (*Resources) SetLcowScratchPath

func (r *Resources) SetLcowScratchPath(scratchPath string)

func (*Resources) SetNetNS

func (r *Resources) SetNetNS(netNS string)

SetNetNS updates the container resource's NetNS

Source Files

doc.go resources.go

Version
v0.11.7
Published
Jun 27, 2024
Platform
windows/amd64
Imports
5 packages
Last checked
57 seconds ago

Tools for package owners.