summaryrefslogtreecommitdiff
path: root/tools/merge_fetch.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_fetch.py
parented94e0682912a8ee16cb5a1427166c3e77b51b50 (diff)
Added permdb support to merge
Diffstat (limited to 'tools/merge_fetch.py')
-rwxr-xr-xtools/merge_fetch.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/merge_fetch.py b/tools/merge_fetch.py
index bb1e17e..b77dea6 100755
--- a/tools/merge_fetch.py
+++ b/tools/merge_fetch.py
@@ -9,8 +9,8 @@ import struct
import subprocess
from time import sleep
from mergetools import get_logorder, verify_entry, get_new_entries, \
- chunks, fsync_logorder, get_entries, write_chain, add_to_logorder, \
- hexencode, parse_args
+ chunks, fsync_logorder, get_entries, add_to_logorder, \
+ hexencode, parse_args, perm
from certtools import timing_point, write_file, create_ssl_context
def merge_fetch(args, config, localconfig):
@@ -18,7 +18,7 @@ def merge_fetch(args, config, localconfig):
storagenodes = config["storagenodes"]
mergedb = paths["mergedb"]
logorderfile = mergedb + "/logorder"
- chainsdir = mergedb + "/chains"
+ chainsdb = perm(localconfig.get("dbbackend", "filedb"), mergedb + "/chains")
own_key = (localconfig["nodename"],
"%s/%s-private.pem" % (paths["privatekeys"],
localconfig["nodename"]))
@@ -70,7 +70,7 @@ def merge_fetch(args, config, localconfig):
for ehash in chunk:
entry = entries[ehash]
verify_entry(verifycert, entry, ehash)
- write_chain(ehash, entry, chainsdir)
+ chainsdb.add(ehash, entry)
add_to_logorder(logorderfile, ehash)
logorder.append(ehash)
certsinlog.add(ehash)
@@ -79,6 +79,7 @@ def merge_fetch(args, config, localconfig):
sys.stderr.flush()
print >>sys.stderr
sys.stderr.flush()
+ chainsdb.commit()
fsync_logorder(logorderfile)
timing_point(timing, "add entries")
print >>sys.stderr, "added", added_entries, "entries"