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

@@ -77,26 +77,21 @@ func (store *AbstractSqlStore) FindEntry(fullpath filer2.FullPath) (*filer2.Entr
return entry, nil
}
func (store *AbstractSqlStore) DeleteEntry(fullpath filer2.FullPath) (*filer2.Entry, error) {
entry, err := store.FindEntry(fullpath)
if err != nil {
return nil, nil
}
func (store *AbstractSqlStore) DeleteEntry(fullpath filer2.FullPath) (error) {
dir, name := fullpath.DirAndName()
res, err := store.DB.Exec(store.SqlDelete, hashToLong(dir), name, dir)
if err != nil {
return nil, fmt.Errorf("delete %s: %s", fullpath, err)
return fmt.Errorf("delete %s: %s", fullpath, err)
}
_, err = res.RowsAffected()
if err != nil {
return nil, fmt.Errorf("delete %s but no rows affected: %s", fullpath, err)
return fmt.Errorf("delete %s but no rows affected: %s", fullpath, err)
}
return entry, nil
return nil
}
func (store *AbstractSqlStore) ListDirectoryEntries(fullpath filer2.FullPath, startFileName string, inclusive bool, limit int) (entries []*filer2.Entry, err error) {