Documentation ¶
Index ¶
- func EnsureRemoveAll(dir string) error
- type Archiver
- func (archiver *Archiver) CopyFileWithTar(src, dst string) (retErr error)
- func (archiver *Archiver) CopyWithTar(src, dst string) error
- func (archiver *Archiver) IdentityMapping() idtools.IdentityMapping
- func (archiver *Archiver) TarUntar(src, dst string) error
- func (archiver *Archiver) UntarPath(src, dst string) error
- type ContainerFS
- type Driver
- type TarFunc
- type UntarFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureRemoveAll ¶
EnsureRemoveAll wraps `os.RemoveAll` to check for specific errors that can often be remedied. Only use `EnsureRemoveAll` if you really want to make every effort to remove a directory.
Because of the way `os.Remove` (and by extension `os.RemoveAll`) works, there can be a race between reading directory entries and then actually attempting to remove everything in the directory. These types of errors do not need to be returned since it's ok for the dir to be gone we can just retry the remove operation.
This should not return a `os.ErrNotExist` kind of error under any circumstances
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 ¶
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 ¶
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.
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. 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