Merge pull request #3968 from MichaelEischer/cleanup-complete-blob

backup: Remove unused filename parameter from CompleteBlob callback
This commit is contained in:
Michael Eischer 2022-10-15 16:11:16 +02:00 committed by GitHub
commit 367f35db27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -76,7 +76,7 @@ type Archiver struct {
StartFile func(filename string)
// CompleteBlob is called for all saved blobs for files.
CompleteBlob func(filename string, bytes uint64)
CompleteBlob func(bytes uint64)
// WithAtime configures if the access time for files and directories should
// be saved. Enabling it may result in much metadata, so it's off by
@ -149,7 +149,7 @@ func New(repo restic.Repository, fs fs.FS, opts Options) *Archiver {
CompleteItem: func(string, *restic.Node, *restic.Node, ItemStats, time.Duration) {},
StartFile: func(string) {},
CompleteBlob: func(string, uint64) {},
CompleteBlob: func(uint64) {},
}
return arch
@ -369,7 +369,7 @@ func (arch *Archiver) Save(ctx context.Context, snPath, target string, previous
if arch.allBlobsPresent(previous) {
debug.Log("%v hasn't changed, using old list of blobs", target)
arch.CompleteItem(snPath, previous, previous, ItemStats{}, time.Since(start))
arch.CompleteBlob(snPath, previous.Size)
arch.CompleteBlob(previous.Size)
node, err := arch.nodeFromFileInfo(snPath, target, fi)
if err != nil {
return FutureNode{}, false, err

View file

@ -25,7 +25,7 @@ type FileSaver struct {
ch chan<- saveFileJob
CompleteBlob func(filename string, bytes uint64)
CompleteBlob func(bytes uint64)
NodeFromFileInfo func(snPath, filename string, fi os.FileInfo) (*restic.Node, error)
}
@ -45,7 +45,7 @@ func NewFileSaver(ctx context.Context, wg *errgroup.Group, save SaveBlobFn, pol
pol: pol,
ch: ch,
CompleteBlob: func(string, uint64) {},
CompleteBlob: func(uint64) {},
}
for i := uint(0); i < fileWorkers; i++ {
@ -176,7 +176,7 @@ func (s *FileSaver) saveFile(ctx context.Context, chnker *chunker.Chunker, snPat
return fnr
}
s.CompleteBlob(f.Name(), uint64(len(chunk.Data)))
s.CompleteBlob(uint64(len(chunk.Data)))
// collect already completed blobs
for len(results) > 0 {

View file

@ -184,7 +184,7 @@ func (p *Progress) StartFile(filename string) {
}
// CompleteBlob is called for all saved blobs for files.
func (p *Progress) CompleteBlob(filename string, bytes uint64) {
func (p *Progress) CompleteBlob(bytes uint64) {
select {
case p.processedCh <- Counter{Bytes: bytes}:
case <-p.closed: