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

@@ -116,8 +116,12 @@ func Create(ctx context.Context, cfg Config, rt http.RoundTripper) (*Backend, er
return be, nil
}
func (b *Backend) Connections() uint {
return b.connections
func (b *Backend) Properties() backend.Properties {
return backend.Properties{
Connections: b.connections,
// rest-server prevents overwriting
HasAtomicReplace: false,
}
}
// Hasher may return a hash function for calculating a content hash for the backend
@@ -125,12 +129,6 @@ func (b *Backend) Hasher() hash.Hash {
return nil
}
// HasAtomicReplace returns whether Save() can atomically replace files
func (b *Backend) HasAtomicReplace() bool {
// rest-server prevents overwriting
return false
}
// Save stores data in the backend at the handle.
func (b *Backend) Save(ctx context.Context, h backend.Handle, rd backend.RewindReader) error {
ctx, cancel := context.WithCancel(ctx)