Explicitly flush versions to disk on update

Fixes #4
This commit is contained in:
Mikaël Bouillot 2017-02-22 17:20:21 +01:00
parent f05dd3006a
commit d6bf6aba21
2 changed files with 4 additions and 2 deletions

View file

@ -124,12 +124,14 @@ class BsdDB:
p = self.ctype (p)
return p
def put (self, key, val):
def put (self, key, val, sync=False):
key = autoBytes (key)
val = autoBytes (val)
if type (val) is not bytes:
val = val.pack()
self.db.put (key, val)
if sync:
self.db.sync()
class DB:
def __init__ (self, dir, readonly=True):

View file

@ -48,7 +48,7 @@ def updateVersions (tag):
obj = PathList()
for idx, path in buf:
obj.append (idx, path)
db.vers.put (tag, obj)
db.vers.put (tag, obj, sync=True)
def updateDefinitions (blobs):
for blob in blobs: