-
-
Save corona10/d4fe0b6367ea6865e37b4369a7d60912 to your computer and use it in GitHub Desktop.
gdbm_tolernce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# skip check code that all files are exists, origin, even_snapshot, odd_snapshot | |
# And skip declaring file name | |
if not origin_exist: | |
db = dbm.open(origin, 'nx') # For extension format | |
db.gdbm_failure_atomic(even_snapshot, odd_snapshot) # For snapshot declaration | |
else: | |
latest_snapshot = dbm.gdbm_latest_snapshot(even_snapshot odd_snapshot) | |
db = dbm.open(latest_snapshot, 'r') # Open the latest valid snapshot | |
for k, v in zip('abcdef', 'ghijkl'): | |
db[k] = v | |
db.sync() | |
db.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment