diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-04-29 13:26:02 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-04-29 13:26:02 -0700 |
| commit | ed3cf811f576e2dd9fd1c1fb0df967d7fb9e6f1c (patch) | |
| tree | c74581440a5f375bedc0d03a99dc51a536f971ed /weed/replication/source | |
| parent | 7c10602b49dca54591337597f48da6e228a7068d (diff) | |
| download | seaweedfs-ed3cf811f576e2dd9fd1c1fb0df967d7fb9e6f1c.tar.xz seaweedfs-ed3cf811f576e2dd9fd1c1fb0df967d7fb9e6f1c.zip | |
refactoring
Diffstat (limited to 'weed/replication/source')
| -rw-r--r-- | weed/replication/source/filer_source.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/weed/replication/source/filer_source.go b/weed/replication/source/filer_source.go index 90bcffdf0..69c23fe82 100644 --- a/weed/replication/source/filer_source.go +++ b/weed/replication/source/filer_source.go @@ -47,7 +47,7 @@ func (fs *FilerSource) LookupFileId(part string) (fileUrl string, err error) { vid := volumeId(part) - err = fs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { + err = fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { glog.V(4).Infof("read lookup volume id locations: %v", vid) resp, err := client.LookupVolume(context.Background(), &filer_pb.LookupVolumeRequest{ @@ -91,7 +91,9 @@ func (fs *FilerSource) ReadPart(part string) (filename string, header http.Heade return filename, header, readCloser, err } -func (fs *FilerSource) withFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error { +var _ = filer_pb.FilerClient(&FilerSource{}) + +func (fs *FilerSource) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error { return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error { client := filer_pb.NewSeaweedFilerClient(grpcConnection) @@ -100,6 +102,10 @@ func (fs *FilerSource) withFilerClient(fn func(filer_pb.SeaweedFilerClient) erro } +func (fs *FilerSource) AdjustedUrl(hostAndPort string) string { + return hostAndPort +} + func volumeId(fileId string) string { lastCommaIndex := strings.LastIndex(fileId, ",") if lastCommaIndex > 0 { |
