index

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: 9 Imported by: 0

Documentation

Overview

Package index contains various data structures for indexing content in a repository or backend.

Index

Constants

This section is empty.

Variables

View Source
var ErrBlobNotFound = errors.New("blob not found in index")

ErrBlobNotFound is return by FindBlob when the blob could not be found in the index.

Functions

This section is empty.

Types

type Index

type Index struct {
	Packs    map[restic.ID]Pack
	IndexIDs restic.IDSet
}

Index contains information about blobs and packs stored in a repo.

func Load

func Load(ctx context.Context, repo restic.Repository, p *restic.Progress) (*Index, error)

Load creates an index by loading all index files from the repo.

func New

func New(ctx context.Context, repo restic.Repository, ignorePacks restic.IDSet, p *restic.Progress) (idx *Index, invalidFiles restic.IDs, err error)

New creates a new index for repo from scratch. InvalidFiles contains all IDs of files that cannot be listed successfully.

func (*Index) AddPack

func (idx *Index) AddPack(id restic.ID, size int64, entries []restic.Blob) error

AddPack adds a pack to the index. If this pack is already in the index, an error is returned.

func (*Index) DuplicateBlobs

func (idx *Index) DuplicateBlobs() (dups restic.BlobSet)

DuplicateBlobs returns a list of blobs that are stored more than once in the repo.

func (*Index) FindBlob

func (idx *Index) FindBlob(h restic.BlobHandle) (result []Location, err error)

FindBlob returns a list of packs and positions the blob can be found in.

func (*Index) PacksForBlobs

func (idx *Index) PacksForBlobs(blobs restic.BlobSet) (packs restic.IDSet)

PacksForBlobs returns the set of packs in which the blobs are contained.

func (*Index) RemovePack

func (idx *Index) RemovePack(id restic.ID) error

RemovePack deletes a pack from the index.

func (*Index) Save

func (idx *Index) Save(ctx context.Context, repo restic.Repository, supersedes restic.IDs) (restic.IDs, error)

Save writes the complete index to the repo.

type Location

type Location struct {
	PackID restic.ID
	restic.Blob
}

Location describes the location of a blob in a pack.

type Pack

type Pack struct {
	ID      restic.ID
	Size    int64
	Entries []restic.Blob
}

Pack contains information about the contents of a pack.

Jump to

Keyboard shortcuts

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