|
|
|
@ -19,6 +19,7 @@ package main |
|
|
|
|
import ( |
|
|
|
|
"errors" |
|
|
|
|
slashpath "path" |
|
|
|
|
"sync" |
|
|
|
|
|
|
|
|
|
"github.com/Sirupsen/logrus" |
|
|
|
|
) |
|
|
|
@ -117,12 +118,16 @@ func (xl XL) getPartsMetadata(volume, path string) ([]xlMetaV1, []error) { |
|
|
|
|
errs := make([]error, len(xl.storageDisks)) |
|
|
|
|
metadataArray := make([]xlMetaV1, len(xl.storageDisks)) |
|
|
|
|
xlMetaV1FilePath := slashpath.Join(path, xlMetaV1File) |
|
|
|
|
var wg = &sync.WaitGroup{} |
|
|
|
|
for index, disk := range xl.storageDisks { |
|
|
|
|
wg.Add(1) |
|
|
|
|
go func(index int, disk StorageAPI) { |
|
|
|
|
defer wg.Done() |
|
|
|
|
offset := int64(0) |
|
|
|
|
metadataReader, err := disk.ReadFile(volume, xlMetaV1FilePath, offset) |
|
|
|
|
if err != nil { |
|
|
|
|
errs[index] = err |
|
|
|
|
continue |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
defer metadataReader.Close() |
|
|
|
|
|
|
|
|
@ -130,10 +135,12 @@ func (xl XL) getPartsMetadata(volume, path string) ([]xlMetaV1, []error) { |
|
|
|
|
if err != nil { |
|
|
|
|
// Unable to parse file.json, set error.
|
|
|
|
|
errs[index] = err |
|
|
|
|
continue |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
metadataArray[index] = metadata |
|
|
|
|
}(index, disk) |
|
|
|
|
} |
|
|
|
|
wg.Wait() |
|
|
|
|
return metadataArray, errs |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|