mirror of
https://github.com/restic/restic.git
synced 2026-11-10 08:41:00 +00:00
backend/cache: use backend types not restic types (#21860)
This commit is contained in:
1 parent
a15b1579ff
commit
c745f810b3
7 files changed
+41
-49
No files matched your search
Vendored
+2
-10
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/restic/restic/internal/backend"
|
||||
"github.com/restic/restic/internal/debug"
|
||||
"github.com/restic/restic/internal/restic"
|
||||
)
|
||||
|
||||
// Backend wraps a restic.Backend and adds a cache.
|
||||
@@ -224,18 +223,11 @@ func (b *Backend) List(ctx context.Context, t backend.FileType, fn func(f backen
|
||||
return b.Backend.List(ctx, t, fn)
|
||||
}
|
||||
|
||||
// will contain the IDs of the files that are in the repository
|
||||
ids := restic.NewIDSet()
|
||||
ids := make(map[string]struct{})
|
||||
|
||||
// wrap the original function to also add the file to the ids set
|
||||
wrapFn := func(f backend.FileInfo) error {
|
||||
id, err := restic.ParseID(f.Name)
|
||||
if err != nil {
|
||||
// ignore files with invalid name
|
||||
return nil
|
||||
}
|
||||
|
||||
ids.Insert(id)
|
||||
ids[f.Name] = struct{}{}
|
||||
|
||||
// execute the original function
|
||||
return fn(f)
|
||||
|
||||
Reference in new issue
Block a user