checker

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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) *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() restic.IDSet

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) 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, p *restic.Progress, 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 restic.IDSet, p *restic.Progress, errChan chan<- error)

ReadPacks loads data from specified packs and checks the integrity.

func (*Checker) Structure

func (c *Checker) Structure(ctx context.Context, 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() (blobs restic.IDs)

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 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
	BlobID 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