instancewriter

package
v6.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: Apache-2.0 Imports: 10 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() any

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

type InstanceRawWriter added in v6.18.0

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

InstanceRawWriter provides an InstanceWriter implementation that copies the contents of a file to another.

func NewInstanceRawWriter added in v6.18.0

func NewInstanceRawWriter(writer *os.File) *InstanceRawWriter

NewInstanceRawWriter returns an InstanceRawWriter for the provided target file.

func (*InstanceRawWriter) ResetHardLinkMap added in v6.18.0

func (crw *InstanceRawWriter) ResetHardLinkMap()

ResetHardLinkMap is a no-op.

func (*InstanceRawWriter) WriteFile added in v6.18.0

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

WriteFile is a no-op.

func (*InstanceRawWriter) WriteFileFromReader added in v6.18.0

func (crw *InstanceRawWriter) WriteFileFromReader(src io.Reader, fi os.FileInfo) error

WriteFileFromReader streams a file into the target file.

type InstanceTarWriter

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

InstanceTarWriter provides an InstanceWriter implementation that handles ID shifting and hardlink tracking.

func NewInstanceTarWriter

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

NewInstanceTarWriter returns an InstanceTarWriter 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.

type InstanceWriter added in v6.18.0

type InstanceWriter interface {
	ResetHardLinkMap()
	WriteFile(name string, srcPath string, fi os.FileInfo, ignoreGrowth bool) error
	WriteFileFromReader(src io.Reader, fi os.FileInfo) error
}

InstanceWriter is the instance writer interface.

Jump to

Keyboard shortcuts

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