kopia

package
v0.0.0-...-c1b1270 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ErrNotPermitted = "operation not permitted"
View Source
const MaxErrorReported = 10
View Source
const UploaderConfigMultipartKey = "uploader-multipart"

Variables

This section is empty.

Functions

func Backup

func Backup(ctx context.Context, fsUploader SnapshotUploader, repoWriter repo.RepositoryWriter, sourcePath string, realSource string,
	forceFull bool, parentSnapshot string, volMode uploader.PersistentVolumeMode, uploaderCfg map[string]string, tags map[string]string, log logrus.FieldLogger) (*uploader.SnapshotInfo, bool, error)

Backup backup specific sourcePath and update progress

func GetKopiaManifestEntries

func GetKopiaManifestEntries(uMani []*udmrepo.ManifestEntryMetadata) []*manifest.EntryMetadata

GetKopiaManifestEntries get metadata list from specific ManifestEntryMetadata

func GetKopiaManifestEntry

func GetKopiaManifestEntry(uMani *udmrepo.ManifestEntryMetadata) *manifest.EntryMetadata

GetKopiaManifestEntry get metadata from specific ManifestEntryMetadata

func NewShimRepo

func NewShimRepo(repo udmrepo.BackupRepo) repo.RepositoryWriter

func Restore

func Restore(ctx context.Context, rep repo.RepositoryWriter, progress *Progress, snapshotID, dest string, volMode uploader.PersistentVolumeMode, uploaderCfg map[string]string,
	log logrus.FieldLogger, cancleCh chan struct{}) (int64, int32, error)

Restore restore specific sourcePath with given snapshotID and update progress

func SnapshotSource

func SnapshotSource(
	ctx context.Context,
	rep repo.RepositoryWriter,
	u SnapshotUploader,
	sourceInfo snapshot.SourceInfo,
	rootDir fs.Entry,
	forceFull bool,
	parentSnapshot string,
	snapshotTags map[string]string,
	uploaderCfg map[string]string,
	log logrus.FieldLogger,
	description string,
) (string, int64, error)

SnapshotSource which setup policy for snapshot, upload snapshot, update progress

Types

type BlockOutput

type BlockOutput struct {
	*restore.FilesystemOutput
	// contains filtered or unexported fields
}

func (*BlockOutput) BeginDirectory

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

func (*BlockOutput) WriteFile

func (o *BlockOutput) WriteFile(ctx context.Context, relativePath string, remoteFile fs.File, progressCb restore.FileWriteProgress) error

type Progress

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

Progress represents a backup or restore counters.

func NewProgress

func NewProgress(updater uploader.ProgressUpdater, interval time.Duration, log logrus.FieldLogger) *Progress

func (*Progress) CachedFile

func (p *Progress) CachedFile(fname string, numBytes int64)

CachedFile statistic the total bytes been cached currently

func (*Progress) Enabled

func (p *Progress) Enabled() bool

func (*Progress) Error

func (p *Progress) Error(path string, err error, isIgnored bool)

Error statistic the total Error has occurred

func (*Progress) EstimatedDataSize

func (p *Progress) EstimatedDataSize(fileCount int64, totalBytes int64)

EstimatedDataSize statistic the total size of files to be processed and total files to be processed

func (*Progress) EstimationParameters

func (p *Progress) EstimationParameters() snapshotfs.EstimationParameters

func (*Progress) ExcludedDir

func (p *Progress) ExcludedDir(dirname string)

ExcludedDir statistic the dir been excluded currently

func (*Progress) ExcludedFile

func (p *Progress) ExcludedFile(fname string, numBytes int64)

ExcludedFile statistic the file been excluded currently

func (*Progress) FinishedDirectory

func (p *Progress) FinishedDirectory(dirname string)

FinishedDirectory called when finish to upload one directory

func (*Progress) FinishedFile

func (p *Progress) FinishedFile(fname string, err error)

func (*Progress) FinishedHashingFile

func (p *Progress) FinishedHashingFile(fname string, numBytes int64)

FinishedHashingFile which will called when specific file finished hash

func (*Progress) HashedBytes

func (p *Progress) HashedBytes(numBytes int64)

HashedBytes statistic the total bytes been hashed currently

func (*Progress) HashingFile

func (p *Progress) HashingFile(fname string)

HashingFile statistic the file been hashed currently

func (*Progress) ProgressBytes

func (p *Progress) ProgressBytes(processedBytes int64, totalBytes int64)

ProgressBytes which statistic all bytes has been processed currently

func (*Progress) StartedDirectory

func (p *Progress) StartedDirectory(dirname string)

StartedDirectory called when begin to upload one directory

func (*Progress) UpdateProgress

func (p *Progress) UpdateProgress()

UpdateProgress which calls Updater UpdateProgress interface, update progress by third-party implementation

func (*Progress) UploadFinished

func (p *Progress) UploadFinished()

UploadFinished which report the files flushed after the Upload has completed.

func (*Progress) UploadStarted

func (p *Progress) UploadStarted()

UploadStarted statistic the total Error has occurred

func (*Progress) UploadedBytes

func (p *Progress) UploadedBytes(numBytes int64)

UploadedBytes the total bytes has uploaded currently

type SnapshotUploader

type SnapshotUploader interface {
	Upload(
		ctx context.Context,
		source fs.Entry,
		policyTree *policy.Tree,
		sourceInfo snapshot.SourceInfo,
		previousManifests ...*snapshot.Manifest,
	) (*snapshot.Manifest, error)
}

SnapshotUploader which mainly used for UT test that could overwrite Upload interface

type Throttle

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

Throttle throttles controlle the interval of output result

func (*Throttle) ShouldOutput

func (t *Throttle) ShouldOutput() bool

Jump to

Keyboard shortcuts

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