From 69655ba8e56c94cc1ef6fea5420c5a66d8fe650a Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 9 Aug 2021 22:11:57 -0700 Subject: mount: cache on reading remote storage --- weed/filesys/filehandle.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'weed/filesys/filehandle.go') diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 9acede330..5cd7ca948 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -114,6 +114,16 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) { return 0, io.EOF } + if entry.IsInRemoteOnly() { + glog.V(4).Infof("download remote entry %s", fh.f.fullpath()) + newEntry, err := fh.f.downloadRemoteEntry(entry) + if err != nil { + glog.V(1).Infof("download remote entry %s: %v", fh.f.fullpath(), err) + return 0, err + } + entry = newEntry + } + fileSize := int64(filer.FileSize(entry)) fileFullPath := fh.f.fullpath() -- cgit v1.2.3