allow healing to prefer local disks over remote (#17788)

This commit is contained in:
Harshavardhana
2023-08-03 02:18:18 -07:00
committed by GitHub
parent 4a4950fe41
commit 45fb375c41
3 changed files with 9 additions and 3 deletions
+4 -1
View File
@@ -289,12 +289,15 @@ func (e Erasure) Decode(ctx context.Context, writer io.Writer, readers []io.Read
}
// Heal reads from readers, reconstruct shards and writes the data to the writers.
func (e Erasure) Heal(ctx context.Context, writers []io.Writer, readers []io.ReaderAt, totalLength int64) (derr error) {
func (e Erasure) Heal(ctx context.Context, writers []io.Writer, readers []io.ReaderAt, totalLength int64, prefer []bool) (derr error) {
if len(writers) != e.parityBlocks+e.dataBlocks {
return errInvalidArgument
}
reader := newParallelReader(readers, e, 0, totalLength)
if len(readers) == len(prefer) {
reader.preferReaders(prefer)
}
startBlock := int64(0)
endBlock := totalLength / e.blockSize