backend: Rework List()

For a discussion see #1567
This commit is contained in:
Alexander Neumann
2018-01-20 13:43:07 +01:00
parent a3d43a92b3
commit 52230b8f07
8 changed files with 124 additions and 95 deletions

View File

@@ -49,8 +49,13 @@ func TestLayout(t *testing.T) {
}
datafiles := make(map[string]bool)
for id := range be.List(context.TODO(), restic.DataFile) {
datafiles[id] = false
err = be.List(context.TODO(), restic.DataFile, func(fi restic.FileInfo) error {
datafiles[fi.Name] = false
return nil
})
if err != nil {
t.Fatalf("List() returned error %v", err)
}
if len(datafiles) == 0 {