aboutsummaryrefslogtreecommitdiff
path: root/weed/operation/chunked_file.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-02-17 20:55:55 -0800
committerChris Lu <chris.lu@gmail.com>2021-02-17 20:55:55 -0800
commit6daa932f5c1571cc60cf89014cf17810d756dd6b (patch)
treea6c6fce133c0178efec6324c708f3371dcd4f180 /weed/operation/chunked_file.go
parentdd9f3a01049bef33046d3728d82b25b67b8533ac (diff)
downloadseaweedfs-6daa932f5c1571cc60cf89014cf17810d756dd6b.tar.xz
seaweedfs-6daa932f5c1571cc60cf89014cf17810d756dd6b.zip
refactoring to get master function, instead of passing master values directly
this will enable retrying later
Diffstat (limited to 'weed/operation/chunked_file.go')
-rw-r--r--weed/operation/chunked_file.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/weed/operation/chunked_file.go b/weed/operation/chunked_file.go
index 1bac028ff..8506e0518 100644
--- a/weed/operation/chunked_file.go
+++ b/weed/operation/chunked_file.go
@@ -72,12 +72,12 @@ func (cm *ChunkManifest) Marshal() ([]byte, error) {
return json.Marshal(cm)
}
-func (cm *ChunkManifest) DeleteChunks(master string, usePublicUrl bool, grpcDialOption grpc.DialOption) error {
+func (cm *ChunkManifest) DeleteChunks(masterFn GetMasterFn, usePublicUrl bool, grpcDialOption grpc.DialOption) error {
var fileIds []string
for _, ci := range cm.Chunks {
fileIds = append(fileIds, ci.Fid)
}
- results, err := DeleteFiles(master, usePublicUrl, grpcDialOption, fileIds)
+ results, err := DeleteFiles(masterFn, usePublicUrl, grpcDialOption, fileIds)
if err != nil {
glog.V(0).Infof("delete %+v: %v", fileIds, err)
return fmt.Errorf("chunk delete: %v", err)
@@ -174,7 +174,9 @@ func (cf *ChunkedFileReader) WriteTo(w io.Writer) (n int64, err error) {
for ; chunkIndex < len(cf.chunkList); chunkIndex++ {
ci := cf.chunkList[chunkIndex]
// if we need read date from local volume server first?
- fileUrl, lookupError := LookupFileId(cf.master, ci.Fid)
+ fileUrl, lookupError := LookupFileId(func() string {
+ return cf.master
+ }, ci.Fid)
if lookupError != nil {
return n, lookupError
}