XL/Multipart: rename the parts instead of concatenating. (#1416)

This commit is contained in:
Krishna Srinivas
2016-04-30 00:47:48 +05:30
committed by Harshavardhana
parent 39df425b2a
commit 7066ce5160
6 changed files with 139 additions and 27 deletions

View File

@@ -570,3 +570,25 @@ func (xl XL) DeleteFile(volume, path string) error {
}
return nil
}
// RenameFile - rename file.
func (xl XL) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) error {
if !isValidVolname(srcVolume) {
return errInvalidArgument
}
if !isValidPath(srcPath) {
return errInvalidArgument
}
if !isValidVolname(dstVolume) {
return errInvalidArgument
}
if !isValidPath(dstPath) {
return errInvalidArgument
}
for _, disk := range xl.storageDisks {
if err := disk.RenameFile(srcVolume, srcPath, dstVolume, dstPath); err != nil {
return err
}
}
return nil
}