rclone-api 1.1.10__py2.py3-none-any.whl → 1.1.11__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rclone_api/s3/chunk_types.py +14 -0
- rclone_api/s3/chunk_uploader.py +19 -1
- {rclone_api-1.1.10.dist-info → rclone_api-1.1.11.dist-info}/METADATA +1 -1
- {rclone_api-1.1.10.dist-info → rclone_api-1.1.11.dist-info}/RECORD +8 -8
- {rclone_api-1.1.10.dist-info → rclone_api-1.1.11.dist-info}/LICENSE +0 -0
- {rclone_api-1.1.10.dist-info → rclone_api-1.1.11.dist-info}/WHEEL +0 -0
- {rclone_api-1.1.10.dist-info → rclone_api-1.1.11.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.1.10.dist-info → rclone_api-1.1.11.dist-info}/top_level.txt +0 -0
rclone_api/s3/chunk_types.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import hashlib
|
|
1
2
|
import json
|
|
2
3
|
import os
|
|
3
4
|
import time
|
|
@@ -103,6 +104,19 @@ class UploadInfo:
|
|
|
103
104
|
return
|
|
104
105
|
self._total_chunks = self.total_chunks()
|
|
105
106
|
|
|
107
|
+
def fingerprint(self) -> str:
|
|
108
|
+
# hash the attributes that are used to identify the upload
|
|
109
|
+
hasher = hashlib.sha256()
|
|
110
|
+
# first is file size
|
|
111
|
+
hasher.update(str(self.file_size).encode("utf-8"))
|
|
112
|
+
# second is the file path
|
|
113
|
+
hasher.update(str(self.src_file_path).encode("utf-8"))
|
|
114
|
+
# next is chunk size
|
|
115
|
+
hasher.update(str(self.chunk_size).encode("utf-8"))
|
|
116
|
+
# next is the number of parts
|
|
117
|
+
hasher.update(str(self._total_chunks).encode("utf-8"))
|
|
118
|
+
return hasher.hexdigest()
|
|
119
|
+
|
|
106
120
|
def to_json(self) -> dict:
|
|
107
121
|
json_dict = {}
|
|
108
122
|
for f in fields(self):
|
rclone_api/s3/chunk_uploader.py
CHANGED
|
@@ -162,7 +162,25 @@ def upload_file_multipart(
|
|
|
162
162
|
return upload_state
|
|
163
163
|
|
|
164
164
|
filechunks: Queue[FileChunk | None] = Queue(10)
|
|
165
|
-
|
|
165
|
+
new_state = make_new_state()
|
|
166
|
+
loaded_state = get_upload_state()
|
|
167
|
+
|
|
168
|
+
if loaded_state is None:
|
|
169
|
+
upload_state = new_state
|
|
170
|
+
else:
|
|
171
|
+
# if the file size has changed, we cannot resume
|
|
172
|
+
if (
|
|
173
|
+
loaded_state.upload_info.fingerprint()
|
|
174
|
+
!= new_state.upload_info.fingerprint()
|
|
175
|
+
):
|
|
176
|
+
locked_print(
|
|
177
|
+
f"Cannot resume upload: file size changed, starting over for {file_path}"
|
|
178
|
+
)
|
|
179
|
+
_abort_previous_upload(loaded_state)
|
|
180
|
+
upload_state = new_state
|
|
181
|
+
else:
|
|
182
|
+
upload_state = loaded_state
|
|
183
|
+
|
|
166
184
|
try:
|
|
167
185
|
upload_state.update_source_file(file_path)
|
|
168
186
|
except ValueError as e:
|
|
@@ -28,13 +28,13 @@ rclone_api/experimental/flags_base.py,sha256=ajU_czkTcAxXYU-SlmiCfHY7aCQGHvpCLqJ
|
|
|
28
28
|
rclone_api/s3/api.py,sha256=VstlaEnBjO2JDQuCRLdTfUGvQLbfshlXXhAzimFv4Vc,3763
|
|
29
29
|
rclone_api/s3/basic_ops.py,sha256=hK3366xhVEzEcjz9Gk_8lFx6MRceAk72cax6mUrr6ko,2104
|
|
30
30
|
rclone_api/s3/chunk_file.py,sha256=XPoDl7DJMJIGBMRoPO2wqwqCMT7ZrIsEkDqlbMH8jzs,3506
|
|
31
|
-
rclone_api/s3/chunk_types.py,sha256=
|
|
32
|
-
rclone_api/s3/chunk_uploader.py,sha256=
|
|
31
|
+
rclone_api/s3/chunk_types.py,sha256=pZUKc3L418XTwET1rLm4eRo_2swKQckSqlc4XjYmhDo,9147
|
|
32
|
+
rclone_api/s3/chunk_uploader.py,sha256=Y4I208YoXTJQQke1qRsXARHxBLjJAz9nt_r1mKkplUQ,9670
|
|
33
33
|
rclone_api/s3/create.py,sha256=SK3IGHZwsSkoG4Zb4NCphcVg9_f7VifDKng-tExMS2s,3088
|
|
34
34
|
rclone_api/s3/types.py,sha256=81_3jwg6MGIxC-GxL-6zANzKO6au9C0BWvAqRyODxOM,1361
|
|
35
|
-
rclone_api-1.1.
|
|
36
|
-
rclone_api-1.1.
|
|
37
|
-
rclone_api-1.1.
|
|
38
|
-
rclone_api-1.1.
|
|
39
|
-
rclone_api-1.1.
|
|
40
|
-
rclone_api-1.1.
|
|
35
|
+
rclone_api-1.1.11.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
|
36
|
+
rclone_api-1.1.11.dist-info/METADATA,sha256=LnxU7g0Hzoe_gvGmz1F0MKU67cRtsJEPk1Gkxe6SQVQ,4479
|
|
37
|
+
rclone_api-1.1.11.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
|
|
38
|
+
rclone_api-1.1.11.dist-info/entry_points.txt,sha256=6eNqTRXKhVf8CpWNjXiOa_0Du9tHiW_HD2iQSXRsUg8,132
|
|
39
|
+
rclone_api-1.1.11.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
|
|
40
|
+
rclone_api-1.1.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|