From 5faf22e4603d8130d11890f43f2f002821e8a976 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 25 Oct 2017 22:35:32 -0300 Subject: [refactor] add a table for sync_status As defined in #8970, this table and the new module will ease adding sync features such as priority queues and streaming. --Resolves: #8970 --- src/leap/soledad/client/_db/blobs/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/leap/soledad/client/_db/blobs/__init__.py') diff --git a/src/leap/soledad/client/_db/blobs/__init__.py b/src/leap/soledad/client/_db/blobs/__init__.py index 0120b222..3c8facba 100644 --- a/src/leap/soledad/client/_db/blobs/__init__.py +++ b/src/leap/soledad/client/_db/blobs/__init__.py @@ -196,8 +196,11 @@ class BlobManager(BlobsSynchronizer): check_http_status(response.code) defer.returnValue((yield response.json())) - def local_list(self, namespace='', sync_status=None): - return self.local.list(namespace, sync_status) + def local_list(self, namespace=''): + return self.local.list(namespace) + + def local_list_status(self, status, namespace=''): + return self.local.list_status(status, namespace) def put(self, doc, size, namespace=''): """ @@ -222,6 +225,8 @@ class BlobManager(BlobsSynchronizer): # TODO this is a tee really, but ok... could do db and upload # concurrently. not sure if we'd gain something. yield self.local.put(doc.blob_id, fd, size=size, namespace=namespace) + yield self.local.update_sync_status( + doc.blob_id, SyncStatus.PENDING_UPLOAD) # In fact, some kind of pipe is needed here, where each write on db # handle gets forwarded into a write on the connection handle fd = yield self.local.get(doc.blob_id, namespace=namespace) -- cgit v1.2.3