Re-enable Export to the new backup format, add backup progress, add a test for the backup progress (#2023)

* Add progress for backup import/export

* Export to the new backup format

* Add tests for the new imex progress
This commit is contained in:
Hocuri
2020-12-01 09:05:25 +01:00
committed by GitHub
parent 4ef2a7c8d7
commit 2a9d06d817
4 changed files with 80 additions and 156 deletions

View File

@@ -20,6 +20,16 @@ class ImexTracker:
elif ffi_event.name == "DC_EVENT_IMEX_FILE_WRITTEN":
self._imex_events.put(ffi_event.data2)
def wait_progress(self, target_progress, progress_upper_limit=1000, progress_timeout=60):
while True:
ev = self._imex_events.get(timeout=progress_timeout)
if isinstance(ev, int) and ev >= target_progress:
assert ev <= progress_upper_limit, \
str(ev) + " exceeded upper progress limit " + str(progress_upper_limit)
return ev
if ev == 0:
return None
def wait_finish(self, progress_timeout=60):
""" Return list of written files, raise ValueError if ExportFailed. """
files_written = []