2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-23 03:18:55 +00:00

Remove Deleter interface

This commit is contained in:
Alexander Neumann 2017-10-14 15:56:38 +02:00
parent b8af7f63a0
commit e56370eb5b
8 changed files with 11 additions and 36 deletions

View File

@ -76,11 +76,7 @@ func newAzureTestSuite(t testing.TB) *test.Suite {
return err return err
} }
if err := be.(restic.Deleter).Delete(context.TODO()); err != nil { return be.Delete(context.TODO())
return err
}
return nil
}, },
} }
} }

View File

@ -62,11 +62,7 @@ func newB2TestSuite(t testing.TB) *test.Suite {
return err return err
} }
if err := be.(restic.Deleter).Delete(context.TODO()); err != nil { return be.Delete(context.TODO())
return err
}
return nil
}, },
} }
} }

View File

@ -69,11 +69,7 @@ func newGSTestSuite(t testing.TB) *test.Suite {
return err return err
} }
if err := be.(restic.Deleter).Delete(context.TODO()); err != nil { return be.Delete(context.TODO())
return err
}
return nil
}, },
} }
} }

View File

@ -378,5 +378,9 @@ func (b *restBackend) Delete(ctx context.Context) error {
} }
} }
return b.Remove(ctx, restic.Handle{Type: restic.ConfigFile}) err := b.Remove(ctx, restic.Handle{Type: restic.ConfigFile})
if err != nil && b.IsNotExist(err) {
return nil
}
return err
} }

View File

@ -280,11 +280,7 @@ func newS3TestSuite(t testing.TB) *test.Suite {
return err return err
} }
if err := be.(restic.Deleter).Delete(context.TODO()); err != nil { return be.Delete(context.TODO())
return err
}
return nil
}, },
} }
} }

View File

@ -93,11 +93,7 @@ func newSwiftTestSuite(t testing.TB) *test.Suite {
return err return err
} }
if err := be.(restic.Deleter).Delete(context.TODO()); err != nil { return be.Delete(context.TODO())
return err
}
return nil
}, },
} }
} }

View File

@ -591,11 +591,7 @@ func (r *Repository) ListPack(ctx context.Context, id restic.ID) ([]restic.Blob,
// Delete calls backend.Delete() if implemented, and returns an error // Delete calls backend.Delete() if implemented, and returns an error
// otherwise. // otherwise.
func (r *Repository) Delete(ctx context.Context) error { func (r *Repository) Delete(ctx context.Context) error {
if b, ok := r.be.(restic.Deleter); ok { return r.be.Delete(ctx)
return b.Delete(ctx)
}
return errors.New("Delete() called for backend that does not implement this method")
} }
// Close closes the repository by closing the backend. // Close closes the repository by closing the backend.

View File

@ -44,11 +44,6 @@ type Repository interface {
SaveTree(context.Context, *Tree) (ID, error) SaveTree(context.Context, *Tree) (ID, error)
} }
// Deleter removes all data stored in a backend/repo.
type Deleter interface {
Delete(context.Context) error
}
// Lister allows listing files in a backend. // Lister allows listing files in a backend.
type Lister interface { type Lister interface {
List(context.Context, FileType) <-chan string List(context.Context, FileType) <-chan string