|
|
@ -181,6 +181,9 @@ type ObjectPutOptions struct { |
|
|
|
//
|
|
|
|
// https://www.qcloud.com/document/product/436/7749
|
|
|
|
func (s *ObjectService) Put(ctx context.Context, name string, r io.Reader, opt *ObjectPutOptions) (*Response, error) { |
|
|
|
if err := CheckReaderLen(r); err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
if opt != nil && opt.Listener != nil { |
|
|
|
totalBytes, err := GetReaderLen(r) |
|
|
|
if err != nil { |
|
|
@ -802,6 +805,7 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string |
|
|
|
progressCallback(listener, event) |
|
|
|
|
|
|
|
// 4.Push jobs
|
|
|
|
go func() { |
|
|
|
for _, chunk := range chunks { |
|
|
|
if chunk.Done { |
|
|
|
continue |
|
|
@ -824,6 +828,7 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string |
|
|
|
chjobs <- job |
|
|
|
} |
|
|
|
close(chjobs) |
|
|
|
}() |
|
|
|
|
|
|
|
// 5.Recv the resp etag to complete
|
|
|
|
for i := 0; i < partNum; i++ { |
|
|
@ -854,6 +859,7 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string |
|
|
|
event = newProgressEvent(ProgressDataEvent, chunks[res.PartNumber-1].Size, consumedBytes, totalBytes) |
|
|
|
progressCallback(listener, event) |
|
|
|
} |
|
|
|
close(chresults) |
|
|
|
sort.Sort(ObjectList(optcom.Parts)) |
|
|
|
|
|
|
|
event = newProgressEvent(ProgressCompletedEvent, 0, consumedBytes, totalBytes) |
|
|
|