s3: copy object to itself

fix https://github.com/chrislusf/seaweedfs/issues/1922
This commit is contained in:
Chris Lu
2021-03-19 01:31:49 -07:00
parent aa5179ce3c
commit b1a86cf808
5 changed files with 68 additions and 7 deletions

View File

@@ -182,6 +182,26 @@ func Exists(filerClient FilerClient, parentDirectoryPath string, entryName strin
return
}
func Touch(filerClient FilerClient, parentDirectoryPath string, entryName string, entry *Entry) (err error) {
return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {
request := &UpdateEntryRequest{
Directory: parentDirectoryPath,
Entry: entry,
}
glog.V(4).Infof("touch entry %v/%v: %v", parentDirectoryPath, entryName, request)
if err := UpdateEntry(client, request); err != nil {
glog.V(0).Infof("touch exists entry %v: %v", request, err)
return fmt.Errorf("touch exists entry %s/%s: %v", parentDirectoryPath, entryName, err)
}
return nil
})
}
func Mkdir(filerClient FilerClient, parentDirectoryPath string, dirName string, fn func(entry *Entry)) error {
return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {