Documentation ¶
Overview ¶
Package index contains various data structures for indexing content in a repository or backend.
Index ¶
- type Index
- func (idx *Index) AddPack(id restic.ID, size int64, entries []restic.Blob) error
- func (idx *Index) DuplicateBlobs() (dups restic.BlobSet)
- func (idx *Index) PacksForBlobs(blobs restic.BlobSet) (packs restic.IDSet)
- func (idx *Index) RemovePack(id restic.ID) error
- func (idx *Index) Save(ctx context.Context, repo Saver, supersedes restic.IDs) (restic.IDs, error)
- type ListLoader
- type Lister
- type Pack
- type Saver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
Index contains information about blobs and packs stored in a repo.
func New ¶
func New(ctx context.Context, repo Lister, 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 ¶
AddPack adds a pack to the index. If this pack is already in the index, an error is returned.
func (*Index) DuplicateBlobs ¶
DuplicateBlobs returns a list of blobs that are stored more than once in the repo.
func (*Index) PacksForBlobs ¶
PacksForBlobs returns the set of packs in which the blobs are contained.
func (*Index) RemovePack ¶
RemovePack deletes a pack from the index.
type ListLoader ¶ added in v0.9.7
type ListLoader interface { Lister LoadJSONUnpacked(context.Context, restic.FileType, restic.ID, interface{}) error }
ListLoader allows listing files and their content, in addition to loading and unmarshaling JSON files.
type Lister ¶ added in v0.9.7
type Lister interface { // List runs fn for all files of type t in the repo. List(ctx context.Context, t restic.FileType, fn func(restic.ID, int64) error) error // ListPack returns the list of blobs saved in the pack id and the length // of the file as stored in the backend. ListPack(ctx context.Context, id restic.ID, size int64) ([]restic.Blob, int64, error) }
Lister lists files and their contents