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

@@ -261,8 +261,11 @@ func (be *Backend) IsPermanentError(err error) bool {
return false
}
func (be *Backend) Connections() uint {
return be.cfg.Connections
func (be *Backend) 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
@@ -270,11 +273,6 @@ func (be *Backend) Hasher() hash.Hash {
return nil
}
// HasAtomicReplace returns whether Save() can atomically replace files
func (be *Backend) HasAtomicReplace() bool {
return true
}
// Path returns the path in the bucket that is used for this backend.
func (be *Backend) Path() string {
return be.cfg.Prefix