Implementation of Rename method for S3 PublishedStorage. #15

This commit is contained in:
Andrey Smirnov
2014-07-26 01:11:23 +04:00
parent 8015966663
commit 77d6a10984
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ gom 'github.com/syndtr/goleveldb/leveldb', :commit => '9888007'
gom 'github.com/ugorji/go/codec', :commit => '71c2886f5a673a35f909803f38ece5810165097b' gom 'github.com/ugorji/go/codec', :commit => '71c2886f5a673a35f909803f38ece5810165097b'
gom 'github.com/wsxiaoys/terminal/color', :commit => '5668e431776a7957528361f90ce828266c69ed08' gom 'github.com/wsxiaoys/terminal/color', :commit => '5668e431776a7957528361f90ce828266c69ed08'
gom 'code.google.com/p/mxk/go1/flowcontrol', :commit => '5ff2502e2556' gom 'code.google.com/p/mxk/go1/flowcontrol', :commit => '5ff2502e2556'
gom 'github.com/mitchellh/goamz/s3', :commit => '3c2b519fc7544563e5a2031cc8bb04b567b1b9bc' gom 'github.com/mitchellh/goamz/s3', :commit => 'd52d1cf9e63e860748042a0e97e7f670fb725e24'
group :test do group :test do
gom 'launchpad.net/gocheck' gom 'launchpad.net/gocheck'
+6 -1
View File
@@ -208,5 +208,10 @@ func (storage *PublishedStorage) Filelist(prefix string) ([]string, error) {
// RenameFile renames (moves) file // RenameFile renames (moves) file
func (storage *PublishedStorage) RenameFile(oldName, newName string) error { func (storage *PublishedStorage) RenameFile(oldName, newName string) error {
panic("not implemented yet") err := storage.bucket.Copy(filepath.Join(storage.prefix, oldName), filepath.Join(storage.prefix, newName), storage.acl)
if err != nil {
return fmt.Errorf("error copying %s -> %s in %s: %s", oldName, newName, storage, err)
}
return storage.Remove(oldName)
} }