summaryrefslogtreecommitdiff
path: root/tools/merge_backup.py
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2016-07-08 16:51:55 +0200
committerMagnus Ahltorp <map@kth.se>2016-07-08 16:51:55 +0200
commit9039104a2203e3467a2420348e5cee43eb5bd5af (patch)
tree6f6e565cf504aaab6b43fb60734b89142dc25477 /tools/merge_backup.py
parented94e0682912a8ee16cb5a1427166c3e77b51b50 (diff)
Added permdb support to mergecatlfish-78
Diffstat (limited to 'tools/merge_backup.py')
-rwxr-xr-xtools/merge_backup.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/merge_backup.py b/tools/merge_backup.py
index 48ac133..ab2625d 100755
--- a/tools/merge_backup.py
+++ b/tools/merge_backup.py
@@ -12,9 +12,9 @@ from time import sleep
from certtools import timing_point, build_merkle_tree, write_file, \
create_ssl_context
from mergetools import chunks, backup_sendlog, get_logorder, \
- get_verifiedsize, get_missingentriesforbackup, read_chain, \
+ get_verifiedsize, get_missingentriesforbackup, \
hexencode, setverifiedsize, sendentries_merge, verifyroot, \
- get_nfetched, parse_args
+ get_nfetched, parse_args, perm
def backup_loop(nodename, nodeaddress, own_key, paths, verifiedsize, chunk):
for trynumber in range(5, 0, -1):
@@ -37,7 +37,7 @@ def merge_backup(args, config, localconfig, secondaries):
"%s/%s-private.pem" % (paths["privatekeys"],
localconfig["nodename"]))
mergedb = paths["mergedb"]
- chainsdir = mergedb + "/chains"
+ chainsdb = perm(localconfig.get("dbbackend", "filedb"), mergedb + "/chains")
logorderfile = mergedb + "/logorder"
currentsizefile = mergedb + "/fetched"
timing = timing_point()
@@ -119,7 +119,7 @@ def merge_backup(args, config, localconfig, secondaries):
with requests.sessions.Session() as session:
for missingentry_chunk in chunks(missingentries, 100):
missingentry_hashes = [base64.b64decode(missingentry) for missingentry in missingentry_chunk]
- hashes_and_entries = [(hash, read_chain(chainsdir, hash)) for hash in missingentry_hashes]
+ hashes_and_entries = [(hash, chainsdb.get(hash)) for hash in missingentry_hashes]
sendentryresult = sendentries_merge(nodename, nodeaddress,
own_key, paths,
hashes_and_entries, session)