add mime, use simple insert and update filer store API

1. add mime type to file in filer
2. purge old chunks if overwrite during insert
This commit is contained in:
Chris Lu
2018-05-30 20:24:57 -07:00
parent 26e7cd8c75
commit 0301504184
20 changed files with 149 additions and 132 deletions

View File

@@ -56,13 +56,9 @@ func (store *MemDbStore) FindEntry(fullpath filer2.FullPath) (entry *filer2.Entr
return entry, nil
}
func (store *MemDbStore) DeleteEntry(fullpath filer2.FullPath) (entry *filer2.Entry, err error) {
item := store.tree.Delete(entryItem{&filer2.Entry{FullPath: fullpath}})
if item == nil {
return nil, nil
}
entry = item.(entryItem).Entry
return entry, nil
func (store *MemDbStore) DeleteEntry(fullpath filer2.FullPath) (err error) {
store.tree.Delete(entryItem{&filer2.Entry{FullPath: fullpath}})
return nil
}
func (store *MemDbStore) ListDirectoryEntries(fullpath filer2.FullPath, startFileName string, inclusive bool, limit int) (entries []*filer2.Entry, err error) {

View File

@@ -134,7 +134,7 @@ func TestCreateFileAndList(t *testing.T) {
}
// delete file and count
filer.DeleteEntry(file3Path)
filer.DeleteEntryMetaAndData(file3Path)
entries, _ = filer.ListDirectoryEntries(filer2.FullPath("/home/chris/this/is"), "", false, 100)
if len(entries) != 1 {
t.Errorf("list entries count: %v", len(entries))