|
|
|
@@ -28,6 +28,13 @@ type FileInfo struct { |
|
|
|
ParenDir string `json:"ParenDir"` |
|
|
|
UUID string `json:"UUID"` |
|
|
|
} |
|
|
|
type FileInfoList []FileInfo |
|
|
|
|
|
|
|
func (ulist FileInfoList) Swap(i, j int) { ulist[i], ulist[j] = ulist[j], ulist[i] } |
|
|
|
func (ulist FileInfoList) Len() int { return len(ulist) } |
|
|
|
func (ulist FileInfoList) Less(i, j int) bool { |
|
|
|
return strings.Compare(ulist[i].ModTime, ulist[j].ModTime) > 0 |
|
|
|
} |
|
|
|
|
|
|
|
//check if has the object |
|
|
|
func ObsHasObject(path string) (bool, error) { |
|
|
|
@@ -333,7 +340,8 @@ func GetAllObjectByBucketAndPrefix(bucket string, prefix string) ([]FileInfo, er |
|
|
|
input.MaxKeys = 100 |
|
|
|
input.Prefix = prefix |
|
|
|
index := 1 |
|
|
|
fileInfos := make([]FileInfo, 0) |
|
|
|
fileInfoList := FileInfoList{} |
|
|
|
|
|
|
|
prefixLen := len(prefix) |
|
|
|
log.Info("prefix=" + input.Prefix) |
|
|
|
for { |
|
|
|
@@ -358,7 +366,7 @@ func GetAllObjectByBucketAndPrefix(bucket string, prefix string) ([]FileInfo, er |
|
|
|
IsDir: isDir, |
|
|
|
ParenDir: "", |
|
|
|
} |
|
|
|
fileInfos = append(fileInfos, fileInfo) |
|
|
|
fileInfoList = append(fileInfoList, fileInfo) |
|
|
|
} |
|
|
|
if output.IsTruncated { |
|
|
|
input.Marker = output.NextMarker |
|
|
|
@@ -373,7 +381,8 @@ func GetAllObjectByBucketAndPrefix(bucket string, prefix string) ([]FileInfo, er |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
return fileInfos, nil |
|
|
|
sort.Sort(fileInfoList) |
|
|
|
return fileInfoList, nil |
|
|
|
} |
|
|
|
|
|
|
|
func GetObsListObject(jobName, outPutPath, parentDir, versionName string) ([]FileInfo, error) { |
|
|
|
|