github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/obs/client_resume.go (about)

     1  package obs
     2  
     3  // UploadFile resume uploads.
     4  //
     5  // This API is an encapsulated and enhanced version of multipart upload, and aims to eliminate large file
     6  // upload failures caused by poor network conditions and program breakdowns.
     7  func (obsClient ObsClient) UploadFile(input *UploadFileInput) (output *CompleteMultipartUploadOutput, err error) {
     8  	if input.EnableCheckpoint && input.CheckpointFile == "" {
     9  		input.CheckpointFile = input.UploadFile + ".uploadfile_record"
    10  	}
    11  
    12  	if input.TaskNum <= 0 {
    13  		input.TaskNum = 1
    14  	}
    15  	if input.PartSize < MIN_PART_SIZE {
    16  		input.PartSize = MIN_PART_SIZE
    17  	} else if input.PartSize > MAX_PART_SIZE {
    18  		input.PartSize = MAX_PART_SIZE
    19  	}
    20  
    21  	output, err = obsClient.resumeUpload(input)
    22  	return
    23  }
    24  
    25  // DownloadFile resume downloads.
    26  //
    27  // This API is an encapsulated and enhanced version of partial download, and aims to eliminate large file
    28  // download failures caused by poor network conditions and program breakdowns.
    29  func (obsClient ObsClient) DownloadFile(input *DownloadFileInput) (output *GetObjectMetadataOutput, err error) {
    30  	if input.DownloadFile == "" {
    31  		input.DownloadFile = input.Key
    32  	}
    33  
    34  	if input.EnableCheckpoint && input.CheckpointFile == "" {
    35  		input.CheckpointFile = input.DownloadFile + ".downloadfile_record"
    36  	}
    37  
    38  	if input.TaskNum <= 0 {
    39  		input.TaskNum = 1
    40  	}
    41  	if input.PartSize <= 0 {
    42  		input.PartSize = DEFAULT_PART_SIZE
    43  	}
    44  
    45  	output, err = obsClient.resumeDownload(input)
    46  	return
    47  }