|
|
@ -360,3 +360,30 @@ func (file *File) saveEntry(entry *filer_pb.Entry) error { |
|
|
|
func (file *File) getEntry() *filer_pb.Entry { |
|
|
|
return file.entry |
|
|
|
} |
|
|
|
|
|
|
|
func (file *File) downloadRemoteEntry(entry *filer_pb.Entry) (*filer_pb.Entry, error) { |
|
|
|
err := file.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { |
|
|
|
|
|
|
|
request := &filer_pb.DownloadToLocalRequest{ |
|
|
|
Directory: file.dir.FullPath(), |
|
|
|
Name: entry.Name, |
|
|
|
} |
|
|
|
|
|
|
|
glog.V(4).Infof("download entry: %v", request) |
|
|
|
resp, err := client.DownloadToLocal(context.Background(), request) |
|
|
|
if err != nil { |
|
|
|
glog.Errorf("DownloadToLocal file %s/%s: %v", file.dir.FullPath(), file.Name, err) |
|
|
|
return fuse.EIO |
|
|
|
} |
|
|
|
|
|
|
|
entry = resp.Entry |
|
|
|
|
|
|
|
file.wfs.metaCache.InsertEntry(context.Background(), filer.FromPbEntry(request.Directory, resp.Entry)) |
|
|
|
|
|
|
|
file.dirtyMetadata = false |
|
|
|
|
|
|
|
return nil |
|
|
|
}) |
|
|
|
|
|
|
|
return entry, err |
|
|
|
} |