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

@@ -17,7 +17,7 @@ type SubmitResult struct {
Error string `json:"error,omitempty"`
}
func RegisterFile(filer string, path string, fileId string, fileSize int64, uid, gid int, secret security.Secret) error {
func RegisterFile(filer string, path string, fileId string, fileSize int64, mime string, uid, gid int, secret security.Secret) error {
// TODO: jwt need to be used
_ = security.GenJwt(secret, fileId)
@@ -27,6 +27,7 @@ func RegisterFile(filer string, path string, fileId string, fileSize int64, uid,
values.Add("fileSize", strconv.FormatInt(fileSize, 10))
values.Add("uid", strconv.Itoa(uid))
values.Add("gid", strconv.Itoa(gid))
values.Add("mime", mime)
_, err := util.Post("http://"+filer+"/admin/register", values)
if err != nil {
return fmt.Errorf("Failed to register path %s on filer %s to file id %s : %v", path, filer, fileId, err)