resources

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

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) 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 *layers.ImageLayers)

SetLayers updates the container resource's image layers

func (*Resources) SetNetNS

func (r *Resources) SetNetNS(netNS string)

SetNetNS updates the container resource's NetNS

Jump to

Keyboard shortcuts

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