restore

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Overview

Package restore manages restoring filesystem snapshots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilesystemOutput

type FilesystemOutput struct {
	// TargetPath for restore.
	TargetPath string `json:"targetPath"`

	// If a directory already exists, overwrite the directory.
	OverwriteDirectories bool `json:"overwriteDirectories"`

	// Indicate whether or not to overwrite existing files. When set to false,
	// the copier does not modify already existing files and returns an error
	// instead.
	OverwriteFiles bool `json:"overwriteFiles"`

	// If a symlink already exists, remove it and create a new one. When set to
	// false, the copier does not modify existing symlinks and will return an
	// error instead.
	OverwriteSymlinks bool `json:"overwriteSymlinks"`

	// IgnorePermissionErrors causes restore to ignore errors due to invalid permissions.
	IgnorePermissionErrors bool `json:"ignorePermissionErrors"`

	// SkipOwners when set to true causes restore to skip restoring owner information.
	SkipOwners bool `json:"skipOwners"`

	// SkipPermissions when set to true causes restore to skip restoring permission information.
	SkipPermissions bool `json:"skipPermissions"`

	// SkipTimes when set to true causes restore to skip restoring modification times.
	SkipTimes bool `json:"skipTimes"`
}

FilesystemOutput contains the options for outputting a file system tree.

func (*FilesystemOutput) BeginDirectory

func (o *FilesystemOutput) BeginDirectory(ctx context.Context, relativePath string, e fs.Directory) error

BeginDirectory implements restore.Output interface.

func (*FilesystemOutput) Close

func (o *FilesystemOutput) Close(ctx context.Context) error

Close implements restore.Output interface.

func (o *FilesystemOutput) CreateSymlink(ctx context.Context, relativePath string, e fs.Symlink) error

CreateSymlink implements restore.Output interface.

func (*FilesystemOutput) FileExists added in v0.8.0

func (o *FilesystemOutput) FileExists(ctx context.Context, relativePath string, e fs.File) bool

FileExists implements restore.Output interface.

func (*FilesystemOutput) FinishDirectory

func (o *FilesystemOutput) FinishDirectory(ctx context.Context, relativePath string, e fs.Directory) error

FinishDirectory implements restore.Output interface.

func (*FilesystemOutput) Parallelizable added in v0.7.3

func (o *FilesystemOutput) Parallelizable() bool

Parallelizable implements restore.Output interface.

func (*FilesystemOutput) SymlinkExists added in v0.8.0

func (o *FilesystemOutput) SymlinkExists(ctx context.Context, relativePath string, e fs.Symlink) bool

SymlinkExists implements restore.Output interface.

func (*FilesystemOutput) WriteFile

func (o *FilesystemOutput) WriteFile(ctx context.Context, relativePath string, f fs.File) error

WriteFile implements restore.Output interface.

type Options added in v0.7.3

type Options struct {
	Parallel     int  `json:"parallel"`
	Incremental  bool `json:"incremental"`
	IgnoreErrors bool `json:"ignoreErrors"`

	ProgressCallback func(ctx context.Context, s Stats)
	Cancel           chan struct{} // channel that can be externally closed to signal cancelation
}

Options provides optional restore parameters.

type Output

type Output interface {
	Parallelizable() bool
	BeginDirectory(ctx context.Context, relativePath string, e fs.Directory) error
	FinishDirectory(ctx context.Context, relativePath string, e fs.Directory) error
	WriteFile(ctx context.Context, relativePath string, e fs.File) error
	FileExists(ctx context.Context, relativePath string, e fs.File) bool
	CreateSymlink(ctx context.Context, relativePath string, e fs.Symlink) error
	SymlinkExists(ctx context.Context, relativePath string, e fs.Symlink) bool
	Close(ctx context.Context) error
}

Output encapsulates output for restore operation.

type Stats

type Stats struct {
	RestoredTotalFileSize int64
	EnqueuedTotalFileSize int64
	SkippedTotalFileSize  int64

	RestoredFileCount    int32
	RestoredDirCount     int32
	RestoredSymlinkCount int32
	EnqueuedFileCount    int32
	EnqueuedDirCount     int32
	EnqueuedSymlinkCount int32
	SkippedCount         int32
	IgnoredErrorCount    int32
}

Stats represents restore statistics.

func Entry added in v0.7.2

func Entry(ctx context.Context, rep repo.Repository, output Output, rootEntry fs.Entry, options Options) (Stats, error)

Entry walks a snapshot root with given root entry and restores it to the provided output.

type TarOutput

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

TarOutput contains the options for outputting a file system tree to a tar or .tar.gz file.

func NewTarOutput

func NewTarOutput(w io.WriteCloser) *TarOutput

NewTarOutput creates new tar writer output.

func (*TarOutput) BeginDirectory

func (o *TarOutput) BeginDirectory(ctx context.Context, relativePath string, d fs.Directory) error

BeginDirectory implements restore.Output interface.

func (*TarOutput) Close

func (o *TarOutput) Close(ctx context.Context) error

Close implements restore.Output interface.

func (o *TarOutput) CreateSymlink(ctx context.Context, relativePath string, l fs.Symlink) error

CreateSymlink implements restore.Output interface.

func (*TarOutput) FileExists added in v0.8.0

func (o *TarOutput) FileExists(ctx context.Context, relativePath string, f fs.File) bool

FileExists implements restore.Output interface.

func (*TarOutput) FinishDirectory

func (o *TarOutput) FinishDirectory(ctx context.Context, relativePath string, e fs.Directory) error

FinishDirectory implements restore.Output interface.

func (*TarOutput) Parallelizable added in v0.7.3

func (o *TarOutput) Parallelizable() bool

Parallelizable implements restore.Output interface.

func (*TarOutput) SymlinkExists added in v0.8.0

func (o *TarOutput) SymlinkExists(ctx context.Context, relativePath string, l fs.Symlink) bool

SymlinkExists implements restore.Output interface.

func (*TarOutput) WriteFile

func (o *TarOutput) WriteFile(ctx context.Context, relativePath string, f fs.File) error

WriteFile implements restore.Output interface.

type ZipOutput

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

ZipOutput contains the options for outputting a file system tree to a zip file.

func NewZipOutput

func NewZipOutput(w io.WriteCloser, method uint16) *ZipOutput

NewZipOutput creates new zip writer output.

func (*ZipOutput) BeginDirectory

func (o *ZipOutput) BeginDirectory(ctx context.Context, relativePath string, e fs.Directory) error

BeginDirectory implements restore.Output interface.

func (*ZipOutput) Close

func (o *ZipOutput) Close(ctx context.Context) error

Close implements restore.Output interface.

func (o *ZipOutput) CreateSymlink(ctx context.Context, relativePath string, e fs.Symlink) error

CreateSymlink implements restore.Output interface.

func (*ZipOutput) FileExists added in v0.8.0

func (o *ZipOutput) FileExists(ctx context.Context, relativePath string, l fs.File) bool

FileExists implements restore.Output interface.

func (*ZipOutput) FinishDirectory

func (o *ZipOutput) FinishDirectory(ctx context.Context, relativePath string, e fs.Directory) error

FinishDirectory implements restore.Output interface.

func (*ZipOutput) Parallelizable added in v0.7.3

func (o *ZipOutput) Parallelizable() bool

Parallelizable implements restore.Output interface.

func (*ZipOutput) SymlinkExists added in v0.8.0

func (o *ZipOutput) SymlinkExists(ctx context.Context, relativePath string, l fs.Symlink) bool

SymlinkExists implements restore.Output interface.

func (*ZipOutput) WriteFile

func (o *ZipOutput) WriteFile(ctx context.Context, relativePath string, f fs.File) error

WriteFile implements restore.Output interface.

Jump to

Keyboard shortcuts

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