summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6baae40)
New backends might want to commit changes at close time, and an abrupt
close shouldn't do that.
BE._open(FILE, WRITEP)
Open the existing database FILE; used by `open'.
BE._open(FILE, WRITEP)
Open the existing database FILE; used by `open'.
- BE._close() Close the database, freeing up any resources.
+ BE._close(ABRUPTP) Close the database, freeing up any resources. If
+ ABRUPTP then don't try to commit changes.
BE._get_meta(NAME, DEFAULT)
Return the value of the metadata item with the given
BE._get_meta(NAME, DEFAULT)
Return the value of the metadata item with the given
me._writep = writep
me._livep = True
me._writep = writep
me._livep = True
+ def close(me, abruptp = False):
"""
if me._livep:
me._livep = False
"""
if me._livep:
me._livep = False
return me
def __exit__(me, exctype, excvalue, exctb):
"""Context protocol: see `__enter__'."""
return me
def __exit__(me, exctype, excvalue, exctb):
"""Context protocol: see `__enter__'."""
+ me.close(excvalue is not None)
def _create(me, file):
me._db = _G.open(file, 'n', 0600)
def _create(me, file):
me._db = _G.open(file, 'n', 0600)
+ def _close(me, abruptp):
me._db.close()
me._db = None
me._db.close()
me._db = None
def __enter__(me):
return me
def __exit__(me, excty, excval, exctb):
def __enter__(me):
return me
def __exit__(me, excty, excval, exctb):
+ me.db.close(excval is not None)
###----- That's all, folks --------------------------------------------------
###----- That's all, folks --------------------------------------------------