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

@@ -166,7 +166,7 @@ func (be *Backend) Save(ctx context.Context, h backend.Handle, rd backend.Rewind
return nil
}
if be.Backend.HasAtomicReplace() {
if be.Backend.Properties().HasAtomicReplace {
debug.Log("Save(%v) failed with error: %v", h, err)
// there is no need to remove files from backends which can atomically replace files
// in fact if something goes wrong at the backend side the delete operation might delete the wrong instance of the file

View File

@@ -69,7 +69,12 @@ func TestBackendSaveRetryAtomic(t *testing.T) {
calledRemove = true
return nil
},
HasAtomicReplaceFn: func() bool { return true },
PropertiesFn: func() backend.Properties {
return backend.Properties{
Connections: 2,
HasAtomicReplace: true,
}
},
}
TestFastRetries(t)