summaryrefslogtreecommitdiff
path: root/server/src/leap/soledad
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2016-11-21 01:08:49 -0300
committerdrebs <drebs@leap.se>2016-12-12 09:15:21 -0200
commit171dff213b9aacdb7ac4f86ed81e741aa965aa35 (patch)
tree2d748ae8480c26551461c37790274c82d59c6024 /server/src/leap/soledad
parent8ebed9c686f79b6d099266d3c5440f5dc9fb383e (diff)
[refactor] remove dead parameters, improve comments
received docs makes no sense for a single request download, plus all its comments and docstrings. Also updated docstrings for other methods. The method that tests if sqlcipher is encrypted can return a db handle that can be used right away. If we ignore it and reopen we can end up with a lost open cursor.
Diffstat (limited to 'server/src/leap/soledad')
-rw-r--r--server/src/leap/soledad/server/__init__.py4
-rw-r--r--server/src/leap/soledad/server/sync.py17
2 files changed, 5 insertions, 16 deletions
diff --git a/server/src/leap/soledad/server/__init__.py b/server/src/leap/soledad/server/__init__.py
index 7ba95543..039bef75 100644
--- a/server/src/leap/soledad/server/__init__.py
+++ b/server/src/leap/soledad/server/__init__.py
@@ -235,10 +235,8 @@ class HTTPInvocationByMethodWithBody(
return meth_end()
# handle outgoing documents
elif content_type == 'application/x-soledad-sync-get':
- line = body_getline()
- entry = line.strip()
meth_get = self._lookup('%s_get' % method)
- return meth_get({}, line)
+ return meth_get()
else:
raise http_app.BadRequest()
else:
diff --git a/server/src/leap/soledad/server/sync.py b/server/src/leap/soledad/server/sync.py
index f505a044..b553a056 100644
--- a/server/src/leap/soledad/server/sync.py
+++ b/server/src/leap/soledad/server/sync.py
@@ -56,7 +56,7 @@ class SyncExchange(sync.SyncExchange):
# recover sync state
self._sync_state = ServerSyncState(self.source_replica_uid, sync_id)
- def find_changes_to_return(self, received):
+ def find_changes_to_return(self):
"""
Find changes to return.
@@ -64,10 +64,6 @@ class SyncExchange(sync.SyncExchange):
order using whats_changed. It excludes documents ids that have
already been considered (superseded by the sender, etc).
- :param received: How many documents the source replica has already
- received during the current sync process.
- :type received: int
-
:return: the generation of this database, which the caller can
consider themselves to be synchronized after processing
allreturned documents, and the amount of documents to be sent
@@ -252,14 +248,9 @@ class SyncResource(http_app.SyncResource):
self._staging = []
self._staging_size = 0
- @http_app.http_method(received=int, content_as_args=True)
- def post_get(self, received):
+ def post_get(self):
"""
- Return one syncing document to the client.
-
- :param received: How many documents have already been received by the
- client on the current sync session.
- :type received: int
+ Return syncing documents to the client.
"""
def send_doc(doc, gen, trans_id):
entry = dict(id=doc.doc_id, rev=doc.rev,
@@ -278,7 +269,7 @@ class SyncResource(http_app.SyncResource):
self.responder.stream_entry('')
new_gen, number_of_changes = \
- self.sync_exch.find_changes_to_return(received)
+ self.sync_exch.find_changes_to_return()
self.responder.content_type = 'application/x-u1db-sync-response'
self.responder.start_response(200)
self.responder.start_stream(),