diff --git a/internal/restic/find.go b/internal/restic/find.go index f9b4e8bdf..135cc9ad5 100644 --- a/internal/restic/find.go +++ b/internal/restic/find.go @@ -8,18 +8,6 @@ import ( "golang.org/x/sync/errgroup" ) -// Loader loads a blob from a repository. -type Loader interface { - LoadBlob(context.Context, BlobType, ID, []byte) ([]byte, error) - LookupBlobSize(tpe BlobType, id ID) (uint, bool) - Connections() uint -} - -type FindBlobSet interface { - Has(bh BlobHandle) bool - Insert(bh BlobHandle) -} - // FindUsedBlobs traverses the tree ID and adds all seen blobs (trees and data // blobs) to the set blobs. Already seen tree blobs will not be visited again. func FindUsedBlobs(ctx context.Context, repo Loader, treeIDs IDs, blobs FindBlobSet, p *progress.Counter) error { diff --git a/internal/restic/repository.go b/internal/restic/repository.go index 5631202a9..f2354b088 100644 --- a/internal/restic/repository.go +++ b/internal/restic/repository.go @@ -168,9 +168,30 @@ type ListBlobser interface { ListBlobs(ctx context.Context, fn func(PackedBlob)) error } +type BlobLoader interface { + LoadBlob(context.Context, BlobType, ID, []byte) ([]byte, error) +} + +type BlobSaver interface { + SaveBlob(context.Context, BlobType, []byte, ID, bool) (ID, bool, int, error) +} + +// Loader loads a blob from a repository. +type Loader interface { + LoadBlob(context.Context, BlobType, ID, []byte) ([]byte, error) + LookupBlobSize(tpe BlobType, id ID) (uint, bool) + Connections() uint +} + type WarmupJob interface { // HandleCount returns the number of handles that are currently warming up. HandleCount() int // Wait waits for all handles to be warm. Wait(ctx context.Context) error } + +// FindBlobSet is a set of blob handles used by prune. +type FindBlobSet interface { + Has(bh BlobHandle) bool + Insert(bh BlobHandle) +} diff --git a/internal/restic/tree.go b/internal/restic/tree.go index f406b489f..70b718e64 100644 --- a/internal/restic/tree.go +++ b/internal/restic/tree.go @@ -104,10 +104,6 @@ func (t *Tree) Subtrees() (trees IDs) { return trees } -type BlobLoader interface { - LoadBlob(context.Context, BlobType, ID, []byte) ([]byte, error) -} - // LoadTree loads a tree from the repository. func LoadTree(ctx context.Context, r BlobLoader, id ID) (*Tree, error) { debug.Log("load tree %v", id) @@ -126,10 +122,6 @@ func LoadTree(ctx context.Context, r BlobLoader, id ID) (*Tree, error) { return t, nil } -type BlobSaver interface { - SaveBlob(context.Context, BlobType, []byte, ID, bool) (ID, bool, int, error) -} - // SaveTree stores a tree into the repository and returns the ID. The ID is // checked against the index. The tree is only stored when the index does not // contain the ID.