mirror of
https://github.com/minio/minio.git
synced 2025-04-01 02:03:42 -04:00
rpc/client: Implement RenameFile properly. (#1443)
This commit is contained in:
parent
8102a4712a
commit
3bf3d18f1f
@ -287,6 +287,21 @@ func (n networkFS) DeleteFile(volume, path string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RenameFile - Rename file.
|
// RenameFile - Rename file.
|
||||||
func (n networkFS) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) error {
|
func (n networkFS) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) (err error) {
|
||||||
return errUnexpected
|
reply := GenericReply{}
|
||||||
|
if err = n.rpcClient.Call("Storage.RenameFileHandler", RenameFileArgs{
|
||||||
|
SrcVol: srcVolume,
|
||||||
|
SrcPath: srcPath,
|
||||||
|
DstVol: dstVolume,
|
||||||
|
DstPath: dstPath,
|
||||||
|
}, &reply); err != nil {
|
||||||
|
log.WithFields(logrus.Fields{
|
||||||
|
"srcVolume": srcVolume,
|
||||||
|
"srcPath": srcPath,
|
||||||
|
"dstVolume": dstVolume,
|
||||||
|
"dstPath": dstPath,
|
||||||
|
}).Errorf("Storage.RenameFileHandler failed with %s", err)
|
||||||
|
return toStorageErr(err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -53,3 +53,11 @@ type DeleteFileArgs struct {
|
|||||||
Vol string
|
Vol string
|
||||||
Path string
|
Path string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RenameFileArgs rename file args.
|
||||||
|
type RenameFileArgs struct {
|
||||||
|
SrcVol string
|
||||||
|
SrcPath string
|
||||||
|
DstVol string
|
||||||
|
DstPath string
|
||||||
|
}
|
||||||
|
@ -118,6 +118,21 @@ func (s *storageServer) DeleteFileHandler(arg *DeleteFileArgs, reply *GenericRep
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RenameFileHandler - rename file handler is rpc wrapper to rename file.
|
||||||
|
func (s *storageServer) RenameFileHandler(arg *RenameFileArgs, reply *GenericReply) error {
|
||||||
|
err := s.storage.RenameFile(arg.SrcVol, arg.SrcPath, arg.DstVol, arg.DstPath)
|
||||||
|
if err != nil {
|
||||||
|
log.WithFields(logrus.Fields{
|
||||||
|
"srcVolume": arg.SrcVol,
|
||||||
|
"srcPath": arg.SrcPath,
|
||||||
|
"dstVolume": arg.DstVol,
|
||||||
|
"dstPath": arg.DstPath,
|
||||||
|
}).Errorf("RenameFile failed with error %s", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize new storage rpc.
|
// Initialize new storage rpc.
|
||||||
func newRPCServer(exportPath string) (*storageServer, error) {
|
func newRPCServer(exportPath string) (*storageServer, error) {
|
||||||
// Initialize posix storage API.
|
// Initialize posix storage API.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user