mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add fileId to UploadWithRetry return result
This commit is contained in:
parent
d49d0a9fc2
commit
a3553da7f7
|
@ -585,8 +585,7 @@ func detectMimeType(f *os.File) string {
|
||||||
|
|
||||||
func (worker *FileCopyWorker) saveDataAsChunk(reader io.Reader, name string, offset int64) (chunk *filer_pb.FileChunk, err error) {
|
func (worker *FileCopyWorker) saveDataAsChunk(reader io.Reader, name string, offset int64) (chunk *filer_pb.FileChunk, err error) {
|
||||||
|
|
||||||
var finalFileId string
|
finalFileId, uploadResult, flushErr, _ := operation.UploadWithRetry(
|
||||||
uploadResult, flushErr, _ := operation.UploadWithRetry(
|
|
||||||
worker,
|
worker,
|
||||||
&filer_pb.AssignVolumeRequest{
|
&filer_pb.AssignVolumeRequest{
|
||||||
Count: 1,
|
Count: 1,
|
||||||
|
@ -604,7 +603,6 @@ func (worker *FileCopyWorker) saveDataAsChunk(reader io.Reader, name string, off
|
||||||
PairMap: nil,
|
PairMap: nil,
|
||||||
},
|
},
|
||||||
func(host, fileId string) string {
|
func(host, fileId string) string {
|
||||||
finalFileId = fileId
|
|
||||||
return fmt.Sprintf("http://%s/%s", host, fileId)
|
return fmt.Sprintf("http://%s/%s", host, fileId)
|
||||||
},
|
},
|
||||||
reader,
|
reader,
|
||||||
|
|
|
@ -80,10 +80,10 @@ func init() {
|
||||||
|
|
||||||
// UploadWithRetry will retry both assigning volume request and uploading content
|
// UploadWithRetry will retry both assigning volume request and uploading content
|
||||||
// The option parameter does not need to specify UploadUrl and Jwt, which will come from assigning volume.
|
// The option parameter does not need to specify UploadUrl and Jwt, which will come from assigning volume.
|
||||||
func UploadWithRetry(filerClient filer_pb.FilerClient, assignRequest *filer_pb.AssignVolumeRequest, uploadOption *UploadOption, genFileUrlFn func(host, fileId string) string, reader io.Reader) (uploadResult *UploadResult, err error, data []byte) {
|
func UploadWithRetry(filerClient filer_pb.FilerClient, assignRequest *filer_pb.AssignVolumeRequest, uploadOption *UploadOption, genFileUrlFn func(host, fileId string) string, reader io.Reader) (fileId string, uploadResult *UploadResult, err error, data []byte) {
|
||||||
doUploadFunc := func() error {
|
doUploadFunc := func() error {
|
||||||
|
|
||||||
var fileId, host string
|
var host string
|
||||||
var auth security.EncodedJwt
|
var auth security.EncodedJwt
|
||||||
|
|
||||||
// grpc assign volume
|
// grpc assign volume
|
||||||
|
|
Loading…
Reference in a new issue