containerfs

package
v1.3.3-0...-c71bbab Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Archiver

type Archiver struct {
	SrcDriver Driver
	DstDriver Driver
	Tar       TarFunc
	Untar     UntarFunc
	IDMapping *idtools.IdentityMapping
}

Archiver provides a similar implementation of the archive.Archiver package with the rootfs abstraction

func (*Archiver) CopyFileWithTar

func (archiver *Archiver) CopyFileWithTar(src, dst string) (retErr error)

CopyFileWithTar emulates the behavior of the 'cp' command-line for a single file. It copies a regular file from path `src` to path `dst`, and preserves all its metadata.

func (*Archiver) CopyWithTar

func (archiver *Archiver) CopyWithTar(src, dst string) error

CopyWithTar creates a tar archive of filesystem path `src`, and unpacks it at filesystem path `dst`. The archive is streamed directly with fixed buffering and no intermediary disk IO.

func (*Archiver) IdentityMapping

func (archiver *Archiver) IdentityMapping() *idtools.IdentityMapping

IdentityMapping returns the IdentityMapping of the archiver.

func (*Archiver) TarUntar

func (archiver *Archiver) TarUntar(src, dst string) error

TarUntar is a convenience function which calls Tar and Untar, with the output of one piped into the other. If either Tar or Untar fails, TarUntar aborts and returns the error.

func (*Archiver) UntarPath

func (archiver *Archiver) UntarPath(src, dst string) error

UntarPath untar a file from path to a destination, src is the source tar file path.

type ContainerFS

type ContainerFS interface {
	// Path returns the path to the root. Note that this may not exist
	// on the local system, so the continuity operations must be used
	Path() string

	// ResolveScopedPath evaluates the given path scoped to the root.
	// For example, if root=/a, and path=/b/c, then this function would return /a/b/c.
	// If rawPath is true, then the function will not preform any modifications
	// before path resolution. Otherwise, the function will clean the given path
	// by making it an absolute path.
	ResolveScopedPath(path string, rawPath bool) (string, error)

	Driver
}

ContainerFS is that represents a root file system

func NewLocalContainerFS

func NewLocalContainerFS(path string) ContainerFS

NewLocalContainerFS is a helper function to implement daemon's Mount interface when the graphdriver mount point is a local path on the machine.

type Driver

type Driver interface {
	// OS returns the OS where the rootfs is located. Essentially,
	// runtime.GOOS for everything aside from LCOW, which is "linux"
	OS() string

	// Architecture returns the hardware architecture where the
	// container is located.
	Architecture() string

	// Driver & PathDriver provide methods to manipulate files & paths
	driver.Driver
	pathdriver.PathDriver
}

Driver combines both continuity's Driver and PathDriver interfaces with a Platform field to determine the OS.

func NewLocalDriver

func NewLocalDriver() Driver

NewLocalDriver provides file and path drivers for a local file system. They are essentially a wrapper around the `os` and `filepath` functions.

type TarFunc

type TarFunc func(string, *archive.TarOptions) (io.ReadCloser, error)

TarFunc provides a function definition for a custom Tar function

type UntarFunc

type UntarFunc func(io.Reader, string, *archive.TarOptions) error

UntarFunc provides a function definition for a custom Untar function

Jump to

Keyboard shortcuts

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