summaryrefslogtreecommitdiff
path: root/client/src/leap/soledad
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-03-27 23:13:58 -0300
committerdrebs <drebs@leap.se>2017-04-19 11:37:05 +0200
commit6da5ce6286336f5945e2eff5ceb0ae10116f8546 (patch)
tree198d2ebf95e348095a53373aaf0159d9c50e60bf /client/src/leap/soledad
parent639569f611963d8b876f7705accba4b88a1c871d (diff)
[feature] add send_missing to send pending uploads
This method will gather a list of local docs and a list of remote docs, compare them and send docs which server doesn't have. - Related: #8807
Diffstat (limited to 'client/src/leap/soledad')
-rw-r--r--client/src/leap/soledad/client/_blobs.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/client/src/leap/soledad/client/_blobs.py b/client/src/leap/soledad/client/_blobs.py
index b7dee538..fac65383 100644
--- a/client/src/leap/soledad/client/_blobs.py
+++ b/client/src/leap/soledad/client/_blobs.py
@@ -168,6 +168,18 @@ class BlobManager(object):
return self.local.list()
@defer.inlineCallbacks
+ def send_missing(self):
+ our_blobs = yield self.local_list()
+ server_blobs = yield self.remote_list()
+ missing = [b_id for b_id in our_blobs if b_id not in server_blobs]
+ logger.info("Amount of documents missing on server: %s" % len(missing))
+ # TODO: Send concurrently when we are able to stream directly from db
+ for blob_id in missing:
+ fd = yield self.local.get(blob_id)
+ logger.info("Upload local blob: %s" % blob_id)
+ yield self._encrypt_and_upload(blob_id, fd)
+
+ @defer.inlineCallbacks
def put(self, doc, size):
fd = doc.blob_fd
# TODO this is a tee really, but ok... could do db and upload