|
|
@ -36,7 +36,7 @@ func highestInt(intSlice []int64) (highestInteger int64) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Extracts file versions from partsMetadata slice and returns version slice.
|
|
|
|
// Extracts file versions from partsMetadata slice and returns version slice.
|
|
|
|
func listFileVersions(partsMetadata []xlMetaV1, errs []error) (versions []int64, err error) { |
|
|
|
func listFileVersions(partsMetadata []xlMetaV1, errs []error) (versions []int64) { |
|
|
|
versions = make([]int64, len(partsMetadata)) |
|
|
|
versions = make([]int64, len(partsMetadata)) |
|
|
|
for index, metadata := range partsMetadata { |
|
|
|
for index, metadata := range partsMetadata { |
|
|
|
if errs[index] == nil { |
|
|
|
if errs[index] == nil { |
|
|
@ -45,7 +45,7 @@ func listFileVersions(partsMetadata []xlMetaV1, errs []error) (versions []int64, |
|
|
|
versions[index] = -1 |
|
|
|
versions[index] = -1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return versions, nil |
|
|
|
return versions |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Returns slice of online disks needed.
|
|
|
|
// Returns slice of online disks needed.
|
|
|
@ -73,14 +73,7 @@ func (xl XL) listOnlineDisks(volume, path string) (onlineDisks []StorageAPI, mda |
|
|
|
highestVersion := int64(0) |
|
|
|
highestVersion := int64(0) |
|
|
|
onlineDisks = make([]StorageAPI, len(xl.storageDisks)) |
|
|
|
onlineDisks = make([]StorageAPI, len(xl.storageDisks)) |
|
|
|
// List all the file versions from partsMetadata list.
|
|
|
|
// List all the file versions from partsMetadata list.
|
|
|
|
versions, err := listFileVersions(partsMetadata, errs) |
|
|
|
versions := listFileVersions(partsMetadata, errs) |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
log.WithFields(logrus.Fields{ |
|
|
|
|
|
|
|
"volume": volume, |
|
|
|
|
|
|
|
"path": path, |
|
|
|
|
|
|
|
}).Errorf("Extracting file versions failed with %s", err) |
|
|
|
|
|
|
|
return nil, xlMetaV1{}, false, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get highest file version.
|
|
|
|
// Get highest file version.
|
|
|
|
highestVersion = highestInt(versions) |
|
|
|
highestVersion = highestInt(versions) |
|
|
|