checker

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: BSD-2-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLegacyLayout = errors.New("repository uses S3 legacy layout")

ErrLegacyLayout is returned when the repository uses the S3 legacy layout.

Functions

func IsOrphanedPack added in v0.9.0

func IsOrphanedPack(err error) bool

IsOrphanedPack returns true if the error describes a pack which is not contained in any index.

func TestCheckRepo

func TestCheckRepo(t testing.TB, repo restic.Repository)

TestCheckRepo runs the checker on repo.

Types

type Checker

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

Checker runs various checks on a repository. It is advisable to create an exclusive Lock in the repository before running any checks.

A Checker only tests for internal errors within the data structures of the repository (e.g. missing blobs), and needs a valid Repository to work on.

func New

func New(repo restic.Repository, trackUnused bool) *Checker

New returns a new checker which runs on repo.

func (*Checker) CountPacks

func (c *Checker) CountPacks() uint64

CountPacks returns the number of packs in the repository.

func (*Checker) GetPacks added in v0.8.3

func (c *Checker) GetPacks() map[restic.ID]int64

GetPacks returns IDSet of packs in the repository

func (*Checker) LoadIndex

func (c *Checker) LoadIndex(ctx context.Context) (hints []error, errs []error)

LoadIndex loads all index files.

func (*Checker) LoadSnapshots added in v0.14.0

func (c *Checker) LoadSnapshots(ctx context.Context) error

func (*Checker) Packs

func (c *Checker) Packs(ctx context.Context, errChan chan<- error)

Packs checks that all packs referenced in the index are still available and there are no packs that aren't in an index. errChan is closed after all packs have been checked.

func (*Checker) ReadData

func (c *Checker) ReadData(ctx context.Context, errChan chan<- error)

ReadData loads all data from the repository and checks the integrity.

func (*Checker) ReadPacks added in v0.8.3

func (c *Checker) ReadPacks(ctx context.Context, packs map[restic.ID]int64, p *progress.Counter, errChan chan<- error)

ReadPacks loads data from specified packs and checks the integrity.

func (*Checker) Structure

func (c *Checker) Structure(ctx context.Context, p *progress.Counter, errChan chan<- error)

Structure checks that for all snapshots all referenced data blobs and subtrees are available in the index. errChan is closed after all trees have been traversed.

func (*Checker) UnusedBlobs

func (c *Checker) UnusedBlobs(ctx context.Context) (blobs restic.BlobHandles)

UnusedBlobs returns all blobs that have never been referenced.

type ErrDuplicatePacks

type ErrDuplicatePacks struct {
	PackID  restic.ID
	Indexes restic.IDSet
}

ErrDuplicatePacks is returned when a pack is found in more than one index.

func (*ErrDuplicatePacks) Error

func (e *ErrDuplicatePacks) Error() string

type ErrMixedPack added in v0.14.0

type ErrMixedPack struct {
	PackID restic.ID
}

ErrMixedPack is returned when a pack is found that contains both tree and data blobs.

func (*ErrMixedPack) Error added in v0.14.0

func (e *ErrMixedPack) Error() string

type ErrOldIndexFormat

type ErrOldIndexFormat struct {
	restic.ID
}

ErrOldIndexFormat is returned when an index with the old format is found.

func (*ErrOldIndexFormat) Error

func (err *ErrOldIndexFormat) Error() string

type Error

type Error struct {
	TreeID restic.ID
	Err    error
}

Error is an error that occurred while checking a repository.

func (*Error) Error

func (e *Error) Error() string

type PackError

type PackError struct {
	ID       restic.ID
	Orphaned bool
	Err      error
}

PackError describes an error with a specific pack.

func (*PackError) Error

func (e *PackError) Error() string

type TreeError

type TreeError struct {
	ID     restic.ID
	Errors []error
}

TreeError collects several errors that occurred while processing a tree.

func (*TreeError) Error

func (e *TreeError) Error() string

Jump to

Keyboard shortcuts

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