12345678910111213141516171819 |
- def start_upload(self):
- clean_flag = False
- # 检查是否能够正常接入
- self.check_access()
- # 获取桶内是否存在分片上传信息
- upload_id_list = self.get_upload_id_list()
- # 是否清理未完成的分片
- if upload_id_list:
- clean_flag = self.clean_unfinished_upload(upload_id_list)
- upload_id = self.check_object_exist(upload_id_list, clean_flag)
- part_number_list = self.check_part_number_list(upload_id)
- file_index_list = self.split_source_file()
- # 分片上传文件
- if VIRTUAL_FILE_FLAG:
- self.upload_virtual_file_part(upload_id, file_index_list, part_number_list)
- else:
- self.upload_part(upload_id, file_index_list, part_number_list)
- # 合并文件
- self.complete_upload(upload_id, len(file_index_list))
|