multipart_upload_15.py 800 B

12345678910111213141516171819
  1. def start_upload(self):
  2. clean_flag = False
  3. # 检查是否能够正常接入
  4. self.check_access()
  5. # 获取桶内是否存在分片上传信息
  6. upload_id_list = self.get_upload_id_list()
  7. # 是否清理未完成的分片
  8. if upload_id_list:
  9. clean_flag = self.clean_unfinished_upload(upload_id_list)
  10. upload_id = self.check_object_exist(upload_id_list, clean_flag)
  11. part_number_list = self.check_part_number_list(upload_id)
  12. file_index_list = self.split_source_file()
  13. # 分片上传文件
  14. if VIRTUAL_FILE_FLAG:
  15. self.upload_virtual_file_part(upload_id, file_index_list, part_number_list)
  16. else:
  17. self.upload_part(upload_id, file_index_list, part_number_list)
  18. # 合并文件
  19. self.complete_upload(upload_id, len(file_index_list))