|
|
@ -28,8 +28,8 @@ func ParseFileId(fid string) (vid string, key_cookie string, err error) { |
|
|
|
return fid[:commaIndex], fid[commaIndex+1:], nil |
|
|
|
} |
|
|
|
|
|
|
|
// DeleteFiles batch deletes a list of fileIds
|
|
|
|
func DeleteFiles(masterFn GetMasterFn, usePublicUrl bool, grpcDialOption grpc.DialOption, fileIds []string) ([]*volume_server_pb.DeleteResult, error) { |
|
|
|
// DeleteFileIds batch deletes a list of fileIds
|
|
|
|
func DeleteFileIds(masterFn GetMasterFn, usePublicUrl bool, grpcDialOption grpc.DialOption, fileIds []string) ([]*volume_server_pb.DeleteResult, error) { |
|
|
|
|
|
|
|
lookupFunc := func(vids []string) (results map[string]*LookupResult, err error) { |
|
|
|
results, err = LookupVolumeIds(masterFn, grpcDialOption, vids) |
|
|
@ -43,11 +43,11 @@ func DeleteFiles(masterFn GetMasterFn, usePublicUrl bool, grpcDialOption grpc.Di |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
return DeleteFilesWithLookupVolumeId(grpcDialOption, fileIds, lookupFunc) |
|
|
|
return DeleteFileIdsWithLookupVolumeId(grpcDialOption, fileIds, lookupFunc) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func DeleteFilesWithLookupVolumeId(grpcDialOption grpc.DialOption, fileIds []string, lookupFunc func(vid []string) (map[string]*LookupResult, error)) ([]*volume_server_pb.DeleteResult, error) { |
|
|
|
func DeleteFileIdsWithLookupVolumeId(grpcDialOption grpc.DialOption, fileIds []string, lookupFunc func(vid []string) (map[string]*LookupResult, error)) ([]*volume_server_pb.DeleteResult, error) { |
|
|
|
|
|
|
|
var ret []*volume_server_pb.DeleteResult |
|
|
|
|
|
|
@ -102,7 +102,7 @@ func DeleteFilesWithLookupVolumeId(grpcDialOption grpc.DialOption, fileIds []str |
|
|
|
go func(server pb.ServerAddress, fidList []string) { |
|
|
|
defer wg.Done() |
|
|
|
|
|
|
|
if deleteResults, deleteErr := DeleteFilesAtOneVolumeServer(server, grpcDialOption, fidList, false); deleteErr != nil { |
|
|
|
if deleteResults, deleteErr := DeleteFileIdsAtOneVolumeServer(server, grpcDialOption, fidList, false); deleteErr != nil { |
|
|
|
err = deleteErr |
|
|
|
} else if deleteResults != nil { |
|
|
|
resultChan <- deleteResults |
|
|
@ -120,8 +120,8 @@ func DeleteFilesWithLookupVolumeId(grpcDialOption grpc.DialOption, fileIds []str |
|
|
|
return ret, err |
|
|
|
} |
|
|
|
|
|
|
|
// DeleteFilesAtOneVolumeServer deletes a list of files that is on one volume server via gRpc
|
|
|
|
func DeleteFilesAtOneVolumeServer(volumeServer pb.ServerAddress, grpcDialOption grpc.DialOption, fileIds []string, includeCookie bool) (ret []*volume_server_pb.DeleteResult, err error) { |
|
|
|
// DeleteFileIdsAtOneVolumeServer deletes a list of files that is on one volume server via gRpc
|
|
|
|
func DeleteFileIdsAtOneVolumeServer(volumeServer pb.ServerAddress, grpcDialOption grpc.DialOption, fileIds []string, includeCookie bool) (ret []*volume_server_pb.DeleteResult, err error) { |
|
|
|
|
|
|
|
err = WithVolumeServerClient(false, volumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error { |
|
|
|
|
|
|
|