aboutsummaryrefslogtreecommitdiff
path: root/weed/replication/source
diff options
context:
space:
mode:
Diffstat (limited to 'weed/replication/source')
-rw-r--r--weed/replication/source/filer_source.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/weed/replication/source/filer_source.go b/weed/replication/source/filer_source.go
index f6a4cc55f..8d10dc59a 100644
--- a/weed/replication/source/filer_source.go
+++ b/weed/replication/source/filer_source.go
@@ -8,6 +8,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog"
"strings"
"context"
+ "net/http"
)
type ReplicationSource interface {
@@ -32,7 +33,7 @@ func (fs *FilerSource) initialize(grpcAddress string, dir string) (err error) {
return nil
}
-func (fs *FilerSource) ReadPart(part string) (readCloser io.ReadCloser, err error) {
+func (fs *FilerSource) ReadPart(part string) (filename string, header http.Header, readCloser io.ReadCloser, err error) {
vid2Locations := make(map[string]*filer_pb.Locations)
@@ -55,21 +56,21 @@ func (fs *FilerSource) ReadPart(part string) (readCloser io.ReadCloser, err erro
if err != nil {
glog.V(1).Infof("replication lookup volume id %s: %v", vid, err)
- return nil, fmt.Errorf("replication lookup volume id %s: %v", vid, err)
+ return "", nil, nil, fmt.Errorf("replication lookup volume id %s: %v", vid, err)
}
locations := vid2Locations[vid]
if locations == nil || len(locations.Locations) == 0 {
glog.V(1).Infof("replication locate volume id %s: %v", vid, err)
- return nil, fmt.Errorf("replication locate volume id %s: %v", vid, err)
+ return "", nil, nil, fmt.Errorf("replication locate volume id %s: %v", vid, err)
}
fileUrl := fmt.Sprintf("http://%s/%s", locations.Locations[0].Url, part)
- _, readCloser, err = util.DownloadUrl(fileUrl)
+ filename, header, readCloser, err = util.DownloadFile(fileUrl)
- return readCloser, err
+ return filename, header, readCloser, err
}
func (fs *FilerSource) withFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {