upgrade_repo_v2: Use atomic replace for supported backends

This commit is contained in:
Michael Eischer 2022-05-01 20:07:29 +02:00
parent 7559d2f105
commit e36a40db10
13 changed files with 82 additions and 17 deletions

View file

@ -102,6 +102,11 @@ func (b *Local) Hasher() hash.Hash {
return nil
}
// HasAtomicReplace returns whether Save() can atomically replace files
func (b *Local) HasAtomicReplace() bool {
return true
}
// IsNotExist returns true if the error is caused by a non existing file.
func (b *Local) IsNotExist(err error) bool {
return errors.Is(err, os.ErrNotExist)