aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/wfs_write.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/filesys/wfs_write.go')
-rw-r--r--weed/filesys/wfs_write.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/filesys/wfs_write.go b/weed/filesys/wfs_write.go
index dbec3bebc..9d2ce26ec 100644
--- a/weed/filesys/wfs_write.go
+++ b/weed/filesys/wfs_write.go
@@ -13,7 +13,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/util"
)
-func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath) filer.SaveDataAsChunkFunctionType {
+func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath, writeOnly bool) filer.SaveDataAsChunkFunctionType {
return func(reader io.Reader, filename string, offset int64) (chunk *filer_pb.FileChunk, collection, replication string, err error) {
var fileId, host string
@@ -67,7 +67,9 @@ func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath) filer.SaveDataAsChunkFun
return nil, "", "", fmt.Errorf("upload result: %v", uploadResult.Error)
}
- wfs.chunkCache.SetChunk(fileId, data)
+ if !writeOnly {
+ wfs.chunkCache.SetChunk(fileId, data)
+ }
chunk = uploadResult.ToPbFileChunk(fileId, offset)
return chunk, collection, replication, nil