backup

package
v0.0.0-...-53483ec Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	Files, Dirs, Bytes uint64
}

type JSONProgress

type JSONProgress struct {
	*ui.Message
	*ui.StdioWrapper
	// contains filtered or unexported fields
}

JSONProgress reports progress for the `backup` command in JSON.

func NewJSONProgress

func NewJSONProgress(term *termstatus.Terminal, verbosity uint) *JSONProgress

NewJSONProgress returns a new backup progress reporter.

func (*JSONProgress) CompleteItem

func (b *JSONProgress) CompleteItem(messageType, item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration)

CompleteItem is the status callback function for the archiver when a file/dir has been saved successfully.

func (*JSONProgress) Error

func (b *JSONProgress) Error(item string, fi os.FileInfo, err error) error

Error is the error callback function for the archiver, it prints the error and returns nil.

func (*JSONProgress) Finish

func (b *JSONProgress) Finish(snapshotID restic.ID, start time.Time, summary *Summary, dryRun bool)

Finish prints the finishing messages.

func (*JSONProgress) ReportTotal

func (b *JSONProgress) ReportTotal(item string, start time.Time, s archiver.ScanStats)

ReportTotal sets the total stats up to now

func (*JSONProgress) Reset

func (b *JSONProgress) Reset()

Reset no-op

func (*JSONProgress) ScannerError

func (b *JSONProgress) ScannerError(item string, fi os.FileInfo, err error) error

ScannerError is the error callback function for the scanner, it prints the error in verbose mode and returns nil.

func (*JSONProgress) Update

func (b *JSONProgress) Update(total, processed Counter, errors uint, currentFiles map[string]struct{}, start time.Time, secs uint64)

Update updates the status lines.

type Progress

type Progress struct {
	MinUpdatePause time.Duration
	// contains filtered or unexported fields
}

Progress reports progress for the `backup` command.

func NewProgress

func NewProgress(printer ProgressPrinter) *Progress

func (*Progress) CompleteBlob

func (p *Progress) CompleteBlob(filename string, bytes uint64)

CompleteBlob is called for all saved blobs for files.

func (*Progress) CompleteItem

func (p *Progress) CompleteItem(item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration)

CompleteItem is the status callback function for the archiver when a file/dir has been saved successfully.

func (*Progress) Error

func (p *Progress) Error(item string, fi os.FileInfo, err error) error

Error is the error callback function for the archiver, it prints the error and returns nil.

func (*Progress) Finish

func (p *Progress) Finish(snapshotID restic.ID)

Finish prints the finishing messages.

func (*Progress) ReportTotal

func (p *Progress) ReportTotal(item string, s archiver.ScanStats)

ReportTotal sets the total stats up to now

func (*Progress) Run

func (p *Progress) Run(ctx context.Context) error

Run regularly updates the status lines. It should be called in a separate goroutine.

func (*Progress) ScannerError

func (p *Progress) ScannerError(item string, fi os.FileInfo, err error) error

ScannerError is the error callback function for the scanner, it prints the error in verbose mode and returns nil.

func (*Progress) SetDryRun

func (p *Progress) SetDryRun()

SetDryRun marks the backup as a "dry run".

func (*Progress) SetMinUpdatePause

func (p *Progress) SetMinUpdatePause(d time.Duration)

SetMinUpdatePause sets b.MinUpdatePause. It satisfies the ArchiveProgressReporter interface.

func (*Progress) StartFile

func (p *Progress) StartFile(filename string)

StartFile is called when a file is being processed by a worker.

type ProgressPrinter

type ProgressPrinter interface {
	Update(total, processed Counter, errors uint, currentFiles map[string]struct{}, start time.Time, secs uint64)
	Error(item string, fi os.FileInfo, err error) error
	ScannerError(item string, fi os.FileInfo, err error) error
	CompleteItem(messageType string, item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration)
	ReportTotal(item string, start time.Time, s archiver.ScanStats)
	Finish(snapshotID restic.ID, start time.Time, summary *Summary, dryRun bool)
	Reset()

	// ui.StdioWrapper
	Stdout() io.WriteCloser
	Stderr() io.WriteCloser

	E(msg string, args ...interface{})
	P(msg string, args ...interface{})
	V(msg string, args ...interface{})
	VV(msg string, args ...interface{})
}

type ProgressReporter

type ProgressReporter interface {
	CompleteItem(item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration)
	StartFile(filename string)
	CompleteBlob(filename string, bytes uint64)
	ScannerError(item string, fi os.FileInfo, err error) error
	ReportTotal(item string, s archiver.ScanStats)
	SetMinUpdatePause(d time.Duration)
	Run(ctx context.Context) error
	Error(item string, fi os.FileInfo, err error) error
	Finish(snapshotID restic.ID)
}

type Summary

type Summary struct {
	sync.Mutex
	Files, Dirs struct {
		New       uint
		Changed   uint
		Unchanged uint
	}
	ProcessedBytes uint64
	archiver.ItemStats
}

type TextProgress

type TextProgress struct {
	*ui.Message
	*ui.StdioWrapper
	// contains filtered or unexported fields
}

TextProgress reports progress for the `backup` command.

func NewTextProgress

func NewTextProgress(term *termstatus.Terminal, verbosity uint) *TextProgress

NewTextProgress returns a new backup progress reporter.

func (*TextProgress) CompleteItem

func (b *TextProgress) CompleteItem(messageType, item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration)

CompleteItem is the status callback function for the archiver when a file/dir has been saved successfully.

func (*TextProgress) Error

func (b *TextProgress) Error(item string, fi os.FileInfo, err error) error

Error is the error callback function for the archiver, it prints the error and returns nil.

func (*TextProgress) Finish

func (b *TextProgress) Finish(snapshotID restic.ID, start time.Time, summary *Summary, dryRun bool)

Finish prints the finishing messages.

func (*TextProgress) ReportTotal

func (b *TextProgress) ReportTotal(item string, start time.Time, s archiver.ScanStats)

ReportTotal sets the total stats up to now

func (*TextProgress) Reset

func (b *TextProgress) Reset()

Reset status

func (*TextProgress) ScannerError

func (b *TextProgress) ScannerError(item string, fi os.FileInfo, err error) error

ScannerError is the error callback function for the scanner, it prints the error in verbose mode and returns nil.

func (*TextProgress) Update

func (b *TextProgress) Update(total, processed Counter, errors uint, currentFiles map[string]struct{}, start time.Time, secs uint64)

Update updates the status lines.

Jump to

Keyboard shortcuts

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