diff options
| author | Chris Lu <chris.lu@gmail.com> | 2018-09-21 01:54:29 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2018-09-21 01:54:29 -0700 |
| commit | a6cfaba018984ba17b9eab802db909bac644b67b (patch) | |
| tree | 71d00727c28ac5cc527412306db3b98763f2eb68 /weed/replication/source | |
| parent | a8cd7df44ae5d3bea4b0c9ce3d3ab71c7b3cc60c (diff) | |
| download | seaweedfs-a6cfaba018984ba17b9eab802db909bac644b67b.tar.xz seaweedfs-a6cfaba018984ba17b9eab802db909bac644b67b.zip | |
able to sync the changes
Diffstat (limited to 'weed/replication/source')
| -rw-r--r-- | weed/replication/source/filer_source.go | 11 |
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 { |
