mirror of
https://github.com/restic/restic.git
synced 2026-10-30 03:55:42 +00:00
repository: replace CopyBlobs with Repack implementation
This commit is contained in:
1 parent
b24b088978
commit
81d8bc4ade
4 files changed
+20
-28
No files matched your search
@@ -21,17 +21,18 @@ type repackBlobSet interface {
|
||||
|
||||
type LogFunc func(msg string, args ...interface{})
|
||||
|
||||
// Repack takes a list of packs together with a list of blobs contained in
|
||||
// CopyBlobs takes a list of packs together with a list of blobs contained in
|
||||
// these packs. Each pack is loaded and the blobs listed in keepBlobs is saved
|
||||
// into a new pack. Returned is the list of obsolete packs which can then
|
||||
// be removed.
|
||||
//
|
||||
// The map keepBlobs is modified by Repack, it is used to keep track of which
|
||||
// The map keepBlobs is modified by CopyBlobs, it is used to keep track of which
|
||||
// blobs have been processed.
|
||||
func Repack(
|
||||
func CopyBlobs(
|
||||
ctx context.Context,
|
||||
repo restic.Repository,
|
||||
dstRepo restic.Repository,
|
||||
dstUploader restic.BlobSaver,
|
||||
packs restic.IDSet,
|
||||
keepBlobs repackBlobSet,
|
||||
p *progress.Counter,
|
||||
@@ -49,24 +50,7 @@ func Repack(
|
||||
return errors.New("repack step requires a backend connection limit of at least two")
|
||||
}
|
||||
|
||||
return dstRepo.WithBlobUploader(ctx, func(ctx context.Context, uploader restic.BlobSaver) error {
|
||||
return repack(ctx, repo, dstRepo, uploader, packs, keepBlobs, p, logf)
|
||||
})
|
||||
}
|
||||
|
||||
// CopyBlobs is a wrapper around repack(). The parameter 'uploader' is passed through
|
||||
// from WithBlobUploader() to CopyBlobs() via cmd/restic/cmd_copy.copyTree().
|
||||
func CopyBlobs(
|
||||
ctx context.Context,
|
||||
repo restic.Repository,
|
||||
dstRepo restic.Repository,
|
||||
uploader restic.BlobSaver,
|
||||
packs restic.IDSet,
|
||||
keepBlobs repackBlobSet,
|
||||
p *progress.Counter,
|
||||
logf LogFunc,
|
||||
) error {
|
||||
return repack(ctx, repo, dstRepo, uploader, packs, keepBlobs, p, logf)
|
||||
return repack(ctx, repo, dstRepo, dstUploader, packs, keepBlobs, p, logf)
|
||||
}
|
||||
|
||||
func repack(
|
||||
|
||||
Reference in new issue
Block a user