backend: refactor backend Connections and HasAtomicReplace into Properties

This commit is contained in:
Michael Eischer
2025-02-16 22:27:58 +01:00
parent 5ddda7f5e9
commit c970e58739
18 changed files with 89 additions and 97 deletions

View File

@@ -154,8 +154,11 @@ func (be *b2Backend) SetListMaxItems(i int) {
be.listMaxItems = i
}
func (be *b2Backend) Connections() uint {
return be.cfg.Connections
func (be *b2Backend) Properties() backend.Properties {
return backend.Properties{
Connections: be.cfg.Connections,
HasAtomicReplace: true,
}
}
// Hasher may return a hash function for calculating a content hash for the backend
@@ -163,11 +166,6 @@ func (be *b2Backend) Hasher() hash.Hash {
return nil
}
// HasAtomicReplace returns whether Save() can atomically replace files
func (be *b2Backend) HasAtomicReplace() bool {
return true
}
// IsNotExist returns true if the error is caused by a non-existing file.
func (be *b2Backend) IsNotExist(err error) bool {
// blazer/b2 does not export its error types and values,