instancewriter

package
v0.0.0-...-a810e79 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	FileName    string
	FileSize    int64
	FileMode    os.FileMode
	FileModTime time.Time
}

FileInfo static file implementation of os.FileInfo.

func (*FileInfo) IsDir

func (f *FileInfo) IsDir() bool

IsDir is file a directory.

func (*FileInfo) ModTime

func (f *FileInfo) ModTime() time.Time

ModTime of file.

func (*FileInfo) Mode

func (f *FileInfo) Mode() os.FileMode

Mode of file.

func (*FileInfo) Name

func (f *FileInfo) Name() string

Name of file.

func (*FileInfo) Size

func (f *FileInfo) Size() int64

Size of file.

func (*FileInfo) Sys

func (f *FileInfo) Sys() interface{}

Sys returns further unix attributes for a file owned by root.

type InstanceTarWriter

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

InstanceTarWriter provides a TarWriter implementation that handles ID shifting and hardlink tracking.

func NewInstanceTarWriter

func NewInstanceTarWriter(writer io.Writer, idmapSet *idmap.IdmapSet) *InstanceTarWriter

NewInstanceTarWriter returns a ContainerTarWriter for the provided target Writer and id map.

func (*InstanceTarWriter) Close

func (ctw *InstanceTarWriter) Close() error

Close finishes writing the tarball.

func (*InstanceTarWriter) ResetHardLinkMap

func (ctw *InstanceTarWriter) ResetHardLinkMap()

ResetHardLinkMap resets the hard link map. Use when copying multiple instances (or snapshots) into a tarball. So that the hard link map doesn't work across different instances/snapshots.

func (*InstanceTarWriter) WriteFile

func (ctw *InstanceTarWriter) WriteFile(name string, srcPath string, fi os.FileInfo, ignoreGrowth bool) error

WriteFile adds a file to the tarball with the specified name using the srcPath file as the contents of the file. The ignoreGrowth argument indicates whether to error if the srcPath file increases in size beyond the size in fi during the write. If false the write will return an error. If true, no error is returned, instead only the size specified in fi is written to the tarball. This can be used when you don't need a consistent copy of the file.

func (*InstanceTarWriter) WriteFileFromReader

func (ctw *InstanceTarWriter) WriteFileFromReader(src io.Reader, fi os.FileInfo) error

WriteFileFromReader streams a file into the tarball using the src reader. A manually generated os.FileInfo should be supplied so that the tar header can be added before streaming starts.

Jump to

Keyboard shortcuts

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