diff options
| author | drebs <drebs@leap.se> | 2015-08-03 11:31:04 -0300 | 
|---|---|---|
| committer | drebs <drebs@leap.se> | 2015-08-03 11:31:04 -0300 | 
| commit | 93c853234ced6564b6d7158c47e0804569113f04 (patch) | |
| tree | 1e5e75d5232d004fef47ea9baee6bdcb4889d26d /scripts/db_access | |
| parent | 1b4b4c2e314dd1dd7934444216451d3509c7d1d3 (diff) | |
[feat] allow repeated sync in client db script
Diffstat (limited to 'scripts/db_access')
| -rw-r--r-- | scripts/db_access/client_side_db.py | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/scripts/db_access/client_side_db.py b/scripts/db_access/client_side_db.py index f43b2f14..422afffa 100644 --- a/scripts/db_access/client_side_db.py +++ b/scripts/db_access/client_side_db.py @@ -173,6 +173,9 @@ def _parse_args():          '--sync', '-s', action='store_true',          help='synchronize with the server replica')      parser.add_argument( +        '--repeat-sync', '-r', action='store_true', +        help='repeat synchronization until no new data is received') +    parser.add_argument(          '--export-public-key', help="export the public key to a file")      parser.add_argument(          '--export-private-key', help="export the private key to a file") @@ -251,6 +254,12 @@ def _main(soledad, km, args):                  yield soledad.create_doc(content)          if args.sync:              yield soledad.sync() +        if args.repeat_sync: +            old_gen = 0 +            new_gen = yield soledad.sync() +            while old_gen != new_gen: +                old_gen = new_gen +                new_gen = yield soledad.sync()          if args.get_all_docs:              yield _get_all_docs(soledad)          if args.export_private_key: | 
