aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/file.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-03-22 01:00:36 -0700
committerChris Lu <chris.lu@gmail.com>2020-03-22 01:00:36 -0700
commit65d2ea9fb00757320f348835d9761a357264ea98 (patch)
tree18e539c2949b4b270ca4cb02ef544a058c57f149 /weed/filesys/file.go
parent82bfad5b8615d9c2cd21efc059514b8899232a0f (diff)
downloadseaweedfs-65d2ea9fb00757320f348835d9761a357264ea98.tar.xz
seaweedfs-65d2ea9fb00757320f348835d9761a357264ea98.zip
FUSE mount: stream read data with buffer
fix https://github.com/chrislusf/seaweedfs/issues/1244
Diffstat (limited to 'weed/filesys/file.go')
-rw-r--r--weed/filesys/file.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index 69d440a73..14b9cb208 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -2,6 +2,7 @@ package filesys
import (
"context"
+ "io"
"os"
"sort"
"time"
@@ -32,6 +33,7 @@ type File struct {
entry *filer_pb.Entry
entryViewCache []filer2.VisibleInterval
isOpen int
+ reader io.ReadSeeker
}
func (file *File) fullpath() filer2.FullPath {
@@ -119,6 +121,7 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
}
file.entry.Chunks = chunks
file.entryViewCache = nil
+ file.reader = nil
}
file.entry.Attributes.FileSize = req.Size
}
@@ -245,6 +248,7 @@ func (file *File) addChunks(chunks []*filer_pb.FileChunk) {
file.entryViewCache = newVisibles
newVisibles = t
}
+ file.reader = nil
glog.V(3).Infof("%s existing %d chunks adds %d more", file.fullpath(), len(file.entry.Chunks), len(chunks))
@@ -254,6 +258,7 @@ func (file *File) addChunks(chunks []*filer_pb.FileChunk) {
func (file *File) setEntry(entry *filer_pb.Entry) {
file.entry = entry
file.entryViewCache = filer2.NonOverlappingVisibleIntervals(file.entry.Chunks)
+ file.reader = nil
}
func (file *File) saveEntry() error {