mirror of
https://github.com/minio/minio.git
synced 2025-04-20 02:27:50 -04:00
move versionsOrder struct to xl-storage-utils
This commit is contained in:
parent
899a2fa1c7
commit
cd8d511d3d
@ -20,6 +20,20 @@ import (
|
|||||||
jsoniter "github.com/json-iterator/go"
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type versionsSorter []FileInfo
|
||||||
|
|
||||||
|
func (v versionsSorter) Len() int { return len(v) }
|
||||||
|
func (v versionsSorter) Swap(i, j int) { v[i], v[j] = v[j], v[i] }
|
||||||
|
func (v versionsSorter) Less(i, j int) bool {
|
||||||
|
if v[i].IsLatest {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if v[j].IsLatest {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return v[i].ModTime.After(v[j].ModTime)
|
||||||
|
}
|
||||||
|
|
||||||
func getFileInfoVersions(xlMetaBuf []byte, volume, path string) (FileInfoVersions, error) {
|
func getFileInfoVersions(xlMetaBuf []byte, volume, path string) (FileInfoVersions, error) {
|
||||||
if isXL2V1Format(xlMetaBuf) {
|
if isXL2V1Format(xlMetaBuf) {
|
||||||
var xlMeta xlMetaV2
|
var xlMeta xlMetaV2
|
||||||
|
@ -525,20 +525,6 @@ func (z xlMetaV2) TotalSize() int64 {
|
|||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
type versionsSorter []FileInfo
|
|
||||||
|
|
||||||
func (v versionsSorter) Len() int { return len(v) }
|
|
||||||
func (v versionsSorter) Swap(i, j int) { v[i], v[j] = v[j], v[i] }
|
|
||||||
func (v versionsSorter) Less(i, j int) bool {
|
|
||||||
if v[i].IsLatest {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if v[j].IsLatest {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return v[i].ModTime.After(v[j].ModTime)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListVersions lists current versions, and current deleted
|
// ListVersions lists current versions, and current deleted
|
||||||
// versions returns error for unexpected entries.
|
// versions returns error for unexpected entries.
|
||||||
func (z xlMetaV2) ListVersions(volume, path string) (versions []FileInfo, modTime time.Time, err error) {
|
func (z xlMetaV2) ListVersions(volume, path string) (versions []FileInfo, modTime time.Time, err error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user