def _add_completed_archive(self):
log.debug('Saving archive metadata to database')
archive = BorgArchive(self.repository, self._repository_key, self._manifest, self.job.archive_name, cache=self._cache)
stats = archive.calc_stats(self._cache)
duration = archive.ts_end - archive.ts
ao = Archive(
id=archive.fpr,
repository=self.job.repository,
name=archive.name,
client=self.job.client,
job=self.job,
nfiles=stats.nfiles,
original_size=stats.osize,
compressed_size=stats.csize,
deduplicated_size=stats.usize,
duration=duration,
timestamp=archive.ts,
timestamp_end=archive.ts_end,
)
self.job.archive = ao
transaction.get().note('Added completed archive %s for job %s' % (ao.id, self.job.id))
transaction.commit()
log.debug('Saved archive metadata')
评论列表
文章目录