summaryrefslogtreecommitdiff
path: root/tools/merge_fetch.py
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2016-07-08 16:51:55 +0200
committerLinus Nordberg <linus@nordu.net>2016-07-11 15:37:01 +0200
commitb6ce64e114022ea23668cd69ce0ef7517dbe68ad (patch)
tree9c1b3a3e32e7e35bfd57fa98272b367e1545d403 /tools/merge_fetch.py
parente43a199b241d74f7a5ad046139a318576cdf21b6 (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 8a52c9e..3028b30 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"