able to sync the changes
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user