From 222c229d29b9b8e6ed72897b1c96d23f0d8de80e Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 2 Jul 2014 12:22:25 -0300 Subject: Split sync_exchange into many requests (#5517). --- server/src/leap/soledad/server/sync.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'server') diff --git a/server/src/leap/soledad/server/sync.py b/server/src/leap/soledad/server/sync.py index c6928aaa..3a1881fc 100644 --- a/server/src/leap/soledad/server/sync.py +++ b/server/src/leap/soledad/server/sync.py @@ -210,6 +210,8 @@ class SyncExchange(sync.SyncExchange): :param last_known_generation: The last target replica generation the source replica knows about. :type last_known_generation: int + :param sync_id: The id of the current sync session. + :type sync_id: str """ self._db = db self.source_replica_uid = source_replica_uid @@ -284,7 +286,8 @@ class SyncExchange(sync.SyncExchange): doc = self._db.get_doc(changed_doc_id, include_deleted=True) return_doc_cb(doc, gen, trans_id) - def insert_doc_from_source(self, doc, source_gen, trans_id): + def insert_doc_from_source(self, doc, source_gen, trans_id, + number_of_docs=None, sync_id=None): """Try to insert synced document from source. Conflicting documents are not inserted but will be sent over @@ -302,10 +305,16 @@ class SyncExchange(sync.SyncExchange): :type source_gen: int :param trans_id: The transaction id of that document change. :type trans_id: str + :param number_of_docs: The total amount of documents sent on this sync + session. + :type number_of_docs: int + :param sync_id: The id of the current sync session. + :type sync_id: str """ state, at_gen = self._db._put_doc_if_newer( doc, save_conflict=False, replica_uid=self.source_replica_uid, - replica_gen=source_gen, replica_trans_id=trans_id) + replica_gen=source_gen, replica_trans_id=trans_id, + number_of_docs=number_of_docs, sync_id=sync_id) if state == 'inserted': self._sync_state.put_seen_id(doc.doc_id, at_gen) elif state == 'converged': @@ -340,6 +349,8 @@ class SyncResource(http_app.SyncResource): :param last_known_trans_id: The last server replica transaction_id the client knows about. :type last_known_trans_id: str + :param sync_id: The id of the current sync session. + :type sync_id: str :param ensure: Whether the server replica should be created if it does not already exist. :type ensure: bool @@ -355,9 +366,10 @@ class SyncResource(http_app.SyncResource): # get a sync exchange object self.sync_exch = self.sync_exchange_class( db, self.source_replica_uid, last_known_generation, sync_id) + self._sync_id = sync_id @http_app.http_method(content_as_args=True) - def post_put(self, id, rev, content, gen, trans_id): + def post_put(self, id, rev, content, gen, trans_id, number_of_docs): """ Put one incoming document into the server replica. @@ -373,9 +385,14 @@ class SyncResource(http_app.SyncResource): :param trans_id: The source replica transaction id corresponding to the revision of the incoming document. :type trans_id: str + :param number_of_docs: The total amount of documents sent on this sync + session. + :type number_of_docs: int """ doc = Document(id, rev, content) - self.sync_exch.insert_doc_from_source(doc, gen, trans_id) + self.sync_exch.insert_doc_from_source( + doc, gen, trans_id, number_of_docs=number_of_docs, + sync_id=self._sync_id) @http_app.http_method(received=int, content_as_args=True) def post_get(self, received): -- cgit v1.2.3 From dd82ea1c9055eb46bdfac46c9a1ef9ed41fac850 Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 2 Jul 2014 12:35:55 -0300 Subject: Add changes files. --- server/changes/feature_3399-check-auth-in-constant-way | 1 + server/changes/feature_5571_allow-for-interrupting-and-recovering-sync | 1 + server/changes/feature_5571_split-sync-post | 1 + 3 files changed, 3 insertions(+) create mode 100644 server/changes/feature_3399-check-auth-in-constant-way create mode 100644 server/changes/feature_5571_allow-for-interrupting-and-recovering-sync create mode 100644 server/changes/feature_5571_split-sync-post (limited to 'server') diff --git a/server/changes/feature_3399-check-auth-in-constant-way b/server/changes/feature_3399-check-auth-in-constant-way new file mode 100644 index 00000000..ebd18680 --- /dev/null +++ b/server/changes/feature_3399-check-auth-in-constant-way @@ -0,0 +1 @@ + o Authenticate in time-insensitive manner. Closes #3399. diff --git a/server/changes/feature_5571_allow-for-interrupting-and-recovering-sync b/server/changes/feature_5571_allow-for-interrupting-and-recovering-sync new file mode 100644 index 00000000..0087c535 --- /dev/null +++ b/server/changes/feature_5571_allow-for-interrupting-and-recovering-sync @@ -0,0 +1 @@ + o Allow for interrupting and recovering sync (#5517). diff --git a/server/changes/feature_5571_split-sync-post b/server/changes/feature_5571_split-sync-post new file mode 100644 index 00000000..ad269cd4 --- /dev/null +++ b/server/changes/feature_5571_split-sync-post @@ -0,0 +1 @@ + o Split sync in multiple POST requests in server (#5571). -- cgit v1.2.3 From 1e69bf4aceb2502a17dff98581acc7abcf41e168 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 7 Jul 2014 11:34:47 -0300 Subject: Update target sync with sequential info (#5869). --- server/src/leap/soledad/server/sync.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'server') diff --git a/server/src/leap/soledad/server/sync.py b/server/src/leap/soledad/server/sync.py index 3a1881fc..6dc99b5a 100644 --- a/server/src/leap/soledad/server/sync.py +++ b/server/src/leap/soledad/server/sync.py @@ -287,7 +287,7 @@ class SyncExchange(sync.SyncExchange): return_doc_cb(doc, gen, trans_id) def insert_doc_from_source(self, doc, source_gen, trans_id, - number_of_docs=None, sync_id=None): + number_of_docs=None, doc_idx=None, sync_id=None): """Try to insert synced document from source. Conflicting documents are not inserted but will be sent over @@ -308,13 +308,15 @@ class SyncExchange(sync.SyncExchange): :param number_of_docs: The total amount of documents sent on this sync session. :type number_of_docs: int + :param doc_idx: The index of the current document. + :type doc_idx: int :param sync_id: The id of the current sync session. :type sync_id: str """ state, at_gen = self._db._put_doc_if_newer( doc, save_conflict=False, replica_uid=self.source_replica_uid, replica_gen=source_gen, replica_trans_id=trans_id, - number_of_docs=number_of_docs, sync_id=sync_id) + number_of_docs=number_of_docs, doc_idx=doc_idx, sync_id=sync_id) if state == 'inserted': self._sync_state.put_seen_id(doc.doc_id, at_gen) elif state == 'converged': @@ -369,7 +371,8 @@ class SyncResource(http_app.SyncResource): self._sync_id = sync_id @http_app.http_method(content_as_args=True) - def post_put(self, id, rev, content, gen, trans_id, number_of_docs): + def post_put(self, id, rev, content, gen, trans_id, number_of_docs, + doc_idx): """ Put one incoming document into the server replica. @@ -388,11 +391,13 @@ class SyncResource(http_app.SyncResource): :param number_of_docs: The total amount of documents sent on this sync session. :type number_of_docs: int + :param doc_idx: The index of the current document. + :type doc_idx: int """ doc = Document(id, rev, content) self.sync_exch.insert_doc_from_source( doc, gen, trans_id, number_of_docs=number_of_docs, - sync_id=self._sync_id) + doc_idx=doc_idx, sync_id=self._sync_id) @http_app.http_method(received=int, content_as_args=True) def post_get(self, received): -- cgit v1.2.3 From 9769301256f994061111e9a18beae90160cc809f Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 10 Jul 2014 14:20:57 -0300 Subject: Pin PyOpenSSL dep to avoid uneeded deps (#5368). --- server/changes/bug_5368_avoid-yet-another-crypto-dep | 2 ++ server/pkg/requirements.pip | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 server/changes/bug_5368_avoid-yet-another-crypto-dep (limited to 'server') diff --git a/server/changes/bug_5368_avoid-yet-another-crypto-dep b/server/changes/bug_5368_avoid-yet-another-crypto-dep new file mode 100644 index 00000000..6f3f2b04 --- /dev/null +++ b/server/changes/bug_5368_avoid-yet-another-crypto-dep @@ -0,0 +1,2 @@ + o Pin PyOpenSSL dependency version to <0.14 to avoid yet another crypto + dependency. diff --git a/server/pkg/requirements.pip b/server/pkg/requirements.pip index 7cbca401..be5d156b 100644 --- a/server/pkg/requirements.pip +++ b/server/pkg/requirements.pip @@ -3,7 +3,7 @@ couchdb simplejson u1db routes -PyOpenSSL +PyOpenSSL<0.14 # TODO: maybe we just want twisted-web? twisted>=12.0.0 -- cgit v1.2.3 From 4739fd00ba7dd57ef840a953c707c331be4a058f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Fri, 18 Jul 2014 11:09:13 -0300 Subject: Fold in changes --- server/changes/bug_5368_avoid-yet-another-crypto-dep | 2 -- server/changes/feature_3399-check-auth-in-constant-way | 1 - server/changes/feature_5571_allow-for-interrupting-and-recovering-sync | 1 - server/changes/feature_5571_split-sync-post | 1 - 4 files changed, 5 deletions(-) delete mode 100644 server/changes/bug_5368_avoid-yet-another-crypto-dep delete mode 100644 server/changes/feature_3399-check-auth-in-constant-way delete mode 100644 server/changes/feature_5571_allow-for-interrupting-and-recovering-sync delete mode 100644 server/changes/feature_5571_split-sync-post (limited to 'server') diff --git a/server/changes/bug_5368_avoid-yet-another-crypto-dep b/server/changes/bug_5368_avoid-yet-another-crypto-dep deleted file mode 100644 index 6f3f2b04..00000000 --- a/server/changes/bug_5368_avoid-yet-another-crypto-dep +++ /dev/null @@ -1,2 +0,0 @@ - o Pin PyOpenSSL dependency version to <0.14 to avoid yet another crypto - dependency. diff --git a/server/changes/feature_3399-check-auth-in-constant-way b/server/changes/feature_3399-check-auth-in-constant-way deleted file mode 100644 index ebd18680..00000000 --- a/server/changes/feature_3399-check-auth-in-constant-way +++ /dev/null @@ -1 +0,0 @@ - o Authenticate in time-insensitive manner. Closes #3399. diff --git a/server/changes/feature_5571_allow-for-interrupting-and-recovering-sync b/server/changes/feature_5571_allow-for-interrupting-and-recovering-sync deleted file mode 100644 index 0087c535..00000000 --- a/server/changes/feature_5571_allow-for-interrupting-and-recovering-sync +++ /dev/null @@ -1 +0,0 @@ - o Allow for interrupting and recovering sync (#5517). diff --git a/server/changes/feature_5571_split-sync-post b/server/changes/feature_5571_split-sync-post deleted file mode 100644 index ad269cd4..00000000 --- a/server/changes/feature_5571_split-sync-post +++ /dev/null @@ -1 +0,0 @@ - o Split sync in multiple POST requests in server (#5571). -- cgit v1.2.3