support renaming files
This commit is contained in:
@@ -123,7 +123,7 @@ func (f *Filer) FindEntry(p FullPath) (entry *Entry, err error) {
|
||||
return f.store.FindEntry(p)
|
||||
}
|
||||
|
||||
func (f *Filer) DeleteEntryMetaAndData(p FullPath) (err error) {
|
||||
func (f *Filer) DeleteEntryMetaAndData(p FullPath, shouldDeleteChunks bool) (err error) {
|
||||
entry, err := f.FindEntry(p)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -139,7 +139,9 @@ func (f *Filer) DeleteEntryMetaAndData(p FullPath) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
f.deleteChunks(entry)
|
||||
if shouldDeleteChunks {
|
||||
f.deleteChunks(entry)
|
||||
}
|
||||
|
||||
return f.store.DeleteEntry(p)
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ func TestCreateFileAndList(t *testing.T) {
|
||||
}
|
||||
|
||||
// delete file and count
|
||||
filer.DeleteEntryMetaAndData(file3Path)
|
||||
filer.DeleteEntryMetaAndData(file3Path, false)
|
||||
entries, _ = filer.ListDirectoryEntries(filer2.FullPath("/home/chris/this/is"), "", false, 100)
|
||||
if len(entries) != 1 {
|
||||
t.Errorf("list entries count: %v", len(entries))
|
||||
|
||||
Reference in New Issue
Block a user