aboutsummaryrefslogtreecommitdiff
path: root/weed/command
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-05-30 20:24:57 -0700
committerChris Lu <chris.lu@gmail.com>2018-05-30 20:24:57 -0700
commit0301504184fa3342624c70b9066dfbfb7944af25 (patch)
treecafb52daf1659a5fd28fdc0e0bc58d328f62178b /weed/command
parent26e7cd8c7537dc010e6757060c1835a342fffc90 (diff)
downloadseaweedfs-0301504184fa3342624c70b9066dfbfb7944af25.tar.xz
seaweedfs-0301504184fa3342624c70b9066dfbfb7944af25.zip
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
Diffstat (limited to 'weed/command')
-rw-r--r--weed/command/filer_copy.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go
index a61118bbf..8d6b84ff2 100644
--- a/weed/command/filer_copy.go
+++ b/weed/command/filer_copy.go
@@ -174,7 +174,7 @@ func uploadFileAsOne(filerUrl string, urlFolder string, f *os.File, fi os.FileIn
fmt.Printf("uploaded %s to %s\n", f.Name(), targetUrl)
if err = filer_operation.RegisterFile(filerUrl, filepath.Join(urlFolder, f.Name()), assignResult.Fid, fi.Size(),
- os.Getuid(), os.Getgid(), copy.secret); err != nil {
+ mimeType, os.Getuid(), os.Getgid(), copy.secret); err != nil {
fmt.Printf("Failed to register file %s on %s: %v\n", f.Name(), filerUrl, err)
return false
}
@@ -185,6 +185,8 @@ func uploadFileAsOne(filerUrl string, urlFolder string, f *os.File, fi os.FileIn
func uploadFileInChunks(filerUrl string, urlFolder string, f *os.File, fi os.FileInfo, chunkCount int, chunkSize int64) bool {
+ mimeType := detectMimeType(f)
+
var chunks []*filer_pb.FileChunk
for i := int64(0); i < int64(chunkCount); i++ {
@@ -235,6 +237,7 @@ func uploadFileInChunks(filerUrl string, urlFolder string, f *os.File, fi os.Fil
Uid: uint32(os.Getuid()),
FileSize: uint64(fi.Size()),
FileMode: uint32(fi.Mode()),
+ Mime: mimeType,
},
Chunks: chunks,
},