def backup(output_file): # force checkpoint _env.txn_checkpoint(0, 0, db.DB_FORCE) logs = _env.log_archive(db.DB_ARCH_LOG) logs.sort() backfiles = (_dir + 'porcupine.db', _dir + logs[-1]) # compact backup.... backupFile = BackupFile(output_file) backupFile.addfiles(backfiles)
def backup(self, output_file): # force checkpoint self._env.txn_checkpoint(0, 0, db.DB_FORCE) logs = self._env.log_archive(db.DB_ARCH_LOG) backfiles = [self.dir + 'porcupine.db', self.dir + 'porcupine.idx'] + \ [self.log_dir + log.decode() for log in logs] # compact backup.... backup = BackupFile(output_file) backup.add_files(backfiles)
def restore(bset): __removeFiles() backupFile = BackupFile(bset) backupFile.extractTo(_dir)
def restore(self, bset): self.__remove_files() backup = BackupFile(bset) backup.extract(self.dir, self.log_dir)