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

@@ -218,8 +218,11 @@ func (be *MemoryBackend) List(ctx context.Context, t backend.FileType, fn func(b
return ctx.Err()
}
func (be *MemoryBackend) Connections() uint {
return connectionCount
func (be *MemoryBackend) Properties() backend.Properties {
return backend.Properties{
Connections: connectionCount,
HasAtomicReplace: false,
}
}
// Hasher may return a hash function for calculating a content hash for the backend
@@ -227,11 +230,6 @@ func (be *MemoryBackend) Hasher() hash.Hash {
return xxhash.New()
}
// HasAtomicReplace returns whether Save() can atomically replace files
func (be *MemoryBackend) HasAtomicReplace() bool {
return false
}
// Delete removes all data in the backend.
func (be *MemoryBackend) Delete(ctx context.Context) error {
be.m.Lock()