From 69090db9acfa7eb33cd431a45c6c28068a20ec66 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Thu, 9 Nov 2017 02:41:28 -0300 Subject: [bug] mark deletion as pending_delete if offline This commit creates a PENDING_DELETE sync status which can be used to keep track of whats deleted locally in order to propagate to server later. -- Related: #8961 --- src/leap/soledad/client/_db/blobs/__init__.py | 5 +++++ src/leap/soledad/client/_db/blobs/sql.py | 1 + 2 files changed, 6 insertions(+) (limited to 'src/leap') diff --git a/src/leap/soledad/client/_db/blobs/__init__.py b/src/leap/soledad/client/_db/blobs/__init__.py index 2df315dc..45fae024 100644 --- a/src/leap/soledad/client/_db/blobs/__init__.py +++ b/src/leap/soledad/client/_db/blobs/__init__.py @@ -405,10 +405,15 @@ class BlobManager(BlobsSynchronizer): @defer.inlineCallbacks def _delete(self, blob_id, namespace): + logger.info("Marking blobs as PENDING_DELETE: %s" % blob_id) + yield self.local.update_sync_status( + blob_id, SyncStatus.PENDING_DELETE, namespace=namespace) logger.info("Staring deletion of blob: %s" % blob_id) yield self._delete_from_remote(blob_id, namespace=namespace) if (yield self.local.exists(blob_id, namespace=namespace)): yield self.local.delete(blob_id, namespace=namespace) + yield self.local.update_sync_status( + blob_id, SyncStatus.SYNCED, namespace=namespace) @defer.inlineCallbacks def _delete_from_remote(self, blob_id, namespace=''): diff --git a/src/leap/soledad/client/_db/blobs/sql.py b/src/leap/soledad/client/_db/blobs/sql.py index 8d8ae158..c9a025a2 100644 --- a/src/leap/soledad/client/_db/blobs/sql.py +++ b/src/leap/soledad/client/_db/blobs/sql.py @@ -41,6 +41,7 @@ class SyncStatus: PENDING_DOWNLOAD = 3 FAILED_UPLOAD = 4 FAILED_DOWNLOAD = 5 + PENDING_DELETE = 6 UNAVAILABLE_STATUSES = (3, 5) -- cgit v1.2.3